That will work fine. Here is some code from one of my SNL programs:
...
int mcaROILow[MAX_ROIS];
assign mcaROILow to {"","","","","","","","","","","","","","","","",
...
"","","","","","","","","","","","","","","",""};
monitor mcaROILow; evflag mcaROILowMon; sync mcaROILow mcaROILowMon;
...
state init {
when() {
...
for (i=0; i<nDetectors; i++) {
...
for (j=0; j<MAX_SCAS; j++) {
k = i*MAX_SCAS + j;
sprintf(temp, "%s%s%d.R%iLO", prefix, mca, det, j);
pvAssign(mcaROILow[k], temp);
pvMonitor(mcaROILow[k]);
...
}
}
...
state monitor_changes {
...
when(efTestAndClear(mcaROILowMon) ||
efTestAndClear(mcaROIHighMon)) {
/* Copy ROIs to SCAs */
for (i=0; i<nDetectors; i++) {
for (j=0; j<MAX_SCAS; j++) {
k = i*MAX_SCAS + j;
chan = mcaROILow[k];
if (chan < 0) chan = 0;
dxpSCALow[k] = chan;
pvPut(dxpSCALow[k]);
...
}
}
...
Mark
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Kim, Kukhee
Sent: Tuesday, December 01, 2009 12:17 PM
To: [email protected]
Subject: SNL Question: dynamic assignment and event flag
Dear All;
I have a simple question about the dynamic assignment in SNL.
I have array variables and those variables have been assigned PVs as the
followings.
double pvs[50];
assign pvs to { "pv1", ... , "pv50"};
monitor pvs;
evflag mon_flag;
sync pvs mon_flag;
I need to replace some of PVs during runtime. Thus, I am going to use
dynamic assignment like as the followings.
pvAssign(pvs[i], pv_name_string[i]); pvMonitor(pvs[i]);
My question is the following:
If I replaced some PVs in the array with the dynamic assignment, Is the
sync statement on the event flag still valid?
I am going to put the pvMonitor statement for the replaced things, Is it
enough to make the event flag keep working?
Thank you.
Best regards,
Kukhee
--------------------------------------------
Kukhee Kim
SLAC National Accelerator Laboratory
2575 Sand Hill Rd, MS 50
Menlo Park, CA 94025
Email: [email protected]
Phone: (650)926-4912
- References:
- SNL Question: dynamic assignment and event flag Kim, Kukhee
- Navigate by Date:
- Prev:
SNL Question: dynamic assignment and event flag Kim, Kukhee
- Next:
Support for PI C863 peter.leicester
- 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:
SNL Question: dynamic assignment and event flag Kim, Kukhee
- Next:
Support for PI C863 peter.leicester
- 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
|