LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change boolean array to ascii or send as bits

Hi everyone,

 

I am using a RS232 to connect to a microcontroller.  I am using VISA to send the data.  Sorry if I'm not clear enough as I explain this but I have multiple boolean arrays set as controls and I'm having trouble sending the data to the microcontroller the way that I want to.  I'm pretending I have a grid on my front panel in which a chip will be placed on.   So I am only paying attention to the corner boolean buttons.  So if the setup was

 

101

000

001

 

 then I would want the output to be "1101" reading from left to right and top to bottom.  Now if I send the data as "1101" to the microcontroller, it is sending it as 32 bits as opposed to 4.  So, I was wondering if there was a way to send the 4 bits as 4 bits, or if there was a way to convert those bits into ASCII before sending it into VISA write seeing that I don't want the micrcontroller to look at 32 bits.

Thanks very much and I'll clear it up if I'm being confusing.

0 Kudos
Message 1 of 2
(3,800 Views)

The smallest amount of bits you can send is eight, i.e. one byte.

 

You could send one byte and define that you want the four low-order bits, ignoring the other four. For this you would first make a boolean array with four elements, then use "boolean array to number", covert to U8 (or set the output configuration to U8), followed by typecasting to a string.

0 Kudos
Message 2 of 2
(3,786 Views)