LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CRC code?: x^8+x^7+x^2+1 poly, FDBK=0xA1, init val=0xFF

I'd like to generate a CRC CCITT code.  I found some that are 8 bit, but they are few compared to 16 and 32 bit.
Looking at the vi's, I don't see how the generating poly is being used, nor how the feedback value is being used?
There is not much to go on...? I have a set of values to use as a verification that the code is generating the right CRC:
U11=0x65, W1234=0xCF, W12=0x76, M01=0x43 etc.  Input is a generally a letter followed by a pair or quad of numbers generally. 

Anybody know what to make of this?  I have some C code that apparently does the calculation, but I don't want to post it here.
Many Thanks!
0 Kudos
Message 1 of 5
(4,138 Views)
Are these VIs that you go on this site, or somewhere else? A search on ni.com revealed a fair bit, including a 16-bit CRC CCITT example.

If you think the C code does what you want, the best option for you may be to compile the C code into a simple DLL and just call it from LabVIEW.
0 Kudos
Message 2 of 5
(4,119 Views)
Smercurio,

They are things that I found on the NI discussion boards such as this:

http://forums.ni.com/ni/board/message?board.id=170&message.id=66012&view=by_date_ascending&page=1

There was a spiffy 16 bit CRC that was posted there by Waldemar, and I attach it.   I don't know how to reduce it
to 8 bits, and wondered how to do that. It has lots of knobs and switches to adjust things, always desirable when reverse engineering something like this.  I found it impressive.  (There are other worthy candidates out there, too...)  I don't think reducing the order of the polynomial is sufficient to take you to 8 bits, because of the XORing all the way through.

I do have a lookup table and I figured out how to use it.  I have a snippet of C code that might generate the table.  I am rusty on C,
but think I know what it is doing to generate the table.  I may be able to generate the table in Labview, -without testing it in C first, -though I 'd prefer the satisfaction of knowing that the code I am working from, is right.     It is amazing how different all the CRC vi's look compared to eachother. 

The table is only 256 values,  so I can type those into an array by hand and that will suffice, to get my application up and running.
I'd still like to know how to make a CRC generator myself, how to change the number of bits as well as the polynomial. 
The feedback constant 0xA1 is used to generate the table itself, but not otherwise,  so that clears that up.

Thank you for the DLL suggestion.  I did not know about that and it may prove useful.  I don't have a C compiler, but I can probably access one if I need to.

Thank you again.  -sroman




0 Kudos
Message 3 of 5
(4,096 Views)
To All.  Attachment I mentioned is here: -sroman
Message 4 of 5
(4,090 Views)

Hi sroman,

Some useful information for this forum may be some links to websites that will define CRC and CCITT.  In addition, it might be useful to post the 8 bit algorithm you are trying to program in LabVIEW as well as some code (such as C or some other language).  I know you stated that you have C code that you do not want to post on the forum; can you find other code that does a similar thing?

Best of luck on your application, and have a great day!!

Regards,
Ching P.
DAQ and Academic Hardware R&D
National Instruments
0 Kudos
Message 5 of 5
(4,073 Views)