09-26-2016 05:46 PM
Hi all, I was not so far from a solution but if I can get some help please to calculate a CRC12 on 12bit of 39 words of 16bits...
The polynomial is x^12+ x^11 + x^3 + x^2 +x +1 and the recprocal notation is 0cC07.
Thanks a a lot in advance
Jérémie
09-26-2016 08:17 PM - edited 09-26-2016 08:21 PM
Do you have any attempts made at trying to solve this yourself?
Also do you have some correct CRC conversion data so that even if we wanted to solve your problem for you we could test that our solutions actually worked.
09-28-2016 02:51 PM
Hello
Thanks for first answer. Of course I will try myself but some parts are not fully clear.
Here the data for a CRC code = 0x499
Hexa |
8000 |
0019 |
4400 |
0004 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
BAE0 |
0004 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
0000 |
70C3 |
0004 |
0054 |
0001 |
0000 |
0000 |
003C |
0000 |
I have an excel macro code:
#########################################
' bit-serial calculation (more straightforward)
' #########################################
For j = 0 To 15
' get LSB of the word
Bit = d(15 - j)
' create the lfsr
NewCrc(11) = Crc(10) Xor Bit Xor Crc(11)
NewCrc(10) = Crc(9)
NewCrc(9) = Crc(8)
NewCrc(8) = Crc(7)
NewCrc(7) = Crc(6)
NewCrc(6) = Crc(5)
NewCrc(5) = Crc(4)
NewCrc(4) = Crc(3)
NewCrc(3) = Crc(2) Xor Bit Xor Crc(11)
NewCrc(2) = Crc(1) Xor Bit Xor Crc(11)
NewCrc(1) = Crc(0) Xor Bit Xor Crc(11)
NewCrc(0) = Bit Xor Crc(11)
'Crc(0) = Bit Xor DoInvert
'Debug.Print "0x" & Hex(convert_to_long(Crc))
For k = 0 To 11
Crc(k) = NewCrc(k)
Next k
Next j
' create normal view of Crc
CrcLong = convert_to_long(Crc)
Debug.Print i & " " & ActiveSheet.Cells(StartRow + i, StartColumn).Value & " 0x" & Hex(CrcLong)
CrcString = Hex(CrcLong)
ActiveSheet.Cells(StartRow + i, StartColumn + 1).Value = "0x" & Replace(Space(3 - Len(CrcString)), " ", "0") & CrcString
Next i