From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Web UI Builder and Data Dashboard

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting hexadecimal 2 byte data to a numerical value

Hi,

 

I have hexadecimal data that I am receiving using Bluetooth. I want to convert this hexadecimal 2 byte data into a numerical value so I can plot it in a waveform as the data I am receiving is an analog voltage from a sensor. 

 

The data format is like this: 020F so the numerical (decimal) value I need would be 527. I can them manipulate this and convert it to a useful voltage value. 

 

Help please, I tried converting it to a string first and then using the "Hexadecimal string to number" function but it didn't work.

 

Cheers,

David

0 Kudos
Message 1 of 3
(6,412 Views)

dadest100,

 

How are you displaying the hexadecimal values? I was trying to reproduce what you are seeing and having a hard time. Is it possible for you to post your VI? 

 

-Michael

0 Kudos
Message 2 of 3
(6,385 Views)

It depends if you have a hexadecimally formatted string of 4 bytes containing the characters 0..F excusively or if you have a binary string of two bytes that, if set to hex display mode displays what you describe.

 

Once you know what you have, you can do one of the following (Seems the byte order is big endian).

 

(The function at the bottom is "unflatten from string")

 

HexHexHex.png

0 Kudos
Message 3 of 3
(6,187 Views)