LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String to binary conversion / concatenate Enum

Hello
 
I used enum function to input a set of values. I want to concatenate them . Like one set of enum function i used say
slave address, from 0000 till 1111 
bus address,  from 000 -- 111
read/ write bit.  0 -1
 
this would generate a 8 bit patteren as user could select from the enum functions. how could i concatenate them into say single number '0000 100 0' the first four bits being the slave address, the next three being the bus addr. and the last read write bit.
 
Since I could not find the conactenate on enum. i used combo box..i can concatenate the strings but my input needs to be binary and it does not take string. is there any way I can use either the enum with binary or convert the string to binary..
 
Ravi
 
 
0 Kudos
Message 1 of 8
(3,836 Views)
I didn't really understand what you want to do, but if you want to get the text of the enum, you can use Format Into String.

___________________
Try to take over the world!
0 Kudos
Message 2 of 8
(3,830 Views)

sorry if it was confusing...i need to have the data representation of my string to be 16 bit integer  how can i do that..

 

0 Kudos
Message 3 of 8
(3,825 Views)
If you are wanting a 16 bit number, why are you using enums?  Why not use integers for all selections?  You can display them in binary format.  You can use the shift function and add function to combine them into one number.  If you insist on using enums, you would have to convert the enums into strings (Format into strings), concatenate the strings, remove any white spaces, then convert into a number using the string to number conversion functions.  It is better to use numbers instead of enums in your case.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 8
(3,818 Views)
thanks tbob for that..i did the both ways as u said..got the desired result..thanks again..
0 Kudos
Message 5 of 8
(3,814 Views)

Here is a little vi I just wrote.  Yours should be almost the same:

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 8
(3,811 Views)
Hey, I wrote one too. 🙂
 
Mine uses rings and generates 8 bits. You only have 8 bits total, so why do you need U16?
0 Kudos
Message 7 of 8
(3,801 Views)
ya typo..i was using u 16 for my previous example then changed it to 8 bits....thanks for that prompt help..
0 Kudos
Message 8 of 8
(3,795 Views)