LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using footswitch to control while loop

Hi!

I would like to use a footswitch to control my while loops. How can I do this?

The footswitch outputs 5V DC when pressed.

There are multiple while loops, each of which has to be controlled by this foot switch. Some whie loops are nested.

I am using PCI-6034 (with CB-68LP), LV-PDS 6.1, NI-DAQ 6.2

Thanks in anticipation,

Gurdas
Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 1 of 4
(2,863 Views)
Greetings!

There are a couple of ways to do this. One is with an event structure. Your triggering event can be a VALUE CHANGE paramater, where you look for a change on one input from your DAQ card. Or you can use a comparison function, where if the voltage is above a certain threshold, say 3 volts, you get a TRUE, which you can wire to the stop button of the While loop.

Eric
Eric P. Nichols
P.O. Box 56235
North Pole, AK 99705
0 Kudos
Message 2 of 4
(2,863 Views)
Eric,

Greetings from India and Thanks! for your help

I have further questions:

1) The user would press the foot switch for a very small time window (say 0.5 sec). What if the program does not read the relevant DAQ channel during this time? Thus, by the time the program completes the current task and reads the channel, it would find a voltage of 0-1VDC inspite of the user having pressed the switch. In the unpressed state, the switch will output 0-1VDC.

2) Should I connect it to DI or AI of my PCI-6034 (along with CB-68LP)?

I have done a lot of AI before but never used an external signal to control program flow.

Best,
Gurdas
Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 3 of 4
(2,863 Views)
Gurdas wrote in news:50650000000500000052270100-
1042324653000@exchange.ni.com:

> Eric,
>
> Greetings from India and Thanks! for your help
>
> I have further questions:
>
> 1) The user would press the foot switch for a very small time window
> (say 0.5 sec). What if the program does not read the relevant DAQ
> channel during this time? Thus, by the time the program completes the
> current task and reads the channel, it would find a voltage of 0-1VDC
> inspite of the user having pressed the switch. In the unpressed state,
> the switch will output 0-1VDC.
>
You might be able to put the foot switch read in a high priority thread,
and run it fast.

Another way would be to not use a momentary foot switch, and use one that
toggle
s instead.

A better way would be to use your foot switch to drive a one-shot circuit
with a pulse width that is sufficiently long. This requires a minimum of
hardware design.

> 2) Should I connect it to DI or AI of my PCI-6034 (along with
> CB-68LP)?
>

Either, but I would use a digital line in.


> I have done a lot of AI before but never used an external signal to
> control program flow.
>
> Best,
> Gurdas
0 Kudos
Message 4 of 4
(2,863 Views)