LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert hex string to number

Solved!
Go to solution

As the attached vi, I am tring to convert string(hex) into number(U8), but seems not work.

 

Any suggestion, thanks.

 

 

0 Kudos
Message 1 of 14
(16,504 Views)

Alex,

 

isn't this what you're looking for?

 

U8.png

Kind regards,

- Bjorn -

Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's 😉
LabVIEW 5.1 - LabVIEW 2012
Message 2 of 14
(16,501 Views)
Solution
Accepted by topic author alex.

Now you have 2 solutions :

 

U8.png

Kind regards,

- Bjorn -

Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's 😉
LabVIEW 5.1 - LabVIEW 2012
Message 3 of 14
(16,497 Views)

What does your "hex string" look like? Is it human readable or it the raw bytes?

Raw bytes, then do as ABCPrograms

 

If you have a two byte string that represent a human readable hex number 0-255 (00 to FF) like "1A"?

Then

Hex.png

 

Omar
Message 4 of 14
(16,480 Views)

 


@alex. wrote:

As the attached vi, I am tring to convert string(hex) into number(U8), but seems not work.

 

Any suggestion, thanks.


 

The question is not clear, because "hex" is very ambiguous. Please put a typical string inside the string control and make it the default, resave, and attach once more. Then tell us what result you expect.

 

How many bytes are in the string?

 

 

  • If it is one byte of a binary string, typecast it to U8. (It would be silly to go to a byte array)
  • If it is two bytes of a hexadecimal formatted string (exclusively containing characters 0..F), scan it using %02x format.
  • If it is more than two bytes, you need to provide us with more information.

 

 

 

Message 5 of 14
(16,474 Views)

Hi All

I am trying to converter 4 bit hex string to number. I know the right results. But I do not know how converte. Please see the attached vi

Please help me.

Thanks

0 Kudos
Message 6 of 14
(15,452 Views)

duplicate post, continue here

 

Hong: What's the point of creating 3 identical posts in 3 different threads?

Best regards,
GerdW


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

Hi Alex, 

 

But how to convert the unsigned byte array into a decimal number? I think that was the question. 

 

Cheers

0 Kudos
Message 8 of 14
(9,157 Views)

Hi dadest,

 

how to convert the unsigned byte array into a decimal number? I think that was the question. 

Simple answer: Just display that U8 array in an array indicator. Set the display mode to decimal.

 

More complex details:

How do you want to display your U8 array?

Do you need any special conversion?

Can you provide an example with some input data and expected result?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 14
(9,145 Views)

Hi GerdW, 

 

Thanks for the reply. Yes, I can just display as decimal but the thing is that I want to be able to use that data for calculations.

 

For example, the maximum output of my circuit is 1.3V that corresponds to 0514 (HEX) which I am reading using Bluetooth LE.

So if I read 025C (HEX), that corresponds to 604dec and that turns out to be 0.604mVolts. I want to be able to continuously read this voltage and display it as a waveform. 

 

Cheers.

0 Kudos
Message 10 of 14
(9,111 Views)