Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

checksum

Hi,
I am trying to implement a checksum calculation which is an inverted modulo-256 of N data byte in Labview 7.1.
In my example I have 3 data bytes and have to calculate the checksum see attachement.
Does anybody can give an idea of a easy code in LV?
 
Thanks in advance 
0 Kudos
Message 1 of 9
(5,414 Views)

Hi Benio,

Put the three (or whatever) numbers in a array, add the array content (one function) outcome should be 0x1C8

Truncate this to a U8 (give 0xC8) and invert this which gives 0x37

Does this help ? Can you try to get this in a VI ?

 

0 Kudos
Message 2 of 9
(5,401 Views)

Hello K C,

thanks for your reply, what do you mean by ''add the array content ''?

I have put the 3 byte in one dimensional array and then create one function ''add the array content''?

 

0 Kudos
Message 3 of 9
(5,352 Views)
Hi,
 
Sorry should be ''add the array contents''  I mean the function "Add Array Elements" found in the numeric pallete.
 
 
0 Kudos
Message 4 of 9
(5,349 Views)
thanks, I have written a code by adding all bytes from the array but since the byte size is 8 bit my result is C8 not 1C8.
My checksum is an 8 bit ones, see below how should be release my checksum, do you know how is the easiest way to write a code which makes an ''add with carry'' operation?

The checksum is the inverted modulo-256 sum

over all data bytes. The sum is calculated by an 'add with carry' operation with the carry bit of

every addition being added to the LSB of the resulting sum. The addition with revolving carry

improves the protection against MSB failures

0 Kudos
Message 5 of 9
(5,343 Views)

Hi Benio,

Carry bits and things like that you need when you are programming in assembler.

In your VI just set your controls and indicators to a I16 size and you will get the answer 0x1C8

0 Kudos
Message 6 of 9
(5,332 Views)

KC,

See how I used your via in my application,

Thx

 

0 Kudos
Message 7 of 9
(5,274 Views)
0 Kudos
Message 8 of 9
(5,274 Views)
Glad to be of help.
0 Kudos
Message 9 of 9
(5,258 Views)