Hio Patrick,
Here are some code snippets from one of my SNL programs. It has a variable nelements assigned to a PV, and a monitor on that PV. It has an event flag, nelementsMon that is synced to nelements. Whenever nelements changes the event flag will be set. In the init state I clear the event flag, just to be sure it is clear when the SNL code starts running (after all PVs connect). I then use efTestAndClear in a when statement to take actions when that event flag is set, and to clear it. This works fine for me.
int nelements; assign nelements to "{P}{R}Nelements.VAL";
monitor nelements;
evflag nelementsMon; sync nelements nelementsMon;
/* Initialize things when first starting */
state init {
when() {
/* Clear all event flags */
...
efClear(nelementsMon);
} state monitor_inputs
}
...
state monitor_inputs {
...
when(efTestAndClear(nelementsMon) && (nelements>=1)) {
/* If nelements changes, then change endPulses to this value,
* since this is what the user normally wants. endPulses can be
* changed again after changing nelements if this is desired. */
if (moveMode == MOVE_MODE_RELATIVE)
endPulses = nelements;
else
endPulses = nelements-1;
pvPut(endPulses);
} state monitor_inputs
}
Mark
________________________________
From: [email protected] on behalf of Patrick Thomas
Sent: Wed 9/30/2009 10:35 PM
To: [email protected]
Subject: state notation code flags
Hi,
I was wondering if there is a way to track at what point in the state
notation code evflags are getting set and cleared, or if someone could
clarify under what conditions they get set. I'm having trouble with them
getting set somewhere and not being cleared, but I'm not sure where.
Thank you,
Patrick