LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert U32 to hexadecimal to write in VISA

Solved!
Go to solution

Hi everyone,

 

I'm new to LabView so this may be a trivial question but i'm a bit lost there.

 

I'm trying to program a communication protocol between a microcontroller and my VI.

A function i need to realise is to send unsigned interger numbers up to 4E+7. The format used is therefore U32.

However, when i try to convert these numbers in hexadecimal to write in my buffer, i get different results in Labview (using "number to hexadecimal string") than in an internet converter.

Plus, it seems like the result of the conversion run in Labview is composed by more bytes than needed (4 bytes for a U32)

 

Thank you by advance,

Clement Z.

to_eng_ni_01.png the indicator is in Hex Display

to_eng_ni_02.png

0 Kudos
Message 1 of 3
(3,917 Views)
Solution
Accepted by topic author Orbieu

Hi Orbieu,

 

first: when you convert your number to an OCTAL string you surely will get different results (instead of HEXADECIMAL representation).

 

Plus, it seems like the result of the conversion run in Labview is composed by more bytes than needed (4 bytes for a U32)

Sure. You convert to a string consisting of chars 0-F.

Instead you should TypeCast the number to a string:

check.png

Don't forget to switch the string indicator to "Hex display" mode…

 

Best regards,
GerdW


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

Hi again,

 

The number to octal was a try i did because i noticed that the "number to hexadecimal string" never gets something else than 0..8 so i thought the fonctions were maybe inverted.. silly 😄

 

Anyway thank you for helping me so quickly that's exactly what i wanted !

 

Have a nice day sir

0 Kudos
Message 3 of 3
(3,905 Views)