LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hex Conversion

Hi anyone,
 
How to convert FF01 (2bytes) to 111111111 (binary format)???
 
regards,
Simon
0 Kudos
Message 1 of 8
(3,580 Views)
Simon,
The conversion is done with the Display Format property (right-click on the control or indicator and choose Display Format...).



0xFF01 in binary would be 1111111100000001. See my other screenshot.

Message Edited by Bill@NGC on 09-16-2007 09:27 PM

Download All
0 Kudos
Message 2 of 8
(3,566 Views)
Ok, I posted the wrong Display Format screenshot showing the Hex format. Here's the one for binary.
Message 3 of 8
(3,560 Views)

FF01 (=2 bytes) cannot be "converted" into 11111111 (=1 byte) without loss in information. Seems you want to keep only the first byte, so if the FF01 is a 16bit numeric, you can use "split number" and only take the high order byte as U8.

If FF01 is a 2 byte binary string, use "string subset" to get the first byte.

How it is formatted for human consumption on the front panel is irrelevant for the underlying data. FF and 11111111 are the same. If you want it displayed differently, use Bill's advice above.

If you could explain in a bit more detail what you actually want, we can offer more specific advice. 🙂

Message 4 of 8
(3,554 Views)

Hi guys,

Thx for the response. What i doing now is monitor each bit being set high or low when the device return back hex data through com port. If received FF01, then i know all 9 bit set high (111111111), same for 0000, then all bit set low(000000000). Attach with my test.vi.

regards,

0 Kudos
Message 5 of 8
(3,545 Views)
Sorry, I did not count right, thought you only had 8 bits. 🙂
 
Anyway, it seems your data is probably little endian. If you use unflatten with the little endian option, you don't need to split the number. Just format with %09b and you get the binary pattern (reverse the string if desired). I assume that you can never have an input corresponding to more that 9 bits.
 

Message Edited by altenbach on 09-17-2007 12:01 AM

Download All
Message 6 of 8
(3,534 Views)
Hi altenbach
This's the one that i'm looking for. Thanks for the help.
 
Thx and Regards,
Simon
0 Kudos
Message 7 of 8
(3,524 Views)
Message 8 of 8
(3,507 Views)