Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

CRC ALGORITHM FROM C TO LABVIEW

Managed to sort the C extracts out. Because the code has to run on an embedded micro a table is used instead of a polynomial which from links on this forum identify as a more efficient method of CRC check.

 

So I have manged to create the table in Labview and attached as a vi if anyone is interested. In the vi there is the first method that I used which does it showing the boolean values so I could check/debug operation. The second loop below does the same job but more compact.

 

The problem I now have is trying to break down the first part of the C extract that takes the incoming data and XOR's it with the table. I have followed the posts on this link http://forums.ni.com/ni/board/message?board.id=170&message.id=375052&query.id=1024285#M375052 replaced the fixed table with mine but cannot get the correct result. Also had a go with Vi's posted here http://forums.ni.com/ni/board/message board.id=170&message.id=270534&query.id=1024532#M270534

 

The main problem that I am having is tryingto get the concept of how the table is used with the incoming data. Had a look at this document http://christalmirror.ifrance.com/christalmirror/christal/Crc/files/F_crc_v31.html but struggling to get my head around the concept. Could anyone offer a simple explanation? (its probably just me and real easy!!)

 

Thanks Jack

 

 

Labview Version 8.5
Labview Version 8.6
Labview Version 2014
0 Kudos
Message 11 of 14
(2,048 Views)

Sorted! Thanks to a posting here http://forums.ni.com/ni/board/message?board.id=170&message.id=384602&query.id=1047536#M384602 by Wayne.C

 

his vi at http://forums.ni.com/ni/attachments/ni/170/385182/1/Alternate%20MB%20CRC-16.vi did the trick. Replaced the table in this vi with the one generated from my code posted earlier and removed the swap Bytes on output of For loop and bingo!!

 

Many thanks to all who posted info on this topic over the time. However I still do not fully understand how it works and need to go through it just to satisfy my curiosity.

 

Cheers

 

Jack

Labview Version 8.5
Labview Version 8.6
Labview Version 2014
0 Kudos
Message 12 of 14
(2,045 Views)

Hi Jack,

 

I'm glad you have it up and running and now have the functionality you require, thanks for posting back the solution links for others who may search the forum in the future,

 

All the best, 

Applications Engineer
0 Kudos
Message 13 of 14
(2,038 Views)

I just went through the trouble of making a bit-wise CRC VI that outputs a CRC code that matches the online calculators I've found, but does not match the NI example VI even when I change the example's Cinit value to 0x0000 and polynomial to 0x1021. I question whether the example works correctly or whether the endiness is what I expect.

____
Ryan R.
R&D
0 Kudos
Message 14 of 14
(1,694 Views)