LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

unwanted delay on toggle switches

i have 15 toggle switched, and each time one is pushed, labview must trigger a corresponding valve to open for 1 sec. the problem occurs when two or more buttons are pushed within one second of each other. i cannot get second, trird, etc. valve to open until the first one has closed. currently i am using while loops for each input, but clearly this is wrong. Does anyone have any suggestions for me? thanks
0 Kudos
Message 1 of 5
(2,884 Views)
I would have used event structures (make sure the "lock front panel..."
selector
is not selected) inside the while loops. However, there is no reason why
while loops alone won't work if you have each toggle switch in its own
independent while loop. Give a little more detail how you are doing this
(what is the mechanical action of your toggle switch? Do you put a delay in
the loops?).

TJ
"thoj" wrote in message
news:506500000008000000DCEF0000-1079395200000@exchange.ni.com...
>i have 15 toggle switched, and each time one is pushed, labview must
> trigger a corresponding valve to open for 1 sec. the problem occurs
> when two or more buttons are pushed within one second of each other.
> i cannot get second, trird, etc. valve to open until the firs
t one has
> closed. currently i am using while loops for each input, but clearly
> this is wrong. Does anyone have any suggestions for me? thanks
0 Kudos
Message 2 of 5
(2,884 Views)
in detail, my problem is this: i have 15 toggle switches, each one acting as a switch until released pushbutton. Whenever one of the buttons is pushed, it is supposed to trigger one of 15 corresponding valves to open for at least 1 second. if the switch is depressed for less than 1 sec. then the valve will open for exactly 1 sec. if the switch is depressed for 1-2 secs, then the valve will remain open for 2 secs, etc. Now, what i need to be able to do is have precision timing control over each switch button. For example, if i momentarily push switch 1 at t=0 secs and then at t=.3 secs push switch 2 and keep it depressed for 1.3 secs (until t=1.6 secs) and finally at t=1.4 secs depress switch 3 for .5 secs (until t=1.9 secs), here is what i need to happen. Switch
1 opens from t=0 to t=1 sec, valve 2 opens from t=.3 secs to t=2.3 secs and valve 3 opens from t=1.4 secs to t=2.4 secs.
Here is my problem. in my program i have tried to use while loops for each switch with a 1 sec. wait inside of each loop. The problem is that labview runs serially, so when switch one is depressed, the program enters loop 1 and will not recognize any more of my pushbutton commands until t=1 sec when the program exits loop 1. essnentially, i am currently forced to have all valves open only at one sec. intervals, and this doesn't work for me.
So, if anyone has any more suggestions, i would love to try them out. in the first reply, Tom suggested trying event structures, but unfortunately i have not figured out how to put 15 separate switches into one event structure, if this was what he was suggesting.
Thanks again for any help.
JOe
0 Kudos
Message 3 of 5
(2,884 Views)
Labview is a multithread environment so you should not have to wait on the
rest of the program. I threw together a program. It does
what I think you want and there is no delay even if I make several
duplicates of
the outside while loop. I'll send you a gif of the block diagram. Again, I
think an
even better solution is using 15 event structures, each inside its own while
loop
so that False switches don't consume as much time.

Tom


"thoj" wrote in message
news:5065000000050000007DC00100-1079395200000@exchange.ni.com...
> in detail, my problem is this: i have 15 toggle switches, each one
> acting as a switch until released pushbutton. Whenever one of the
> buttons is pushed, it is supposed to trigger one of 15 corresponding
> valves to open for at least 1 second. if the switch is depressed for
> less than 1 sec. then the valve will open for exactly 1 sec. if the
> switch is depressed for 1-2 secs, then the valve will remain open for
> 2 secs, etc. Now, what i need to be able to do is have precision
> timing control over each switch button. For example, if i momentarily
> push switch 1 at t=0 secs and then at t=.3 secs push switch 2 and keep
> it depressed for 1.3 secs (until t=1.6 secs) and finally at t=1.4 secs
> depress switch 3 for .5 secs (until t=1.9 secs), here is what i need
> to happen. Switch 1 opens from t=0 to t=1 sec, valve 2 opens from
> t=.3 secs to t=2.3 secs and valve 3 opens from t=1.4 secs to t=2.4
> secs.
> Here is my problem. in my program i have tried to use while loops for
> each switch with a 1 sec. wait inside of each loop. The problem is
> that labview runs serially, so when switch one is depressed, the
> program enters loop 1 and will not recognize any more of my pushbutton
> commands until t=1 sec when the program exits loop 1. essnentially, i
> am currently forced to have all valves open only at one sec.
> intervals, and this doesn't work for me.
> So, if anyone has any more suggestions, i would love to try them out.
> in the first reply, Tom suggested trying event structures, but
> unfortunately i have not figured out how to put 15 separate switches
> into one event structure, if this was what he was suggesting.
> Thanks again for any help.
> JOe
0 Kudos
Message 4 of 5
(2,884 Views)
OK. Your email address is invalid. So let me describe the vi.
Start with a while loop.
Inside that, wire your boolean control switch (the mechanical action of
the switch must be "Switch until Released") to a true/false case structure.
In the true case, put another while loop.
Inside this interior while loop, put a sequence structure.
In sequence 0, OR the output of a local variable of the boolean control
switch with the output of a "= to zero" comparison of the interior while
loop counter, and wire the output of the OR to your valve.
In sequence 1, put your 1 sec delay.
In sequence 2, wire another local variable of the boolean control switch
through the border of the sequence structure to the loop control (Continue
if True) for the interior while loop. Take this same wire outside the
interior while loop to a local variable of the valve control.
Copy the entire structure for each valve.

You should be able to replace the true/false case structure with an event
structure and save cpu time.

Tom


"thoj" wrote in message
news:5065000000050000007DC00100-1079395200000@exchange.ni.com...
> in detail, my problem is this: i have 15 toggle switches, each one
> acting as a switch until released pushbutton. Whenever one of the
> buttons is pushed, it is supposed to trigger one of 15 corresponding
> valves to open for at least 1 second. if the switch is depressed for
> less than 1 sec. then the valve will open for exactly 1 sec. if the
> switch is depressed for 1-2 secs, then the valve will remain open for
> 2 secs, etc. Now, what i need to be able to do is have precision
> timing control over each switch button. For example, if i momentarily
> push switch 1 at t=0 secs and then at t=.3 secs push switch 2 and keep
> it depressed for 1.3 secs (until t=1.6 secs) and finally at t=1.4 secs
> depress switch 3 for .5 secs (until t=1.9 secs), here is what i need
> to happen. Switch 1 opens from t=0 to t=1 sec, valve 2 opens from
> t=.3 secs to t=2.3 secs and valve 3 opens from t=1.4 secs to t=2.4
> secs.
> Here is my problem. in my program i have tried to use while loops for
> each switch with a 1 sec. wait inside of each loop. The problem is
> that labview runs serially, so when switch one is depressed, the
> program enters loop 1 and will not recognize any more of my pushbutton
> commands until t=1 sec when the program exits loop 1. essnentially, i
> am currently forced to have all valves open only at one sec.
> intervals, and this doesn't work for me.
> So, if anyone has any more suggestions, i would love to try them out.
> in the first reply, Tom suggested trying event structures, but
> unfortunately i have not figured out how to put 15 separate switches
> into one event structure, if this was what he was suggesting.
> Thanks again for any help.
> JOe
0 Kudos
Message 5 of 5
(2,884 Views)