LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make calculation based on hex display?

Solved!
Go to solution

I am trying to convert a float number to hex, then get the sum of each byte. Please see attached pic, e.g. 30.5 convert to 403E 8000 0000 0000 using hex dispaly. I want to get the sum of each byte, 40+3E+80+00+00+00+00+00, how could I do it in the labview.

 

Any help will be greatly appreciated!

 

Stephen

0 Kudos
Message 1 of 5
(2,916 Views)
Solution
Accepted by topic author stephenzhou74

I didn't try, but I think you can use "String to Byte Array" and then add the array elements.

 

Hope this helps,

Daniel

 

0 Kudos
Message 2 of 5
(2,912 Views)
Thanks a lot! It works!
0 Kudos
Message 3 of 5
(2,904 Views)
You can eliminate one more step by typecasting the dbl directly to an u8 array.
Message Edited by altenbach on 05-08-2010 04:58 AM
0 Kudos
Message 4 of 5
(2,885 Views)

One thing to take care:

The sum of the U8 array might easily be > 255, so the U8 containing the sum might overflow. To prevent this you might have to transform the array to U16.

 

0 Kudos
Message 5 of 5
(2,853 Views)