LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i add up hex bytes in labview 7?



@tbob wrote:
Once you have the sum of the bytes (a number), AND it with decimal 255, which is the same as FF. These are numbers, not strings. The result is the calculated checksum number. You can use the equals function to compare it to an expected checksum. Wire the calculated checksum in one terminal and the expected checksum in the other (255 in your case) and the output will be true if the two numbers are equal, false if they are not. After converting strings or hex bytes into numbers, you can work with numbers. No need for strings anymore. Whether you want to display the numbers in decimal (255) or hex (FF) makes no difference, the numbers are the same.


I have a similar dilemna. I have a controller that needs me to:
1. take a number
2. remove the decimal
3. convert to hex
4. reverse it and add zeroes to the end if needed
Example:
2134.125 to
2134125 to
2009 6D to
add STX, Address, command #, "data byte" (6D90 2000(h)),ETX
then find checksum......

I tried did all as follows but when I use the "number to hexidecimal string" it obviously gives me a "hex" string. What I need is a hex string in hex format....
6D90 2000 not 6D902000.

Any ideas?



Harene M Pitter
0 Kudos
Message 11 of 18
(3,978 Views)

@hpitter wrote:
What I need is a hex string in hex format....
6D90 2000 not 6D902000.
Any ideas?

Harene,
Typecast.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 12 of 18
(3,959 Views)
thank you very much.

🙂
0 Kudos
Message 13 of 18
(3,934 Views)

what is the name of those blocks?

 

Can you help me?

 

Thanks

0 Kudos
Message 14 of 18
(2,565 Views)

Who are you asking?  This is an 11 year old thread with lots of messages.

 

When replying to a specific message, be sure to use the Quote button so we can see which message you are asking about.

 

Since this thread is mostly about numbers and conversions, look in the Numeric >> Conversion and Numeric >>  Data Manipulations palettes.

0 Kudos
Message 15 of 18
(2,556 Views)

Hi joao,

 

who is "you"? Which image are you talking about?

 

Do you talk about the image named "Swap and Typecast"? Guess what the image name tries to descript…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 16 of 18
(2,557 Views)

Yes that image.... The 2nd and 3rd diagram block please.

 

Thanks

0 Kudos
Message 17 of 18
(2,552 Views)

Hi Joao,

 

again: that image is named "Swap and TypeCast".

Use Quickdrop in LabVIEW (Ctrl-Space) and type "Swap" or "Typecast"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 18 of 18
(2,545 Views)