LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I calculate CRC?

Hello all,

 

I would like to know how to calculate the checksum in Labview.

Ex. code is appreciated.

I have a couple of syntax ex. in VB and C/C++ as follow.

 

B. Generating a checksum for a binary request

Calculate the accumulated sum of the bytes in the vector.

Get the value of the sum modulo 65536 (10000 hex)

The CRC is the 2 complement of the result.

If lSum is a variable holding the accumulated sum, then

 

CRC = (Not (lSum Mod &H10000)) + 1 (VB syntax).

CRC = (~(lSum % 0x10000)) + 1 (C/C++ syntax).

 

Note that the CRC is a two-byte value (while in ASCII format it is a one-byte value).

 

 

Kind regards

Andreas Svensson

0 Kudos
Message 1 of 5
(5,341 Views)
Please do a search. This question has come up many times before, and numerous CRC VIs have been posted.
0 Kudos
Message 2 of 5
(5,324 Views)
0 Kudos
Message 3 of 5
(5,296 Views)

Hi Andreas,

 

Your description is for a checksum calculation not for a CRC.

Message Edited by K C on 11-27-2009 04:49 PM
0 Kudos
Message 4 of 5
(5,282 Views)

Thanks KC for pointing that out.

 

Just in case you were looking for the CRC and not Checksum..  below are links of interest...

 

 

I didn't check the contents of the examples, but it is supposidly for a CRC16.

 

http://forums.ni.com/ni/board/message?board.id=170&message.id=142902

 

another from Shane:

http://forums.ni.com/ni/board/message?board.id=170&message.id=66015

 

 

 

 

Message 5 of 5
(5,270 Views)