LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CRC-16-DNP Calculation Trouble

Solved!
Go to solution

Having trouble implementing a Labview version of a CRC calculation performed in our FW. This is for a 16 bit DNP protocol. I have implemented a very simple VI that I believe is true to the code implementation, but I am not coming up with the same results.

 

Test message is

05 64 0b c4 01 00 40 00

with a proper CRC of 

A72E

 

I however get a CRC calculation of D158. Not sure where I have gone wrong. Any help would be greatly appreciated.

 

Matt Kraus
0 Kudos
Message 1 of 6
(4,459 Views)

My only guess at the moment is that you make a mistake in the table.  I just do not have the time to check all 256 elements.


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 2 of 6
(4,421 Views)
Solution
Accepted by topic author 14gipper

Looks like you might have missed one last step from the calculation. After googling CRC-DNP, the final step is to take the complement and swapping bytes to get the final answer.

 

CRC-16-DNP.png

Feel free. Contact me for anything more,
    Pang

You too can be LabVIEW Awesome!
Message 3 of 6
(4,391 Views)

@pangvady wrote:

CRC-16-DNP.png


Rube!  There is a primitive called Swap Bytes that you can use instead of the Separate Numbers and Join Numbers.


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
Message 4 of 6
(4,382 Views)

That did it. Thanks for the catch. Banged my head against the monitor all day over that.

Matt Kraus
0 Kudos
Message 5 of 6
(4,350 Views)

Finished VI attached for the next lost soul searching for DNP CRC.

CRC-16-DNP.png

Matt Kraus
0 Kudos
Message 6 of 6
(4,345 Views)