LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CRC-16 Calculator

Hi all,

 

I am working on automating the primary testing of our controllers using Labview, part of the automation requires communicating with the controller using a message with a CRC16 generated checksum as verification. I can monitor the messages being sent and received using an in house designed monitoring tool. Using this tool I can see the messages being sent with the correct checksum as verification.

 

I have created a CRC16 program to calculate the checksum from an array of unsigned 8 bit integers(converted from HEX), the program generates the correct checksum value in most cases, however it can never generate the correct checksum from input arrays containing one or more 0's.

 

I was wondering if anyone could offer any solutions to fix this, or if any would had any ideas as to why the calculator isn't working correctly when a 0 is used in the input array?

 

 

0 Kudos
Message 1 of 29
(8,327 Views)

I don't have LV2018 so I can't open your vi, but here is a CRC-16 vi I found on this board a long time ago that seemed to work.

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 29
(8,306 Views)

Since all you are doing is calling a DLL, I would say there is an issue with your DLL.

 

We can't really help any more than that unless you have example data and some idea of the CRC parameters (polynomial, where the XOR is, inverting of data, etc).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 29
(8,297 Views)

With regards to the .vi file you attached I cant seem to find a table of values anywhere, the function I have pulls values from a given table. So i am unable to see how this would work in my case.

 

Also I have created a .dll file and created my program using that, I have attached a picture with what I have currently in LV, to allow you too see what I see. I have also attached a copy of the header file used (checksum.h), and a copy of the code used for the CRC (checksum.c).

Download All
0 Kudos
Message 4 of 29
(8,296 Views)

@CCloggie wrote:

With regards to the .vi file you attached I cant seem to find a table of values anywhere, the function I have pulls values from a given table. So i am unable to see how this would work in my case.

 


The VI calculates the checksum from the data you input. Why would you need a lookup table?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 29
(8,288 Views)

This is what I'm working with... (see attached)

0 Kudos
Message 6 of 29
(8,286 Views)

Okay, so your function uses a lookup table and the one I supplied does not.

 

I still do not see the issue, unless there is something about your function you are not telling us. 

 

BTW: I know mine works as I have used it with more than one device that required a CRC-16

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 29
(8,283 Views)

Give this a try.

CRC-16.png



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 8 of 29
(8,280 Views)

The only issue is when I have one or more 0's in the input integer, the generated value is incorrect. 

0 Kudos
Message 9 of 29
(8,275 Views)

In your current code or in the code that I posted? Please provide some examples of you input and what you expect the CRC to be for that input. the code I posted has been tested and in use for years. If you have data that shows there is an error in that code I would like to see it.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 10 of 29
(8,268 Views)