Width=16 poly=0x1021 init=0x1D0F (or 0xFFFF or 0x0000) refin=false refout=false xorout=0x0000 check=0xe5cc residue=0x0000Īlso attaching a full sheet of examples to make testing easier. Width=16 poly=0x1021 init=0x1D0F (or 0xFFFF or 0x0000) refin=true refout=true xorout=0x0000 check=0圆f91 residue=0x0000ĬRC3 has three types, changing the init values.ĬRC3 = CRC-16-CCITT: Polynomial 1021h (CRC-16/AUG-CCITT, XModem) Both CRC types use the same 0x1021 poly.ĬRC2 has three types, changing the init values.ĬRC2 = CRC-16-CCITT: Polynomial 1021h (MCRF4XX, Kermet) There are a total of 6 "types" of CRC outputs that need to be correctly calculated but there are only two main types, they just use a different initial value. Here are 4 samples with the CRC values already calculated using CRC2 with 0xFFFF CRC Offset.
Something like =RIGHT(A1,2)&LEFT(A2,2) will do that in Excel. Also note that it flips the order of the CRC values so they can be used. Note it is calculating the value based on 01 07 02 05 02 00 01, ignoring the first 01 and the last 04. The returned CRC value is A865, which is then flipped to be 65 A8. ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ = CRC Calculations (Ignore other values, so 01 and the CRC and 04) Result Check Poly Init RefIn RefOut XorOutĠxF083 0圆F91 0x1021 0xFFFF true true 0x0000
Test Data Sequence = %01%07%02%05%02%00%01%00%00 (so it is treated as hex)ĬRC1 cannot be calculated here, see above for instructions on how to calculateĬRC2 = reverse data bytes, reverse CRC result before Final XORĬRC3 = no reverse data bytes, no reverse CRC result before Final XORĬRC2 with 0xFFFF CRC Offset Working Example Here are some resources that might be helpful.Ī bit more technical details about the CRC we are calculating and some resources, examples and how to calculate novel values online as well. We just need a working method to reliably calculate these 2 main types of CCITT 16 bit CRC types using Excel when we supply it a string of hex characters. Or if you feel comfortable just writing this directly in VBA, that works just as well. We need you to take existing C/C++ code that correctly calculates CRC outputs for 16 bit CCITT CRCs and turn it into something we can use in Excel using VBA.