INOS
cinosposchannels.h
Go to the documentation of this file.
1 //******************************************************************************
27 //******************************************************************************
28 
29 #ifndef INC_CINOSPOSCHANNELS_H
30 #define INC_CINOSPOSCHANNELS_H
31 
32 //------------------------------------------------------------------------------
33 // defines
34 //------------------------------------------------------------------------------
35 //
36 #define DF_INOS_IMAGE_POSITIONS_NUMBER DF_INOS_PROCESSIMAGE_POSITION_NUMBER // def. number of position chns.
37 #define DF_INOS_IMAGE_POSITIONS_NUMBER_ADD 32 // additional position chns.
38 //
39 // config input
40 #define DF_INOS_IMAGE_POSITIONS_CFG_SYD 0x00010000 // synced
41 #define DF_INOS_IMAGE_POSITIONS_CFG_NUP 0x00020000 // zero impuls
42 #define DF_INOS_IMAGE_POSITIONS_CFG_AED 0x00040000 // axis enabled
43 #define DF_INOS_IMAGE_POSITIONS_CFG_COM 0x00080000 // commutation ok
44 //
45 // config output
46 #define DF_INOS_IMAGE_POSITIONS_CFG_SEN 0x00100000 // sync enable
47 #define DF_INOS_IMAGE_POSITIONS_CFG_AEN 0x00200000 // axis enable
48 #define DF_INOS_IMAGE_POSITIONS_CFG_OU2 0x00400000 // reserved
49 #define DF_INOS_IMAGE_POSITIONS_CFG_OU3 0x00800000 // reserved
50 //
51 #define DF_INOS_IMAGE_POSITIONS_CFG_INV 0x02000000 // invert direction
52 #define DF_INOS_IMAGE_POSITIONS_CFG_CAL 0x01000000 // calibration active
53 //
54 // bit numbers
55 #define DF_INOS_IMAGE_POSITIONS_NBR_IN2 18 //
56 
57 // config names
58 #define DF_INOS_IMAGE_POSITIONS_CFG_SYD_NAME "Synched"
59 #define DF_INOS_IMAGE_POSITIONS_CFG_NUP_NAME "ZeroImpuls"
60 #define DF_INOS_IMAGE_POSITIONS_CFG_AED_NAME "AxisEnabled"
61 #define DF_INOS_IMAGE_POSITIONS_CFG_SEN_NAME "SynchEnable"
62 #define DF_INOS_IMAGE_POSITIONS_CFG_AEN_NAME "AxisEnable"
63 #define DF_INOS_IMAGE_POSITIONS_CFG_INV_NAME "InvertDirection"
64 #define DF_INOS_IMAGE_POSITIONS_CFG_CAL_NAME "CalibEnabled"
65 //
66 //------------------------------------------------------------------------------
67 // includes
68 //------------------------------------------------------------------------------
69 //
70 // system
71 //
72 // C++
73 //
74 // project
75 //
76 //------------------------------------------------------------------------------
77 // class definition
78 //------------------------------------------------------------------------------
79 //
80 class CINOSBusJob;
82 {
83  //--- user interface ---------------------------------------------------
84 
85  // public member functions
86  public :
87  ICACHE virtual void Set(uint16 auNumber, real64 arValue) override;
88  //; set channel 'auNumber' to arValue
89  ICACHE virtual real64 Get(uint16 auNumber) override;
90  //; get value of channel 'auNumber'
91  ICACHE virtual void SetConfig(uint16 auNumber, uint32 auConfig, uint32 auMask,
92  uint32 auOffset=0) override;
93  //; set config of channel 'auNumber' to auConfig (only bits set in
94  //; auMask are affected)
95  ICACHE virtual uint32 GetConfig(uint16 auNumber, uint32 auOffset=0) override;
96  //; get config of channel 'auNumber'
97  virtual void* GetConfigAdr(uint16 auNumber, uint32 auOffset=0) override;
98  //; get config address of channel 'auNumber'
99  virtual void* GetRawBaseAddress()
100  { return m_pRawPos; };
101  //; get base address of raw pos values
102 
103  ICACHE int32 GetPosition(uint16 auNumber);
104  //; return position of channel auNumber
105  #if defined(INOS_PROCESSIMAGE_OVERWRITE)
106  ICACHE void SetPosition(uint16 auNumber, int32 aiValue, bool abOverwrite = true);
107  //; set value of channel auNumber to aiValue
108  //; (abOverwrite=true -> value always set, abOverwrite=false -> value
109  //; set if channel is NOT in overwrite mode)
110  #else
111  ICACHE void SetPosition(uint16 auNumber, int32 aiValue);
112  //; set value of channel auNumber to aiValue
113  #endif
114  ICACHE int32 GetRawOffset(uint16 auNumber);
115  //; return raw position offset
116  ICACHE void SetRawOffset(uint16 auNumber, int32 aiOffset);
117  //; set raw position offset
118  ICACHE int32 GetRawPosition(uint16 auNumber, uint32 auStage=0);
119  //; return raw position of channel auNumber before hook number 'auStage'
120  ICACHE real32 GetControl(uint16 auNumber);
121  //; get control of channel auNumber (100% = 28672, -100% = - 28672)
122  ICACHE void SetControl(uint16 auNumber, real32 arValue);
123  //; set control of channel auNumber to afValue
124  ICACHE real32 GetSerror(uint16 auNumber);
125  //; get Serror of channel auNumber
126  ICACHE void SetSerror(uint16 auNumber, real32 arValue);
127  //; set Serror of channel auNumber to arValue
128  ICACHE void SetValue(uint16 auNumber, real32 arValue);
129  //; set channel control to arValue * 2.8672 -> takes +-10000.0 mV
130  ICACHE bool GetSyncEnable(uint16 auNumber);
131  //; return state of 'sync enable' output
132  ICACHE void SetSyncEnable(uint16 auNumber, bool abValue);
133  //; set 'synch enable' output to abValue
134  ICACHE bool GetAxisEnable(uint16 auNumber);
135  //; return 'axis enable' output
136  ICACHE void SetAxisEnable(uint16 auNumber, bool abValue);
137  //; set 'axis enable' output to abValue
138  ICACHE bool GetSynced(uint16 auNumber);
139  //; return state of 'synced' input
140  ICACHE bool GetZeroImpuls(uint16 auNumber);
141  //; return state of 'zero impuls' input
142  ICACHE bool GetAxisEnabled(uint16 auNumber);
143  //; return state of 'axis enabled' input
144  ICACHE bool GetInverted(uint16 auNumber);
145  //; return state of 'inverted'
146  ICACHE void SetInverted(uint16 auNumber, bool abValue);
147  //; set 'inverted' to abValue
148  ICACHE bool GetCalibEnabled(uint16 auNumber);
149  //; return state of 'calibenabled'
150  ICACHE void SetCalibEnabled(uint16 auNumber, bool abValue);
151  //; set 'calibenabled' to abValue
152 
153  CINOSPosChannel* Find(const char* apName,
154  uint32 auSimulate = DF_INOS_IMAGE_CHN_SIM_DEF);
155  //; return pointer to channel with apName or NULL if not found
156  CINOSPosChannel* Find(uint16 auNumber,
157  uint32 auSimulate = DF_INOS_IMAGE_CHN_SIM_DEF);
158  //; return pointer to channel with auNumber or NULL if not found
159 
160  //--- internals --------------------------------------------------------
161 
162  // constructor / destructor
163  public :
164  CINOSPosChannels (char* apName, uint32 auNumber, void* apImage);
165  //; object constructor
166 
167  // public member functions but just for internal use
168  public:
169  static void Create();
170  //; check if process image already exists, if not create one
171  uint32 GetUniqueNumber();
172  //; return a unique pos channel number
173 
174  // public members but just for internal use
175  public :
176  real32* m_pControl;
177  //; pointer to control data
178  real32* m_pSerror;
179  //; pointer to Serror data
180  int32* m_pRawPos;
181  //; pointer to raw positions
182  int32* m_pRawOffset;
183  //; pointer to raw position offsets
184  uint32 m_uUniqueNumber;
185  //; next free number
186 };
187 
188 //
189 //------------------------------------------------------------------------------
190 // global variables
191 //------------------------------------------------------------------------------
192 //
193 #define g_pPosChannels ((CINOSPosChannels *) g_pImage[DF_PROCESS_IMAGE_POSITIONS])
194 //
195 //------------------------------------------------------------------------------
196 // end of file
197 //------------------------------------------------------------------------------
198 
199 #endif // INC_CINOSPOSCHANNELS_H
CINOSPosChannel
Definition: cinosposchannel.h:58
CINOSPosChannels
Definition: cinosposchannels.h:81
CINOSProcessImageValues
Definition: cinosprocessimagevalues.h:77