g+ Communities
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  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015 
<== Date ==> <== Thread ==>

Subject: RE: header files in snc code
From: Mark Rivers <rivers@cars.uchicago.edu>
To: "'Tim Mooney'" <mooney@aps.anl.gov>, Pierrick Hanlet <hanlet@fnal.gov>
Cc: Tech Talk <tech-talk@aps.anl.gov>
Date: Fri, 8 Feb 2013 20:20:38 +0000

Here’s an example of one:


corvette:motor/motorApp/NewportSrc>more trajectoryScan.h

/* trajectoryScan.h


 * This file is included in MM4005_trajectoryScan.st and XPS_trajectoryScan.st to

* ensure consistency and minimize duplication of code.




/* State codes for Build, Read and Execute. Careful, these must match the

* corresponding MBBI records, but there is no way to check this */

#define BUILD_STATE_DONE            0

#define BUILD_STATE_BUSY            1

#define READ_STATE_DONE             0

#define READ_STATE_BUSY             1

#define EXECUTE_STATE_DONE          0





/* Status codes for Build, Execute and Read */


#define STATUS_SUCCESS   1

#define STATUS_FAILURE   2

#define STATUS_ABORT     3

#define STATUS_TIMEOUT   4


/* Time modes */

#define TIME_MODE_TOTAL         0



/* Move modes */



#define MOVE_MODE_HYBRID     2


/* The maximum number of axes per controller.  If this is changed from 8

* then many assign statements in this file must be changed */

#define MAX_AXES 8


/* Define PVs */

int     debugLevel;  assign debugLevel   to "{P}{R}DebugLevel.VAL";

monitor debugLevel;

int     numAxes;     assign numAxes      to "{P}{R}NumAxes.VAL";

monitor numAxes;

int     nelements;   assign nelements    to "{P}{R}Nelements.VAL";

monitor nelements;

int     npulses;     assign npulses      to "{P}{R}Npulses.VAL";

monitor npulses;

int     startPulses; assign startPulses  to "{P}{R}StartPulses.VAL";

monitor startPulses;

int     endPulses;   assign endPulses    to "{P}{R}EndPulses.VAL";

monitor endPulses;

int     nactual;     assign nactual      to "{P}{R}Nactual.VAL";

int     moveMode;    assign moveMode     to "{P}{R}MoveMode.VAL";   

monitor moveMode;

double  time;        assign time         to "{P}{R}Time.VAL";     

monitor time;

double  timeScale;   assign timeScale    to "{P}{R}TimeScale.VAL";

monitor timeScale;

int     timeMode;    assign timeMode     to "{P}{R}TimeMode.VAL";   

monitor timeMode;

double  accel;       assign accel        to "{P}{R}Accel.VAL";    

monitor accel;

int     build;       assign build        to "{P}{R}Build.VAL";    

monitor build;

int     buildState;  assign buildState   to "{P}{R}BuildState.VAL";

int     buildStatus; assign buildStatus  to "{P}{R}BuildStatus.VAL";

string  buildMessage;assign buildMessage to "{P}{R}BuildMessage.VAL";

int     simMode;     assign simMode      to "{P}{R}SimMode.VAL";  

monitor simMode;

int     execute;     assign execute      to "{P}{R}Execute.VAL";  

monitor execute;

int     execState;   assign execState    to "{P}{R}ExecState.VAL"; 

monitor execState;

int     execStatus;  assign execStatus   to "{P}{R}ExecStatus.VAL";  

string  execMessage; assign execMessage  to "{P}{R}ExecMessage.VAL";

int     abort;       assign abort        to "{P}{R}Abort.VAL";  

monitor abort;

int     readback;    assign readback     to "{P}{R}Readback.VAL";  

monitor readback;

int     readState;   assign readState    to "{P}{R}ReadState.VAL";  

int     readStatus;  assign readStatus   to "{P}{R}ReadStatus.VAL";  

string  readMessage; assign readMessage  to "{P}{R}ReadMessage.VAL";

double  timeTrajectory[MAX_ELEMENTS];

