Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020 
<== Date ==> <== Thread ==>

Subject: Re: sequencer & button click
From: Andrew Johnson <anj@aps.anl.gov>
To: tech-talk@aps.anl.gov
Date: Fri, 20 Jul 2012 10:06:39 -0500
Hi Martin,

On 2012-07-20 Martin Konrad wrote:
> what's the recommended way to switch from one sequencer state to another
> if a button is clicked on the OPI? What type of record do you use for
> this? What does the "when" statement look like?

> P.S.: When coupling a button with some piece of hardware I usually use
> some sort of record that is scanned if the button is clicked. This
> results in a message to my device. This obviously does not work with the
> sequencer because the value of the record does not change and thus a
> monitor would not fire...

That's where you want to use an event flag that is synchronized to the monitor 
updates.  As Ben mentioned you may need to set MDEL to -1 on some record types 
to cause monitors to always be generated.  Your SNL code then looks something 
like the following (not tested):

double myVar;
assign myVar to "me:myVar";
monitor myVar;
evflag myFlag;
sync myVar myFlag;

...

    when(efTestAndClear(myFlag)) {
        /* actions ... */
    } next_state;

I have some vague recollection that there may have been a problem with the 
efTestAndClear() function in some recent sequencer versions (Ben can 
confirm/deny this), so you might need this code instead:

    when(efTest(myFlag)) {
        efClear(myFlag);
        /* actions ... */
    } next_state;

You should probably read the documentation about the syncQ statement as well, 
although I don't think it is actually needed in this case.

HTH,

- Andrew

PS: Ben — the stringin and stringout records now have MPST and APST fields 
which allow the user to control whether they always post monitors or only on 
value change.
-- 
Never interrupt your enemy when he is making a mistake.
-- Napoleon Bonaparte


Replies:
Re: sequencer & button click Benjamin Franksen
References:
sequencer & button click Martin Konrad

Navigate by Date:
Prev: Re: sequencer & button click Benjamin Franksen
Next: Re: sequencer & button click Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020 
Navigate by Thread:
Prev: Re: sequencer & button click Benjamin Franksen
Next: Re: sequencer & button click Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·