View previous topic :: View next topic |
Author |
Message |
lewiseley
Joined: 30 Oct 2003 Posts: 24 Location: skegness
|
crc16 |
Posted: Sun Jun 11, 2006 6:39 am |
|
|
are there different flavors of crc16.
its just that i needed crc16 routine to check data coming out of a dallas ds2406 one wire part. so i pulled one off of this forum ( actually pulled 4 different ones ) and all of them gave different results.
ended up writing my own in the end. so i saved no time at all.
the few tests i did were :
start of with crc16 of 0x90f1 pass it a byte of 0x75 result should be 0x6390.
then feed it with the 0x6390 crc and it should come to 0x0000.
do same with inverse of 0x6390 and it should come to 0xb001.
anyhow mine works! |
|
|
Ttelmah Guest
|
|
Posted: Sun Jun 11, 2006 7:07 am |
|
|
Yes. A crc 'name', should have two parts. The length of the result (16 bits for crc16), and the terms used in the polynomial to generate the result (normally expressed as a number, with each bit represending whether this term is used of not). The 'crc16' used in xmodem for example, is '0x8328'. There are perhaps a dozen 'common' CRC16 versions, out of the 65535 forms that are potentially 'possible'.
Without this number, you cannot tell what CRC16 is being used...
Best Wishes |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Sun Jun 11, 2006 9:06 am |
|
|
I've done some work on CRCs and have found them to be confusing. Everybody is talking about CRC-16 or CRC-32 like these are easily interchangable standard functions while in fact you have to define up to six different parameters to define a single CRC routine, see chapter 15 in http://www.cs.waikato.ac.nz/~312/crc.txt.
The CRC16 used for the DS2406 uses the polynome X16 + X15 + X2 + 1 (0x8005) which is also used in XModem but returns the CRC in complemented (inverted) form.
A site that I have found very helpful for testing the several parameters is http://www.zorc.breitbandkatze.de/crc.html |
|
|
|