LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Decimal to Binary - Concatenate - Binary to Decimal

Salutations,
I looked at the bin to dec vi provided by national instruments as example code.  I notice they used a front panel control and a switch to change from binary to decimal and back to binary; this process utilized a property node to control the format of the front panel control.  I was hoping there was an easy way to take a decimal number and convert it to binary (i am sending an array of numbers into a for loop), and then eventually back to decimal.  My process is as shown:

Index two arrays and you get the numbers 2 and 4.
2 - convert to binary - 10
4 - convert to binary - 100
I then want to concatenate these two numbers to form: 10100
Taking this new number back to decimal:  10100 -> 20.

I looked through the "numeric conversions" section and found nothing to be of assistance.  I also tried to format the number into a binary string and then work back out, but this didn't come out too well.  I was hoping there was a vi that was already created to format the numbers as I see fit.  Otherwise, I do know how to convert between binary and decimal and then back, I was just hoping to avoid this cumbersome process.

Thank you for your time and assistance,
E. Smith
0 Kudos
Message 1 of 2
(4,431 Views)
Try this:
 
Of course in real life this does not make a lot of sense. Shouldn't each binary be padded with zeroes to a fixed width?

Message Edited by altenbach on 01-24-2006 10:10 AM

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