Searching \ for 'CRC & PIC' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/method/errors.htm?key=crc
Search entire site for: 'CRC & PIC'.

Truncated match.
PICList Thread
'CRC & PIC'
1997\02\25@090834 by Riccardo Bianchi

flavicon
face
I'm looking for a way for implementing CRC calculation on C84.
I'm crazy? May be!
Can someone help me?

About simulator: i think that dos version of MPSIM is better than Windows
version. Faster and view screen updated during program execution. I've lost
something?

Thanks and bye.


Riccardo Bianchi
spam_OUTrbianchiTakeThisOuTspamiper.net

1997\02\25@094842 by Chaipi Wijnbergen

flavicon
picon face
On Tue, 25 Feb 1997, Riccardo Bianchi wrote:

> I'm looking for a way for implementing CRC calculation on C84.
> I'm crazy? May be!

I do not think that you are crazy at all. Bellow you will find a routine
that I wrote in X86 assembler that does One Pass per Byte and accumulate
the CRC16 of a message (routine CRC16) and a routine that checks a buffer
to see if a recieved CRC16 is valid (routine ck_crc16). My only request is
that after you modify it to PIC assembler you share it with the list.

Chaipi

PS. Do not ask me how it works, it DOES.

;*****************************************************************************
;*                                                                           *
;* ROUTINE      : ck_crc16                                                   *
;*                                                                           *
;* PROGRAMMER   : CHAIPI WIJNBERGEN                                          *
;* LAST REVISED : 26.01.1986                                                 *
;*                                                                           *
;* INPUT        : data in a buffer pointed by a pointer in stack             *
;* OUTPUT       : crc16 calculated & returned AX                             *
;*                                                                           *
;* DESTROYS     : none                                                       *
;*                                                                           *
;* CALLED BY    : c program                                                  *
;* CALLING      : crc16                                                      *
;*                                                                           *
;*****************************************************************************

_ck_crc16 proc   far

       save    bp
       mov     bp,sp
       save    ax,bx,cx,si,es   ; macro push registers

       mov     si,ss:[bp+6]                    ;get pointer offset from stack
       mov     ax,ss:[bp+8]                    ;get pointer segment
       mov     es,ax                           ;use es

       sub     ax,ax
       sub     bx,bx
       sub     cx,cx

       mov     cl,es:byte ptr [si+len]         ;length of data filed
       add     cx,head_crc                     ;add header+type+len
char1:
       cmp     cx,0                            ;end of buffer count?
       jz      buf_end1                        ;yes get out

       mov     ah,es:byte ptr [si]             ;get data byte from buf
       inc     si                              ;point to next char in buffer

       call    _crc16                          ;calculate crc16
       dec     cx                              ;decrement counter
       jmp     char1

buf_end1:
       mov     es:byte ptr [si-2],0

       mov     _crc,bx                         ;save last crc16


       restore bp,ax,bx,cx,si,es  ; macro pop resgisters

       ret
_ck_crc16 endp


;*****************************************************************************
;*                                                                           *
;* ROUTINE      : crc16                                                      *
;*                                                                           *
;* PROGRAMMER   : CHAIPI WIJNBERGEN                                          *
;* LAST REVISED : 15.01.1986                                                 *
;*                                                                           *
;* INPUT        : AL = next char from buffer                                 *
;* OUTPUT       : BX = crc16 calculated & updated                            *
;*                                                                           *
;* DESTROYS     : none                                                       *
;*                                                                           *
;* CALLED BY    : make buf                                                   *
;* CALLING      : none                                                       *
;*                                                                           *
;*****************************************************************************

_crc16    proc   near

       xor     bh,ah

       mov     ah,bh

       shl     ah,1

       mov     al,0

       rcl     al,1

       xor     ah,bh

       rcl     ah,1

       rcl     al,1

       xor     al,bl

       test    bh,bh

       jpe     odd

       xor     ax,0380h

odd:    mov     bh,al
       mov     bl,ah
       ret

_crc16   endp
crc16_TEXT      ends

       END



                              \\\|///
                            \\  ~ ~  //
                             (  @ @  )
