I found this VI in another thread in this forum. It is supposed to compute CRC:s for strings, but I'm not sure it works.
The lower indata, labeled "CRC16" is a constant set to zero. It is operated with something else that is essentially a constant. As far as I can see, much of the lower half of this VI could be replaced by a single constant. The CRC-polynomial is entered at a different place, further to the right.
The constant does change as it goes through the loop. The shift registers allow the value to change and be passed to the next iteration. Now, the CRC calculated in that VI is close to a CRC-CCITT, but I believe the initial value should be 0xFFFF and the author is using 0x0000. But even if I specify 0xFFFF, his program doesn't appear to give the correct CRC-CCITT.
There are a multitude of CRC-16 methods, so you need to figure out which you have. The attached ZIP file has the code I wrote 5 years ago for a CRC calculation for a customer. I found only 1 place on the web that had a "correct" CRC algorithm that could calculate all the examples I found. The code needs to be cleaned up some (I have controls on the inside of case statements), but it should get you started. Below the case statement is some processor code the VI is based off of. You can use the selector to set a standard CRC or specify your own.
I have this LLB in my tool box. Picked it up from internett some years ago. I have used the 8 bit CRC. And it works. I have not checked the 16 and 32 bit. If it is of some help use it ;).
Do you know why it enters the polynomial in an array, sometimes with several values?
And by the way, in case anyone wonders, the one I'm looking for is the 16 bit CRC-CCITT.
Still, it leaves me with questions;
0*2^1 = 0
1000 0000 AND 0000 0000 = 0000 0000
This means the lower right corner could be replaced by a constant, zero, and that the second case structure is completely unnecessary, since the invalue will always be true. Should perhaps the for-index be involved somewhere here?