CRC
Archiver
Posts: 46,084
Joe-
Here are CRC8 and CRC16 subroutines suitable for the polynomials
employed to generate Dallas 1-Wire device CRC's. Clear CRC variables
prior to use, pass successive bytes to be added to CRC in variable
"this":
crc16 VAR WORD
crc8 VAR BYTE
j VAR BYTE
addToCRC16:
for j = 1 to 8
if this.LOWBIT ^ crc16 & 1 then feedBack1_16
feedBack0_16:
crc16 = crc16 >> 1 & ~$8000: GOTO nextBit_16
feedBack1_16:
crc16 = crc16 ^ $4002 >> 1 | $8000
nextBit_16:
this = this >> 1: NEXT: RETURN
addToCRC8:
FOR j = 1 TO 8
IF this.LOWBIT ^ crc8 & 1 THEN feedBack1_8
feedBack0_8:
crc8 = crc8 >> 1 & ~$80: GOTO nextBit_8
feedBack1_8:
crc8 = crc8 ^ $18 >> 1 | $80
nextBit_8:
this = this >> 1: NEXT: RETURN
Regards,
Steve
Here are CRC8 and CRC16 subroutines suitable for the polynomials
employed to generate Dallas 1-Wire device CRC's. Clear CRC variables
prior to use, pass successive bytes to be added to CRC in variable
"this":
crc16 VAR WORD
crc8 VAR BYTE
j VAR BYTE
addToCRC16:
for j = 1 to 8
if this.LOWBIT ^ crc16 & 1 then feedBack1_16
feedBack0_16:
crc16 = crc16 >> 1 & ~$8000: GOTO nextBit_16
feedBack1_16:
crc16 = crc16 ^ $4002 >> 1 | $8000
nextBit_16:
this = this >> 1: NEXT: RETURN
addToCRC8:
FOR j = 1 TO 8
IF this.LOWBIT ^ crc8 & 1 THEN feedBack1_8
feedBack0_8:
crc8 = crc8 >> 1 & ~$80: GOTO nextBit_8
feedBack1_8:
crc8 = crc8 ^ $18 >> 1 | $80
nextBit_8:
this = this >> 1: NEXT: RETURN
Regards,
Steve
Comments
run on a BS2? Thanks.
Joe
ago?
Aaron Garber
On Tue, 8 May 2001 15:11:29 -0400 "Joseph Greene" <jlgreene@i...>
writes:
> Does anyone have a reasonably fast/simple CRC calculation routine
> that will
> run on a BS2? Thanks.
>
> Joe
>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
into a incomming data stream on the bs2?
Thanks
Kevin
http://ozma.ssl.berkeley.edu/~dbb/crc-code.htm
http://www.rad.com/networks/1994/err_con/crc.htm
Regards,
Leroy Hall
K Jones wrote:
>
> Can someone explain to me what Crc is and how to implement it
> into a incomming data stream on the bs2?
>
> Thanks
> Kevin
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and Body
of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
CRC stands for cyclic redundancy cycle. Its rather complicated to
explain.I found it in
Basic Stamp second edition by Claus Kuhnel and Klaus Zahnert you might
want to look it up ,it tell how to implement CRC with a stamp
On Thu, 08 Nov 2001 21:51:43 -0000 "K Jones" <kj62@y...> writes:
> Can someone explain to me what Crc is and how to implement it
> into a incomming data stream on the bs2?
>
> Thanks
> Kevin
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>