View previous topic :: View next topic |
Author |
Message |
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
CRC calculate |
Posted: Thu May 23, 2019 4:18 am |
|
|
Hello there;
How's the CRC calculation? Does anyone knows?
So the result of this process is, how 16 turns out.
Code: |
0x01^0x03^0x52^0x4B^0D = 0x16 |
_________________ Es |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9231 Location: Greensville,Ontario
|
|
Posted: Thu May 23, 2019 4:48 am |
|
|
Last edited by temtronic on Thu May 23, 2019 8:18 pm; edited 1 time in total |
|
|
gaugeguy
Joined: 05 Apr 2011 Posts: 303
|
|
Posted: Thu May 23, 2019 5:59 am |
|
|
This cannot overflow. ^ is XOR, which returns the same size it takes.
When I run through this on the calculator using hex values and XOR I get 0x16 as the result. |
|
|
gaugeguy
Joined: 05 Apr 2011 Posts: 303
|
|
Posted: Thu May 23, 2019 6:07 am |
|
|
0x01 ^ 0x03 = 0x02
0x02 ^ 0x52 = 0x50
0x50 ^ 0x4B = 0x1B
0x1B ^ 0x0D = 0x16 |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Thu May 23, 2019 9:16 am |
|
|
I'm not sure if you are just trying to "understand" CRC calculation, or to implement CRC calculation. However, if you only want to implement it, there is a crc calculator in the drivers folder from CCS. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19524
|
|
Posted: Thu May 23, 2019 10:46 am |
|
|
and (of course), simple XOR, is not a terribly 'good' CRC. A proper CRC
calculation is always trying to make the resulting number unlikely to 'repeat'.
Ideally a 16bit CRC want to have only a 1 in 65536 chance of giving the
same value for a different incoming sequence.
XOR is a 'cheap' CRC used on some basic transmissions. Usually involving
only a few bytes. |
|
|
|