LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert Hexadecimal string to binary

hai,
How to convert Hexadecimal number to binary
8300000000008002 hexadecimal No. to binary
how to convert.
thanks
sasi
0 Kudos
Message 1 of 6
(23,497 Views)
This is a 64 bit number, how do you want to convert it: to a byte array, as a single i64 or u64 integer, another way?

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 6
(23,483 Views)
Hello developer,

you also have to define what a "binary" is! Do you want to have a boolean array or a string containing "0" and "1"?
Converting to a different string is easy: Use "Scan from string" to convert your hex string to a number and "Format into string" to get a boolean string. The format codes are "%x" and  "%b", respectively. You can also use the intermediate number to convert to a boolean array.


Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 6
(23,475 Views)
First point to note - as already mentioned, the hex number equates to a 64 bit binary number, and it's only since LabVIEW version 8.0 that 64 bit integers are handled.
 
Presuming you have LV 8 then see the attached VI...
 
Important: You must wire a 64-bit integer to the "default" input of the "Hex to Number" function, if you want the function to return a 64-bit integer output, because otherwise it will return a 32 bit number by default (legacy from before LV handled 64 bit integers) 
 
Mark.
 
P.S. If you don't have LV 8 then there would have to be more code involved to split the hex string into two parts, then convert the two parts before recombining into a 64 bit string..
Message 4 of 6
(23,472 Views)
Hello,
thanks for ur replies

i want to have hexadecimal to boolean array

i am using labview 7.1 version

thank you
sasi
0 Kudos
Message 5 of 6
(23,467 Views)
Try this vi. Note that we need to split the hex string in two parts each 32 bits long.

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 6 of 6
(23,448 Views)