Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

button value

Dear,

We got a instrument with touch buttons but the display is broken, we cant replace it because its old,

but there is a serial connetor on the machine, i made a connection and i can read the display now in labview,

i can send a command:

on teh machine ther are buttons like calibrate (codeC43) measure (M4D) ... now what i wanna do is make these buttons in labview

and if i touch the button then the command will be send to the instrument,

im very new to labview how can i make suchbuttons with a value assigned to it and when is pushed send it to the

machine?

0 Kudos
Message 1 of 9
(3,471 Views)

The simplest solution would be a while loop in which you have sections with the code from the manual to program the operations via the serial port with serial reads and simply have a true/false case structure around each with the corresponding Boolean value button wired to the true/false terminal on the case structure and have the button's "mechanical action" (in the right click menu of it, but the control on the wire diagram will have to be used instead of a local variable or something like that) set to "latch when released" or of course "latch when pressed" if you prefer and the false case for each being basically empty.  Then the program will essentially wait until a button is pressed, then process your serial port read/write commands and the button state will then be changed back so it doesn't repeat indefinitely.  For functions you want to repeat you just leave the action as "switch when released" or "switch when pressed".  You could create a separate button to terminate the while loop or just hit the stop button for the vi.

 

Considering the age of the instrument, I would add a fair amount of wait time between any read/write commands for the unit (use sequences or spaces and add a number wired to a ms wait timer between then with the ms wait anywhere from probably no less than 100ms, but probably not more than 500ms) and be careful of the end of command "termination" characters the device requires and the command structure.  I hope the manual is pretty good for that part.

 

There are fancier ways of course, but things like "events" are a lot trickier to use if you aren't familiar with LabVIEW.

 

-Leif

0 Kudos
Message 2 of 9
(3,469 Views)

Thx very much

 

is it possible to give an example for one button?

so i can see ?

 

0 Kudos
Message 3 of 9
(3,462 Views)

Start with the LabVIEW tutorial. Then go to Help>Find Examples. I think the Event structure is by far the best way to go. There are several examples of this.

0 Kudos
Message 4 of 9
(3,456 Views)

ok thx ill check it.

0 Kudos
Message 5 of 9
(3,453 Views)

i tried this for 1 button it works to get send the code, but if i use 2 buttons and 2 select case and put the wire also it gives

this wire connects to an undirected tunnel

sorry im very ne to it can someone help me ?

 

0 Kudos
Message 6 of 9
(3,436 Views)

don't send pictures, send vi's

greetings from the Netherlands
0 Kudos
Message 7 of 9
(3,432 Views)
0 Kudos
Message 8 of 9
(3,423 Views)

Hello Drek,

 

Have you tried wiring an empty string constant to the tunnels in the false cases?

 

 

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 9 of 9
(3,397 Views)