Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending button configurations to a serial port

Hey there.

I am totally new into labview, therefore this might be an easy question for you guys.

I have four on/off buttons, which I'll use to send bytes through a port. Each button is supposed to send a byte that will, later, turn an equipment on/off. 

My program is supposed to be always running, but it'll only send a byte when a button is pressed. 

I'm willing to send a 3-byte package. The last one is a constant stop-byte, but the first ones are supposed to be sent by each button, being the first an identification byte and the second a command byte. 

Example: First button on will send 0xC4 and 0x16, and off will send 0xC4 and 0x15, plus the stop-byte.

Example: Second button on sends 0xC6 and 0x16, and off sends 0xC6 and 0x15, plus the stop-byte.

I am using a case structure for each button, with the identification byte out of it and the on/off byte inside of it, being concatenated. This result string then concatenates with my stop-byte, and goes to my visa write. All this inside a while loop.

My problems are:

- I don't know how to make this program send the byte-package only when a button is pressed;

- I don't know how to make my final concatenation be dependent of the button i have pressed.

I'm sending a base-image for you guys to understand what I mean. 

If I'm going completely the wrong way, please tell me how this kind of stuff is done!

Thanks.

 

example.png

 

0 Kudos
Message 1 of 2
(4,151 Views)
You should be using an event structure.
0 Kudos
Message 2 of 2
(4,139 Views)