Question

I am trying to interface with some system and in their specs they require to calculate CRC 16 for serial communication. Here is an extract from documentation

"16 bit CCITT CRC of the message utilizing the standard polynomial, X16 +X12 +X5 +1. Seed values are always 0 (zero)"

First of all I only found 2-3 samples of C# code of how to do it and none of the seem to give me the correct value. I tried this one http://www.sanity-free.com/133/crc_16_ccitt_in_csharp.html, but I am not sure what to set for initial value. I tried zeros and still doesn't work.

Data I am testing it with is:

0x00 0x09 0x10 0x01 0x01 0x7C 0xF4 0xB8 0x00, 

the CRC value I get is

0xF2 0x24, 

however their system says it should be

0xC0 0x2F

My understanding is that polynomial x16 + x12 + x5 + 1 = 0x11021, however even when I use this one in the code it still gives me wrong answer. What am I doing wrong?

Was it helpful?

Solution

I figured it out. I had to use CRC16-CCITT Kermit inmplementation. I think their documentation needs to be updated as it uses a different polynomial.

http://www.sanity-free.com/147/standard_crc16_and_crc16_kermit_implementation_in_csharp.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top