Eric,
I understand your idea of using the PACT field.
I almost believed in it... almost!
I tried it. It doesn't work.
The scheme you described generate an infinite loop.
But I found a solution.
1/ Trigger using the CP flag
2/ Save previous values of PVs
-> compare current value to previous one -> if different event was
detected.
Now the trick is that the previous values are actually the VAL field of
the gensub record. (Input and output PVs are the same!)
Note that at initialization, monitor events are sent for all PVs. The
gensub's val fields are also set to 0.
So you detect BOTH events at iocInit.
The gensub function needs to treat this specific case.
Regards,
--
Emmanuel
On Thu, 2008-04-03 at 19:31 -0500, Eric Norum wrote:
> I should probably let a real expert reply, but will the following work
> for you?
>
> FLNK the genSub record from both PV1 and PV2.
> The genSub always updates PV1 and PV2.
>
> Sound like an infinite loop? It's not, and here's why:
> 1) PV1 starts to process
> 2) PV1 sets PACT=1
> 3) PV1 finishes its own processing and invokes its forward link
> 4) The genSub record starts to process
> 5) genSub sets PACT=1
> 6) genSub writes to PV1.
> 7)PV1 does not process because PACT=1.
> 8) The genSub record writes to PV2.
> 9) PV2 processes and FLNKs to the genSub.
> 10) genSub does not process because PACT=1
> 11) genSub sets PACT=0 and returns
> 12) PV1 sets PACT=0 and returns
>
> The genSub INP links from PV1 and PV2 should be NPP.
> The genSub OUT links to PV1 and PV2 should be PP (so the update from
> the genSub causes the record to process)
>
> On Apr 3, 2008, at 6:58 PM, Emmanuel Mayssat wrote:
> > That's not exactly what I want...
> > I want to execute something like that:
> >
> >
> > if PV1 is updated, process gensub and compute new PV2
> > if PV2 is updated, process gensub and compute new PV1
> > PV1 and PV2 and both inputs and outputs of gensub
> > It is the classic loop problem, but with gensub. ;-)
> >
> > The computed new PV are such that there is a equilibrium (and monitor
> > are disabled if new value is same as old one (field(mdel,"1"))).
> >
> > In other words, gensub needs to detect if it is PV1 or PV2 that
> > updated
> > first, then it update the other.
> >
> > --
> > E
> >
> >
> >
> > On Thu, 2008-04-03 at 17:56 -0500, Eric Norum wrote:
> >> You should be able to do this by making the genSub input link a
> >> channel access link (assuming that the genSub SCAN field is Passive):
> >> field(INPA, "foobar.VAL CP")
> >>
> >> On Apr 3, 2008, at 5:31 PM, Emmanuel Mayssat wrote:
> >>> Hello,
> >>>
> >>> Is there a way to detect a monitor event in a genSub routine?
> >>> I believe it is possible in the sequencer with the evflag entries.
> >>> But I am interested in doing that with a genSub record this time.
> >>>
> >>> If gensub cannot do it, is it possible to detect a monitor event
> >>> with
> >>> any other means than through the sequencer ?
> >>> --
> >>> Emmanuel
> >>>
> >>
> >
>
- Replies:
- Re: genSub and capture monitor event Maren Purves
- References:
- genSub and capture monitor event Emmanuel Mayssat
- Re: genSub and capture monitor event Eric Norum
- Re: genSub and capture monitor event Emmanuel Mayssat
- Re: genSub and capture monitor event Eric Norum
- Navigate by Date:
- Prev:
Re: Building motor6-3 record Ron Sluiter
- Next:
Re: genSub and capture monitor event Maren Purves
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
<2008>
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: genSub and capture monitor event Eric Norum
- Next:
Re: genSub and capture monitor event Maren Purves
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
<2008>
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|