It sounds like you should create a global variable or a LV2-style global (I
have recently rediscovered LV2-style globals and now prefer them to global
variables).

You could have regular controls for Stop and EmStop on your front panels. In
your parallel loop, write the state of EmStop to a global called
"GlobalStop" (or whatever you choose to call it)... Reading the state of
(Stop OR GlobalStop) in the other loop should do the trick (you may need to
make small modifications to the structure of the main loop). One advantage
of this is you can read the status of GlobalStop from parallel loops and
subVI's, so your EmStop will really be 'global'. And you won't run into that
'latching' error.   

I still find it hard sometimes to think my way through the logic of parallel
loops, so I often create a stripped-down-and-very-minimalist prototype of
the VI I need so that I can study the behaviour of the globals and loop(s)
under controlled conditions. Once you learn to think "in-parallel" you will
find you can design some very powerful software...

A cautionary note - if your E-stop really is an Emergency Stop in the sense
that there is safety concern if the SW is not stopped you should really look
into having a hardware interlock (such as a big red fist-sized pushbutton
switch) which will de-energize any dangerous machinery no matter what the
software is doing. If you have a DAQ card or fieldpoint modules you can
usually wire up the switch in such a way that a digital transition is
initiated when the switch is pressed/released. You can then monitor that
digital channel in your software (writing the status to GlobalStop) so that
the software can shut itself down in a clean manner if Emergency Stop
(hardware or software) is pressed. Never trust a software routine to take
100% care of a safety concern. :)

Regards,

Johann Junginger

Research Scientist
Xerox Research Centre of Canada
[EMAIL PROTECTED]
Ph: (905) 823-7091 x306
Fax: (905) 822-7022



  

-----Original Message-----
From: Subramanian, Shankar, K
[mailto:[EMAIL PROTECTED]
Sent: Friday, January 23, 2004 11:09
To: [EMAIL PROTECTED]
Subject: Second Post for Stop


Hi, 

I posted this once but the message did not appear. So, just posting the same
message again. 

I have a subVI that needs an emergency stop. Once this stop is pressed, the
VI should stop running. The subVI has several loops running sequentially. I
want this " EmStop" button to take effect no matter at which execution point
the VI is. I tried putting an altogether separate loop that runs parallel
with the program and checks for the "EmStop" periodically. The condition of
this loop being "EmStop not pressed - continue". 

Considering an experiment where "EmStop" is not pressed and the subVI is
executed till the end of the program which has a normal stop button which
returns it to the main VI. In such a situation the control does not transfer
between subVI to main VI since the EmStop loop is still running waiting for
EmStop to be depressed. 

Instead I wired the state of normal "Stop" along with "EmStop" using OR gate
to remove this problem. In such a case, if I press on "EmStop" it does not
acknowledge because the loop waits for the value of the "Stop" button to
evaluate the OR function. But the value of the "Stop" button does not come
till the very end as it runs in a sequence. 

The Stop buttons are Latch when released buttons and I guess setting up a
local variable does not work. 

Could you let me know as to how I could do it?

Thanks
Shankar


Reply via email to