LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

hex directly to decimal

Hi.

I need help to convert hex string (0-9) directly to decimal. Lux meter TES 1339R send via rs232 value of measurement in hex string. This is easy to display but I need value.

For example :

        - Measured value is 453,3 Lm ->  45 33 hex ( display hex)

        - Measured value is 236,8 Lm ->  23 68 hex ( display hex)

 

Maybe some one know better method then index table with all corresponding values.

 

Additionally maybe someone have experience with TES devices and know how to handle query. Device which I have only reply transmit values.

Milus
0 Kudos
Message 1 of 11
(3,551 Views)

This is ONE way to split the numbers (maybe not the best). Though it works.

convert.PNG

 

Then you just have to convert it to hex

---

UnCertified LabVIEW Student
Mistakes are for learning, that's why suggestions are always welcome!
0 Kudos
Message 2 of 11
(3,540 Views)

converting it to hex makes it like this, just incase

convert.PNG

---

UnCertified LabVIEW Student
Mistakes are for learning, that's why suggestions are always welcome!
0 Kudos
Message 3 of 11
(3,533 Views)

Hi Milus,

 

some more ideas:

check.png

Best regards,
GerdW


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

Maybe I'm wrong but I think everybody is taking the problem backward. I think the OP wants to convert an hex string (received from the instrument) to a double value.

 

Ben64

 

hex string to double value.png

 

 

0 Kudos
Message 5 of 11
(3,509 Views)

Bern I guess you are right.

You can simply reverse the steps from my post, I already did it for you though just incase.

 

---

UnCertified LabVIEW Student
Mistakes are for learning, that's why suggestions are always welcome!
0 Kudos
Message 6 of 11
(3,487 Views)

Hi,

 

again without conversion from/to string:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 11
(3,480 Views)

@Milus wrote:

 

I need help to convert hex string (0-9) directly to decimal. Lux meter TES 1339R send via rs232 value of measurement in hex string. This is easy to display but I need value.

For example :

        - Measured value is 453,3 Lm ->  45 33 hex ( display hex)

        - Measured value is 236,8 Lm ->  23 68 hex ( display hex)

 

Maybe some one know better method then index table with all corresponding values.


Hexadecimally formated numbers are 0..F, not 0..9, and I thus have no idea what you are actually talking about. Please explain!

 

The two example conversions you are showing are just a multiplication by 10 (or division by 10, depending on the direction). If you want to display number in hex, use example data that includes characters A..F for less special cases.

 

What is the question about tables? In LabVIEW, a "table" is just a 2D array of strings with a special indicator. Indexing is to get values out, not to do anything with "corresponding values", whatever that means.

 

Please attach a small example VI that contains a few typical raw strings as recevied by the instrument as diagram constant. Then explan what kind of output you want from them.

 

Also include an example table (make current value default before saving) and explain to us what you want to do with it.

 

We definitely need more information, there are too many conflicting statements in your original post. Thanks!.

0 Kudos
Message 8 of 11
(3,474 Views)

Hi

 

The device I'm using send measured value as hex in range 0-9.

see attachment . Measured value 354,9 lm

 

I try proposal of GerdW and this works!!!
I checked whole range and I don't find any problem.

 

Thanks a lot GerdW

Milus
Download All
0 Kudos
Message 9 of 11
(3,433 Views)

Hi Milus,

 

then you should not speak of "hex display" when your device uses a BCD representation... 😄

Best regards,
GerdW


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