LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bianary Number

Solved!
Go to solution

I know this will be simple and appear rudamentarary to some (please be kind).

I am trying to display boolean values as a bianary number. The problem is when I choose to display a bianary number the first bit, if zero gets dropped. Does someone know how to make the indicator display all four bits without dropping the first value if its zero.

 

 

0 Kudos
Message 1 of 5
(2,409 Views)

See the file

0 Kudos
Message 2 of 5
(2,401 Views)
Solution
Accepted by pistonbones

The number is still correct, it is just being displayed differently.  If you want to dispaly all the bits, then you need a minimum field width.  Right click the indicator go to Properties, then the Display Format tab, then check Use Minimum Field Width and set it to 4 with padding with zeros.

 

If I said I make $000010.00 per hour you would say that is a strange way to say $10.  Well this is the same you have a value of 0100 and the indicator says well that is odd you probably mean 100.  Unless you force the control to dispaly leading zeros it will truncate them the same way.

 

EDIT:  Also don't be afraid to ask questions here.  It seems like you had a rough experience.  You put in an effort, you have an understanding, and your question was clear with a posted example.  With these qualities there is no dumb question.

Message 3 of 5
(2,391 Views)

This is a little weird and might not be what you want, but here's a solution I came up with:

Your booleans can be turned to ones and zeroes, which then can be summed with 48 to give the ASCII values for 1 and 0 which can be read as a string.

 

I would be surprised if there isn't a better way to accomplish what you want, but I found this solution oddly amusing.

Download All
0 Kudos
Message 4 of 5
(2,374 Views)

@dmak wrote:

This is a little weird and might not be what you want, but here's a solution I came up with:

Your booleans can be turned to ones and zeroes, which then can be summed with 48 to give the ASCII values for 1 and 0 which can be read as a string.

 

I would be surprised if there isn't a better way to accomplish what you want, but I found this solution oddly amusing.


There are worst ways to do this, but if you were going to do it your way I'd suggest perofrming operations on all of the array elements at once instead of using a for loop.

 

 

0 Kudos
Message 5 of 5
(2,357 Views)