Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure/Foot Switch

Solved!
Go to solution

The VISA Open is in fact, optional.

 

Are you able to read the foot switch with your VI? Once it is detected, what do you want to do?

0 Kudos
Message 11 of 19
(1,653 Views)

Dennis - yes I am able to read the value when the foot switch is pressed in the MagnaMike.vi. What I'd like to do is detect when the foot switch is pressed and place the value in Excel. What I don't know how to do is to detect that the foot switch has been pressed in my Event Structure (MagnaMikeMain.vi).

0 Kudos
Message 12 of 19
(1,647 Views)
Read the switch again and again in a separate while loop. Compare each reading with the previous reading and if achange is detected signal it to a control ( write the new value in the control by a signal value write) This control then is in one of the eventcases detected for a value change. You eventually can read the new value an act accordingly on a low or high. So next toyour mainloop you have that footswitch reading loop.
greetings from the Netherlands
0 Kudos
Message 13 of 19
(1,645 Views)

Like this?

 

 

Test.png

0 Kudos
Message 14 of 19
(1,643 Views)

No, no, no.

 

Why are you even playing around with an event structure? Why don't you simply do the write to file in the loop where you are monitoring the serial port? It only makes sense to have an event structure if you want to have a front panel control do a file write. Then the Value(Signaling) would go into the while loop with the serial read - not the event you are trying to fire.

0 Kudos
Message 15 of 19
(1,639 Views)

OK, I got it. Now, how do I make my sub VI stop when the front panel stop button is pressed?

 

Image1.gif

0 Kudos
Message 16 of 19
(1,618 Views)

put the elements from your subvi in your main program.

The init before the loop after opening excel

the read inside the while

the cloase after the while.

 

good luck

greetings from the Netherlands
0 Kudos
Message 17 of 19
(1,616 Views)

Dennis & Albert, thanks for your solutions. I now have a working program but one thing eludes me. I have placed my "Quit" text button inside the While Loop but it does not quit my program. The VISA Read is waiting for a response from the Magna Mike. I have to terminate the program by using the abort button. How do I get around this? The VI is attached.

0 Kudos
Message 18 of 19
(1,609 Views)

remove the while from your subvi.

Just let it run once and handle the error or timeout in the higher level program.

Very good that you don't want to push the abort button.

greetings from the Netherlands
0 Kudos
Message 19 of 19
(1,595 Views)