EPICS Controls 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  2021  2022  2023  2024  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  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: sequencer & button click
From: Benjamin Franksen <[email protected]>
To: <[email protected]>
Date: Fri, 20 Jul 2012 16:03:43 +0200
On Friday, July 20, 2012, 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?

One possibility is to use an mbbo record, where the mbbo choices correspond 
to the states in the SNL program.

The code would be something like 

#define STATE_X 0
#define STATE_Y 1

int state_change;
assign state_change to ...;
monitor state_change;

ss ... {
	...
	state X {
		when (state_change == STATE_Y) {} state Y
	}
	state Y {
		when (state_change == STATE_X) {} state X
	}
}

However, what I usually do is to use bo records for all user commands. The 
button sets the command record to 1, the state machine if in state idle) 
changes state, performs the command, then resets the command record to zero, 
indicating completion, then finally returns to the idle state. You can use 
an mbboDirect and/or a calc record to gather all the command records into a 
single value, for instance to determine whether any command is currently 
being performed (so the state machine is busy) or check against a mask or 
whatever.

> 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...

This is not correct, strictly speaking: it depends on the record type and 
the record's configuration. The ai/ao/[mb]bi/[mb]bo records send monitors on 
each process (even if the value does not change) if you set MDEL to -1. 
Stringin/out always send monitors.

Cheers
Ben

Attachment: signature.asc
Description: This is a digitally signed message part.


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

Navigate by Date:
Prev: sequencer & button click Martin Konrad
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  2021  2022  2023  2024 
Navigate by Thread:
Prev: sequencer & button click Martin Konrad
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  2021  2022  2023  2024 
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 ·