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  2012  <20132014  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  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: how to trigger on positive edge only with snl
From: Benjamin Franksen <[email protected]>
To: <[email protected]>
Date: Fri, 22 Mar 2013 01:00:12 +0100
Am Donnerstag, 21. März 2013, 21:46:31 schrieb Eric Norum:
> Now I read the original article more closely.
> Tim's suggestion is a lot better…..

Your (Eric) solution should work reliably, too, if you are using a recent
release of version 2.1 of the sequencer and enable the safe mode (+s) option.
Safe mode guarantees that the value of 'bin' does not change asynchronously
after evaluation of the when-conditions has been triggered, until the state-
change action block finishes. If we get another event that resets the value to
bin=0, the state set does not see this new value until the next time when-
conditions are evaluated.

Indeed, this is one of the problems that safe mode was designed to solve.

BTW, it is possible to increase the pulse length of a transient signal in the
database using a seq+bo record. The following database demonstrates the
technique:

record(calcout,"timebase") {
    field(INPA,"timebase")
    field(CALC,"!A")
    field(SCAN,"2 second")
    field(OUT,"transientPulse PP")
}
record(bo,"transientPulse") {
    field(HIGH,"0.1")
}
record(seq,"triggerPulse") {
    field(DOL1,"transientPulse CPP")
    field(LNK1,"oneSecondPulse PP")
    field(DLY2,"1.0")
    field(DOL2,"0")
    field(LNK2,"oneSecondPulse PP")
}
record(bo,"oneSecondPulse") {
}

Cheers
Ben

> On Mar 21, 2013, at 1:43 PM, Eric Norum <[email protected]> wrote:
> > How about the following?
> >
> > int bin;   assign bin to "abc:bin";     monitor bin;
> > ss ttt {
> >
> >    state isZero {
> >
> >        when(bin == 1) {
> >
> >            printf("Received a trigger!!\n");
> >
> >        } state isOne
> >
> >    }
> >    state isOne {
> >
> >        when(bin == 0) { } state isZero
> >
> >    }
> >
> > }
> >
> > On Mar 21, 2013, at 10:04 AM, Tim Mooney <[email protected]> wrote:
> >> Hi Song,
> >>
> >> I have not done this myself in SNL, but if I needed to do it, I'd start
> >> by looking into the "syncq" and "pvGetQ" commands in the SNL Reference
> >> Manual:
> >>
> >> http://www-csr.bessy.de/control/SoftDist/sequencer/Reference.html
> >>
> >>
> >> Tim
> >>
> >> ----- Original Message -----
> >>
> >>> From: "Song Hu" <[email protected]>
> >>> To: [email protected]
> >>> Sent: Thursday, March 21, 2013 10:58:28 AM
> >>> Subject: how to trigger on positive edge only  with snl
> >>>
> >>> Hi,
> >>>
> >>> I would like to trigger some actions when a binary PV changes from 0
> >>> to 1. No action should be taken when it changes from 1 to 0. I made
> >>> some code like:
> >>>
> >>> int bin;                  assign bin to "abc:bin";
> >>>
> >>>                                  monitor bin;
> >>>
> >>>                               evflag  binFlag;
> >>>
> >>>
sync
> >>>
> >>>                                bin   binFlag;
> >>>
> >>> ss ttt
> >>> {
> >>> state testState
> >>> {
> >>>
> >>>    when(efTestAndClear(binFlag)&&(bin == 1))
> >>>    {
> >>>
> >>>          printf("Received a trigger!!\n");
> >>>
> >>>    }state testState
> >>>
> >>> }
> >>> }
> >>>
> >>> When abc:bin changes from 0 to 1 and then quickly go back to 0, it is
> >>> not working every time.
> >>>
> >>> What is the appropriate way to implement such positive edge only
> >>> trigger?
> >>>
> >>> Thanks in advance for your help.

________________________________

Helmholtz-Zentrum Berlin für Materialien und Energie GmbH

Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.

Aufsichtsrat: Vorsitzender Prof. Dr. Dr. h.c. mult. Joachim Treusch, stv. Vorsitzende Dr. Beatrix Vierkorn-Rudolph
Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking

Sitz Berlin, AG Charlottenburg, 89 HRB 5583

Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin

http://www.helmholtz-berlin.de


References:
Re: how to trigger on positive edge only with snl Tim Mooney
Re: how to trigger on positive edge only with snl Eric Norum
Re: how to trigger on positive edge only with snl Eric Norum

Navigate by Date:
Prev: Re: how to trigger on positive edge only with snl Eric Norum
Next: eclipse --launcher.openFile problem on multi-user Linux Michael Davidsaver
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: how to trigger on positive edge only with snl Eric Norum
Next: RE: how to trigger on positive edge only with snl Allison, Stephanie
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·