LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

hex to binary removes leading or trailing 0's

hi,
i'm trying to get a hex to binary conversion.  i am using a hex string to number conversion with the setting at binary, but it is deleting my leading zeros.

for example if i put in a 7 hex, i get 111 instead of 0111.  or if i put in a 0 hex, i get 0 intead of 0000.  i understand it is equally the same thing but the interface i am communicating with is expecting all digits.

thanks,

0 Kudos
Message 1 of 5
(5,220 Views)
Nothing at all is being deleted. You are converting a string to a U32. It does not matter at how you choose to display it. It is still a U32 and if your 'interface' requires a numeric, it will work. If it makes you feed any better, you can choose to display a fixed number of places (all 32) and show leading zeroes by right clickin on the indicator and selecting 'Display Format' but that does not change the underlying data anymore than if you chose to display the number as decimal, octal, or hex.
Message 2 of 5
(5,212 Views)
i understand that it is not being deleted, i was wondering if there is a way to display the bit location that is not displayed.  i looked in the 'display format' and i do not see an option to show leading zeroes. 
0 Kudos
Message 3 of 5
(5,185 Views)
Hi lfoitek,

choose binary display, set the number of bits to show and select "fill with zeros at left"!


Message Edited by GerdW on 02-08-2008 04:50 PM
Best regards,
GerdW


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

You didn't ask about display format. Your concern was that the interface was not receiving the correct data. Here's the Display Format screen (the one that I mentioned). The relevant portion is highlighted. You can also use the 'Help' button.



Message Edited by Dennis Knutson on 02-08-2008 09:19 AM
0 Kudos
Message 5 of 5
(5,166 Views)