assign  timeTrajectory to  "{P}{R}TimeTraj.VAL";

monitor timeTrajectory;

string  trajectoryFile; assign trajectoryFile to "{P}{R}TrajectoryFile.VAL";

monitor trajectoryFile;


int     moveAxis[MAX_AXES];

assign  moveAxis     to









monitor moveAxis;


double  motorTrajectory[MAX_AXES][MAX_ELEMENTS];

assign  motorTrajectory to









monitor motorTrajectory;


double  motorReadbacks[MAX_AXES][MAX_PULSES];

assign  motorReadbacks to










double  motorError[MAX_AXES][MAX_PULSES];

assign  motorError  to










double  motorCurrent[MAX_AXES];

assign  motorCurrent to










double  motorMDVS[MAX_AXES];

assign  motorMDVS   to









monitor motorMDVS;


double  motorMDVA[MAX_AXES];

assign  motorMDVA   to










int     motorMDVE[MAX_AXES];

assign  motorMDVE   to










double  motorMVA[MAX_AXES];

assign  motorMVA    to










int     motorMVE[MAX_AXES];

assign  motorMVE    to










double  motorMAA[MAX_AXES];

assign  motorMAA    to










int     motorMAE[MAX_AXES];

assign  motorMAE    to










/* We don't assign the EPICS motors here because there may be fewer than

 * MAX_AXES actually in use. */

double  epicsMotorPos[MAX_AXES];

assign  epicsMotorPos to {"","","","","","","",""};

monitor epicsMotorPos;


double  epicsMotorDir[MAX_AXES];

assign  epicsMotorDir to {"","","","","","","",""};

monitor epicsMotorDir;


double  epicsMotorOff[MAX_AXES];

assign  epicsMotorOff to {"","","","","","","",""};

monitor epicsMotorOff;


double  epicsMotorDone[MAX_AXES];

assign  epicsMotorDone to {"","","","","","","",""};

monitor epicsMotorDone;



evflag buildMon;        sync build      buildMon;

evflag executeMon;      sync execute    executeMon;

evflag execStateMon;    sync execState  execStateMon;

evflag abortMon;        sync abort      abortMon;

evflag readbackMon;     sync readback   readbackMon;

evflag nelementsMon;    sync nelements  nelementsMon;

evflag motorMDVSMon;    sync motorMDVS  motorMDVSMon;





From: tech-talk-bounces@aps.anl.gov [mailto:tech-talk-bounces@aps.anl.gov] On Behalf Of Tim Mooney
Sent: Friday, February 08, 2013 12:51 PM
To: Pierrick Hanlet
Cc: Tech Talk
Subject: Re: header files in snc code


Hi Pierrick,


Yes, you can do this.  Don't escape the '#include "filename.h"' with "%%", because in this case you /do/ want the state-notation-language compiler to see the header file.



From: "Pierrick Hanlet" <hanlet@fnal.gov>
To: "Tech Talk" <tech-talk@aps.anl.gov>
Sent: Friday, February 8, 2013 12:04:27 PM
Subject: header files in snc code

I'm building a state machine in which I will have ~100 variables which I will monitor
and to which I will write.  I would like to make my source code more clear by putting
this list in a header file.  I could not find anything in the documentation other than
including a c-style header file with the appropriate "%%".  Can I add a header file
in which I make all of the assignments and monitors?
Thank you,

"Whether you think you can or think you can't, either way, you are correct" -- Henry Ford
Pierrick Hanlet
+1-630-840-5555 (FNAL)
+1-312-567-5745 (IIT)
+1-630-697-8758/+44-79-48-860-197 (US/UK mobile)


header files in snc code Pierrick Hanlet
Re: header files in snc code Tim Mooney

Navigate by Date:
Prev: Re: header files in snc code Tim Mooney
Next: RE: Problem with mca R7.2 and Rontec XFlash Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015 
Navigate by Thread:
Prev: Re: header files in snc code Tim Mooney
Next: How to set property 'items' of ComboBox from a javascript in CSS BOY Xinyu.Wu
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICSv4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·