----------------------------oOOo-(_)-oOOo--------------------------------------
!                                                                             !
! Chaipi Wijnbergen                                                           !
! Electronics/Computer Eng. M.Sc.  Tel    : +972-8-9343079                    !
! Optical Imaging Laboratory       Fax    : +972-8-9344129                    !
! Brain Research Center            Email  : .....chaipiKILLspamspam@spam@tohu0.weizmann.ac.il       !
! Weizmann Institute of Science    URL    : http://www.weizmann.ac.il/~chaipi !
! Rehovot 76100 ISRAEL             IPhone : chaipi                            !
!                                                                             !
------------------------------------Oooo.--------------------------------------
                         .oooO     (   )
                         (   )      ) /
                          \ (      (_/
                           \_)

1997\02\25@111537 by Andrew Warren

face
flavicon
face
Riccardo Bianchi <PICLISTspamKILLspamMITVMA.MIT.EDU> wrote:

> I'm looking for a way for implementing CRC calculation on C84.
> I'm crazy? May be!
> Can someone help me?

   Sure, Riccardo...

   See the answer to Question #76, in the "Microchip PIC" section
   of the "Answers" page on my company's web site.

   -Andy

=== Andrew Warren - .....fastfwdKILLspamspam.....ix.netcom.com
=== Fast Forward Engineering, Vista, California
=== http://www.geocities.com/SiliconValley/2499

1997\02\25@133309 by mike

flavicon
picon face
In message  <EraseME199702251411.PAA10195spam_OUTspamTakeThisOuTrimini.iper.net> PICLISTspamspam_OUTMITVMA.MIT.EDU
writes:
> I'm looking for a way for implementing CRC calculation on C84.
> I'm crazy? May be!
> Can someone help me?
>
> About simulator: i think that dos version of MPSIM is better than Windows
> version. Faster and view screen updated during program execution. I've lost
> something?

The windows are updated if you select "Animate" from the run
menu.


Regards,

Mike Watson

1997\02\25@162254 by sdavidson

flavicon
face
Andy,

What about using just a 8 bit CRC for 4 words of data.  Is that crazy?  Would
a checksum be better?

Steve

--- On Tue, 25 Feb 1997 08:21:12 -0800  Andrew Warren <@spam@fastfwdKILLspamspamIX.NETCOM.COM>
wrote:
Riccardo Bianchi <KILLspamPICLISTKILLspamspamMITVMA.MIT.EDU> wrote:

> I'm looking for a way for implementing CRC calculation on C84.
> I'm crazy? May be!
> Can someone help me?

   Sure, Riccardo...

   See the answer to Question #76, in the "Microchip PIC" section
   of the "Answers" page on my company's web site.

   -Andy

=== Andrew Warren - RemoveMEfastfwdTakeThisOuTspamix.netcom.com
=== Fast Forward Engineering, Vista, California
=== http://www.geocities.com/SiliconValley/2499


-----------------End of Original Message-----------------

-------------------------------------
E-mail: spamBeGonesdavidsonspamBeGonespamits.bldrdoc.gov
Steven Davidson
Dept. of Comm.  NTIA-ITS.N2
325 Broadway
Boulder, CO  80303
W 303-497-3411  FAX 5995
-------------------------------------

1997\02\27@034714 by Andrew Warren
face
flavicon
face
sdavidson@ITS.BLDRDOC.GOV <TakeThisOuTPICLISTEraseMEspamspam_OUTMITVMA.MIT.EDU> wrote:

> What about using just a 8 bit CRC for 4 words of data.  Is that
> crazy?  Would a checksum be better?

Steve:

Depends on how much error-resistance you need.  Checksums, in
general, are less robust than CRCs... Aside from anything else, they
give much more weight to the low-order bits of your data than the
high-order bits.

For some other ideas, you might want to take a look at the
explanation of Hamming codes on the "Answers" page of my company's
web site... It's in the "Miscellaneous" section of that page.

-Andy

=== Andrew Warren - RemoveMEfastfwdspamTakeThisOuTix.netcom.com
=== Fast Forward Engineering - Vista, California
===
=== Custodian of the PICLIST Fund -- For more info, see:
=== www.geocities.com/SiliconValley/2499/fund.html

More... (looser matching)
- Last day of these posts
- In 1997 , 1998 only
- Today
- New search...