From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
03-22-2016 03:57 PM - edited 03-22-2016 04:05 PM
I am using a CRC-16 VI from an NI community page that uses 0xA001, which is the reverse of the polynomial I want to use, 0x8005. For example, with one byte data 0xD6, the CRC-16 with 0xA001 is 0xDE3E, it should be 0x9E81 using polynomial 0x8005. Simply changing the polynomial does not seem to give the right result. I have an image attached. Is there something I should "flip", or "reverse" to in order to use the polynomial I want and get the right answer?
Solved! Go to Solution.
03-22-2016 04:29 PM
Unfortunately, there are many ways to do a CRC. Where are you getting the data point for your example? Does that source have some source code (usually in C) we can look at?
03-23-2016 07:19 AM
The data is entered in the front panel. This VI can be used as a sub-VI for other VIs. There is no C-code, just the VI.
03-23-2016 08:13 AM - edited 03-23-2016 08:19 AM
The input control is an array of U8.
If your data source is little endian, then the bytes might need to be swapped after converting the array to unsigned word integer. LabVIEW is big endian.
http://zone.ni.com/reference/en-XX/help/371361H-01/glang/swap_bytes/
03-23-2016 08:42 AM
@swbpnole wrote:The data is entered in the front panel. This VI can be used as a sub-VI for other VIs. There is no C-code, just the VI.
What I was asking is where your "0x9E81" came from.
03-23-2016 08:51 AM
I used an online CRC-16 site to check the output of the VI against. This one:
03-23-2016 09:17 AM
After downloading the library from that site, I see that the CRC-16 with a 0x8005 is doing things a little differently than a "normal" CRC. I'll see if I can get some time at lunch to mess around with it.
03-23-2016 09:20 AM
I am not using the library from that site. I was using the site's online CRC calculation to check the output of the VI above against the site's normal CRC-16. In the end, I need the VI above to compute CRC-16 with polynomial 0x8005...
03-23-2016 09:43 AM
03-23-2016 10:18 AM
@jamiva wrote:
Finally do a "Bit Reversal" of the CRC.
I did not think about reversing the bits in the final CRC. It is kind of a pain, but it did work.