LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I add three binary numbers and then convert to string (Hex format)?

Hi All,

 

I have my problem "half" resolved, but need some assistance on the final piece.  Overall, I need to take three string values (hex format), convert them to binary, add them and then convert back to a string (hex format).  If that doesn't make sense maybe this will:

 

Final Result (My target) = 0xCC

 

 = 0x03 + 0x01 + 0x04

          = 0x03; 0011b

          = 0x01; 0001b

          = 0x04; 0100b

For my app, we are dropping "masking" some of the bits so that we get 1 byte:

          = 0x03; 11b

          = 0x01; 001b

          = 0x04; 100b

So...

11001100b = 0xCC

 

In my VI, I am taking each initial string [0x03,0x01 and 0x04] type casting them to U8.  Next I need to "mask" the binary values as shown above and then add them.  I am not sure how to do this in LV??

 

Thanks for the help,

Bryan

0 Kudos
Message 1 of 2
(3,230 Views)

Hi Bryan,

 

there's a conversion palette in the string palette, ever looked at those functions?

The rest is pure simple math:

check.png

It's the straight-forward way, there are other possibilities too!

Best regards,
GerdW


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