LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sum of hex / lrc check

Hi!

I have a string that i want to send trough serial to a device. The thing is, that before i send it, i have to make the LRC check. So, I have to sum the hex string parts. How can I do this?

For example, I have a string control and I write "#01SVT<BL>+098,0<CR><LF>". To make the LRC check i have to make the sum in hexadecimal, so I have to do this:

23+30+31+53+56+54+20+2B+30+39+38+2C+30 = 2C9

Message Edited by Luigi007 on 05-18-2006 05:46 PM

0 Kudos
Message 1 of 7
(5,816 Views)

See the zip file in this thread.

http://forums.ni.com/ni/board/message?board.id=170&message.id=142841&requireLogin=False

There is a checksum vi inside the llb file in this thread that adds the array elements.

0 Kudos
Message 2 of 7
(5,795 Views)
Hi Luigi,
now I understand, where the number 2C9h comes from.
If you sum up the elements, the representation is an integer. This is a CPU- readable representation of a non- floating-point value. If you want to read this value too, it has to be converted into a decimal or hexadecimal representation. The decimal conversion is done by the numeric indicator, only that you can read it. If you need a hexadecimal string to send to the serial port, you have to convert the integer value to the string. the picture shows you, how to do it.
I hope, I helped you.
Greetings, Dave

Message Edited by daveTW on 05-19-2006 01:25 AM

Greets, Dave
Message 3 of 7
(5,787 Views)
Thanks Dave .
0 Kudos
Message 4 of 7
(5,761 Views)

Hello, would you have a picture in False case, too?

0 Kudos
Message 5 of 7
(758 Views)

Hi JC,

 


@JC1111 wrote:

Hello, would you have a picture in False case, too?


You really want another image on an 18 year old example VI? Really?

 

Btw. it's a "default if unwired" tunnel in the case structure, so the other case is EMPTY...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(746 Views)

Thanks!

 

0 Kudos
Message 7 of 7
(736 Views)