LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help with VI

Hi LabVIEW Specialists!

I made a simple VI which should be a gate controller. Ther is on On/Off
Switch on for opening snd one for closing. Two Leds display the
direction the gate moves. The gate hase to open until the ensposition
has reached and then switch to closing until the other endposition has
reched, and so on. It is allready working pricipally but but if the
On/Off Button changed to high value it should always open the gate at
first and thats my Problem.
Now I'm using a single while loop with two RS flipflops but i don't know
if this is the best solution. Maybe ist better to use a statemaschine
or something else. Please take a look at my VI and maybe you can give me
some hints.

Link to my VI:
http://www.8ung.at/mmax/Schubstange.vi

Thank for y
our help.
Max
0 Kudos
Message 1 of 2
(2,523 Views)
You could use an Event Structure and two shift registers to handle opening and closing the gate.
To make it clearer to me, I renamed the controls to Open and Close, and the indicators to Opened and Closed.
I interpreted your function as follows.
If On/Off is Off, ignore other switches and retain previous state.
If On/Off goes from Off to On, open the gate.
If On/Off is On and Open goes from Off to On, open the gate.
If On/Off is On and Close goes from Off to On, close the gate.
For any other cases, maintain the previous state.
I also added a Stop button.
Here's another suggestion: whenever you have a loop waiting for operator input, adding some pause (like 200 ms using the Wait (ms) function from the Time & Dialog function palette) allows the PC to spend
more time doing other stuff while it's waiting for the user to operate a control. When you use an Event structure, wiring a value to the timeout terminal does pretty much the same thing.
See the attached modified LabView 7 VI. I noticed that you included a link to your VI instead of attaching it. You can post and see attachments if you get to this forum through www.ni.com and goto the Discussion Forums under Developer Exchange.
0 Kudos
Message 2 of 2
(2,524 Views)