CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

crc16

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
lewiseley



Joined: 30 Oct 2003
Posts: 24
Location: skegness

View user's profile Send private message Visit poster's website

crc16
PostPosted: Sun Jun 11, 2006 6:39 am     Reply with quote

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







PostPosted: Sun Jun 11, 2006 7:07 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jun 11, 2006 9:06 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group