ConOpSys V2970  P004.07
ANVILEX control operating system
P017_52_KG3_CI.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file P017_52_KG3_CI.h
3 //! @brief KG3 current input board P017.52 hardware driver header file.
4 //! @attention No special attention requered.
5 //! @copyright (C) 2015-2020 ANVILEX LLC
6 //! $HeadURL: https://192.168.3.4:8443/svn/P004_07/ConOpSys/Hardware/P017_52_KG3_CI/P017_52_KG3_CI.h $
7 //! $Revision: 2457 $
8 //! $Date: 2021-03-11 11:54:01 +0500 (Do, 11 Mrz 2021) $
9 //! $Author: minch $
10 //------------------------------------------------------------------------------
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are met:
14 //
15 // 1. Redistributions of source code must retain the above copyright notice,
16 // this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright notice,
19 // this list of conditions and the following disclaimer in the documentation
20 // and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of ANVILEX nor the names of its contributors may be
23 // used to endorse or promote products derived from this software without
24 // specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 // POSSIBILITY OF SUCH DAMAGE.
37 //
38 //------------------------------------------------------------------------------
39 
40 //------------------------------------------------------------------------------
41 // Protecting header files from mutual, recursive inclusion.
42 //------------------------------------------------------------------------------
43 
44 #pragma once
45 
46 //------------------------------------------------------------------------------
47 // Include standard libraries header files
48 //------------------------------------------------------------------------------
49 
50 //------------------------------------------------------------------------------
51 // Include thrid party header files
52 //------------------------------------------------------------------------------
53 
54 //------------------------------------------------------------------------------
55 // Include ConOpSys header files
56 //------------------------------------------------------------------------------
57 
58 #include "Function_Block_Base.h"
59 
60 //------------------------------------------------------------------------------
61 // Include ConOpSys application header files
62 //------------------------------------------------------------------------------
63 
64 //------------------------------------------------------------------------------
65 // Macros
66 //------------------------------------------------------------------------------
67 
68 //! @brief Analog current input KG3 CI T1 (P017.52) board class
70 {
71 
72  //----------------------------------------------------------------------------
73  // Public defines, methods and variables
74  //----------------------------------------------------------------------------
75 
76  public:
77 
78  //! @brief Register structure for generic access
79  typedef struct
80  {
81 
82  //------------------------------------------------------------------------
83  // Unit identification registers
84  //------------------------------------------------------------------------
85 
86  //! @brief 0x00 : Module identification register, low word
88 
89  //! @brief 0x01 : Module identification register, high word
91 
92  //------------------------------------------------------------------------
93  // Control and status registers
94  //------------------------------------------------------------------------
95 
96  //! @brief control and status register
97  union
98  {
99 
100  //! @brief 0x02 : Status register
102 
103  //! @brief 0x02 : Control register
105 
106  };
107 
108  //------------------------------------------------------------------------
109  // Analog value registers
110  //------------------------------------------------------------------------
111 
112  //! @brief 0x03 : Analog input channel 1 data register as U16 value
114 
115  //! @brief 0x04 : Analog input channel 2 data register as U16 value
117 
118  //! @brief 0x05 : Analog input channel 3 data register as U16 value
120 
121  //! @brief 0x06 : Analog input channel 4 data register as U16 value
123 
124  //! @brief 0x07 : Analog input channel 1 filtered data register as U16 value
126 
127  //! @brief 0x08 : Analog input channel 2 filtered data register as U16 value
129 
130  //! @brief 0x09 : Analog input channel 3 filtered data register as U16 value
132 
133  //! @brief 0x0A : Analog input channel 4 filtered data register as U16 value
135 
137 
138  //--------------------------------------------------------------------------
139  // Public methods
140  //--------------------------------------------------------------------------
141 
142  //!-------------------------------------------------------------------------
143  //! @brief Class constructor method.
144  //! @note None
145  //! \par Override
146  //! Not allowed
147  //! @attention Don't call this method directly.
148  //--------------------------------------------------------------------------
149 
151 
152  //!-------------------------------------------------------------------------
153  //! @brief Class destructor method.
154  //! @note None
155  //! \par Override
156  //! Not allowed
157  //! @attention Don't call this method directly.
158  //--------------------------------------------------------------------------
159 
160  virtual ~TP017_52_KG3_CI_T1();
161 
162  //!-------------------------------------------------------------------------
163  //! @brief Map function block to the hardware.
164  //! @note None.
165  //! @param [in] *struct_Registers_Base_Address - Pointer to the hardware allocated memory
166  //! @return None
167  //! \par Override
168  //! Not allowed
169  //! @attention None
170  //--------------------------------------------------------------------------
171 
172  VOID Map( TP017_52_KG3_CI_Registers *struct_Registers_Base_Address );
173 
174  //!-------------------------------------------------------------------------
175  //! @brief Block initialisation method.
176  //! @note None
177  //! @return None
178  //! \par Override
179  //! Not allowed
180  //! @attention None
181  //--------------------------------------------------------------------------
182 
183  virtual VOID Init(); //!< Block initialisation method
184 
185  //!-------------------------------------------------------------------------
186  //! @brief Block execution method.
187  //! @note None
188  //! @return None
189  //! \par Override
190  //! Not allowed
191  //! @attention None
192  //--------------------------------------------------------------------------
193 
194  virtual VOID Execute();
195 
196  //!-------------------------------------------------------------------------
197  //! @brief Send information about function block over communication link protocol.
198  //! @note This method sends information about function block over specified communication link protocol.
199  //! @param [in] *object_Protocol - Pointer to the communication link protocol
200  //! @return None
201  //! \par Override
202  //! Not allowed
203  //! @attention None
204  //--------------------------------------------------------------------------
205 
206  virtual VOID Send_Information( TProtocol_Base *object_Protocol ); //!< Send information method
207 
208  //--------------------------------------------------------------------------
209  // Functional block parameters
210  //--------------------------------------------------------------------------
211 
212  //! @brief Analog input channel 1 fill scale value. Also used for channel total gain adjustment.
214 
215  //! @brief Analog input channel 2 fill scale value. Also used for channel total gain adjustment.
217 
218  //! @brief Analog input channel 3 fill scale value. Also used for channel total gain adjustment.
220 
221  //! @brief Analog input channel 4 fill scale value. Also used for channel total gain adjustment.
223 
224  //! @brief Analog input channel 1 offset input connector
226 
227  //! @brief Analog input channel 2 offset input connector
229 
230  //! @brief Analog input channel 3 offset input connector
232 
233  //! @brief Analog input channel 4 offset input connector
235 
236  //! @brief Analog input channel 1 gain input connector
238 
239  //! @brief Analog input channel 2 gain input connector
241 
242  //! @brief Analog input channel 3 gain input connector
244 
245  //! @brief Analog input channel 4 gain input connector
247 
248  //! @brief Negate input data input connector
250 
251  //--------------------------------------------------------------------------
252  // Functional block inputs
253  //--------------------------------------------------------------------------
254 
255 // TBlock_Input_Connector object_f32_Software_Overcurrent_Level; //! @brief Software defined overcurrent level
256 
257  //--------------------------------------------------------------------------
258  // Functional block outputs
259  //--------------------------------------------------------------------------
260 
261  //! @brief Analog input status output connector
263 
264  //! @brief Analog input channel 1 block output as U16
266 
267  //! @brief Analog input channel 2 block output as U16
269 
270  //! @brief Analog input channel 3 block output as U16
272 
273  //! @brief Analog input channel 4 block output as U16
275 
276  //! @brief Analog input channel 1 block output connecor
278 
279  //! @brief Analog input channel 2 block output connector
281 
282  //! @brief Analog input channel 3 block output connecor
284 
285  //! @brief Analog input channel 4 block output connector
287 
288  //! @brief Critical hardware error flag connecto
290 
291  //----------------------------------------------------------------------------
292  // Protected defines, methods and variables
293  //----------------------------------------------------------------------------
294 
295  protected:
296 
297  //----------------------------------------------------------------------------
298  // Private defines, methods and variables
299  //----------------------------------------------------------------------------
300 
301  private:
302 
303  //! @brief Status register structure
304  typedef union
305  {
306 
307  // Status register U16 based representartion
309 
310  //! @brief Status register bits based representation
311  struct
312  {
313 
314  //! @brief Bit 0 : Hardware fault of ADC channel 1
316 
317  //! @brief Bit 2 : Hardware fault of ADC channel 2
319 
320  //! @brief Bit 2 : Hardware fault of ADC channel 3
322 
323  //! @brief Bit 3 : Hardware fault of ADC channel 4
325 
326  //! @brief Bit 4 : Not used
327  U16 :1;
328 
329  //! @brief Bit 5 : Not used
330  U16 :1;
331 
332  //! @brief Bit 6 : Not used
333  U16 :1;
334 
335  //! @brief Bit 7 : Not used
336  U16 :1;
337 
338  //! @brief Bit 8 : Not used
339  U16 :1;
340 
341  //! @brief Bit 9 : Not used
342  U16 :1;
343 
344  //! @brief Bit 10 : Not used
345  U16 :1;
346 
347  //! @brief Bit 11 : Not used
348  U16 :1;
349 
350  //! @brief Bit 12 : Not used
351  U16 :1;
352 
353  //! @brief Bit 13 : Not used
354  U16 :1;
355 
356  //! @brief Bit 14 : Not used
357  U16 :1;
358 
359  //! @brief Bit 15 : Not used
360  U16 :1;
361 
362  };
363 
364  } TStatus;
365 
366  //! @brief Hardware mapped registers
368 
369  //! @brief Effective gain of the channel 1
371 
372  //! @brief Effective gain of the channel 2
374 
375  //! @brief Effective gain of the channel 3
377 
378  //! @brief Effective gain of the channel 4
380 
381  //! @brief Effective offset of the channel 1
383 
384  //! @brief Effective offset of the channel 2
386 
387  //! @brief Effective offset of the channel 3
389 
390  //! @brief Effective offset of the channel 4
392 
393 };
394 
395 //------------------------------------------------------------------------------
396 // End Of File
397 //------------------------------------------------------------------------------
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
float F32
IEEE-754 32-Bit single presession floating point numbers datatype defenition.
Definition: Defines.h:324
unsigned short U16
Binary 16-Bit unsigned integer datatype defenition.
Definition: Defines.h:193
Function block base class header file.
Function block input connector class.
Definition: Block_Input_Connector.h:83
Function block output connector class.
Definition: Block_Output_Connector.h:59
Function block base class for device.
Definition: Function_Block_Base.h:96
Analog current input KG3 CI T1 (P017.52) board class.
Definition: P017_52_KG3_CI.h:70
TBlock_Input_Connector object_f32_Analog_Input_Gain_3
Analog input channel 3 gain input connector.
Definition: P017_52_KG3_CI.h:243
TBlock_Output_Connector object_u16_Analog_Input_Raw_Data_1
Analog input channel 1 block output as U16.
Definition: P017_52_KG3_CI.h:265
F32 f32_Gain_2
Effective gain of the channel 2.
Definition: P017_52_KG3_CI.h:373
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send information about function block over communication link protocol.
Definition: P017_52_KG3_CI.cpp:211
F32 f32_Gain_3
Effective gain of the channel 3.
Definition: P017_52_KG3_CI.h:376
TBlock_Input_Connector object_f32_Analog_Input_Gain_1
Analog input channel 1 gain input connector.
Definition: P017_52_KG3_CI.h:237
TBlock_Output_Connector object_f32_Analog_Input_Data_4
Analog input channel 4 block output connector.
Definition: P017_52_KG3_CI.h:286
TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_1
Analog input channel 1 fill scale value. Also used for channel total gain adjustment.
Definition: P017_52_KG3_CI.h:213
TBlock_Output_Connector object_f32_Analog_Input_Data_3
Analog input channel 3 block output connecor.
Definition: P017_52_KG3_CI.h:283
F32 f32_Gain_4
Effective gain of the channel 4.
Definition: P017_52_KG3_CI.h:379
F32 f32_Offset_1
Effective offset of the channel 1.
Definition: P017_52_KG3_CI.h:382
TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_3
Analog input channel 3 fill scale value. Also used for channel total gain adjustment.
Definition: P017_52_KG3_CI.h:219
TBlock_Input_Connector object_bool_Negate
Negate input data input connector.
Definition: P017_52_KG3_CI.h:249
virtual VOID Execute()
Block execution method.
Definition: P017_52_KG3_CI.cpp:174
TBlock_Input_Connector object_f32_Analog_Input_Offset_3
Analog input channel 3 offset input connector.
Definition: P017_52_KG3_CI.h:231
TP017_52_KG3_CI_T1()
Class constructor method.
Definition: P017_52_KG3_CI.cpp:68
F32 f32_Gain_1
Effective gain of the channel 1.
Definition: P017_52_KG3_CI.h:370
TBlock_Input_Connector object_f32_Analog_Input_Gain_4
Analog input channel 4 gain input connector.
Definition: P017_52_KG3_CI.h:246
TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_2
Analog input channel 2 fill scale value. Also used for channel total gain adjustment.
Definition: P017_52_KG3_CI.h:216
TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_4
Analog input channel 4 fill scale value. Also used for channel total gain adjustment.
Definition: P017_52_KG3_CI.h:222
TBlock_Output_Connector object_u16_Analog_Input_Raw_Data_3
Analog input channel 3 block output as U16.
Definition: P017_52_KG3_CI.h:271
TBlock_Input_Connector object_f32_Analog_Input_Offset_2
Analog input channel 2 offset input connector.
Definition: P017_52_KG3_CI.h:228
TBlock_Output_Connector object_f32_Analog_Input_Data_1
Analog input channel 1 block output connecor.
Definition: P017_52_KG3_CI.h:277
virtual VOID Init()
Block initialisation method.
Definition: P017_52_KG3_CI.cpp:150
TBlock_Input_Connector object_f32_Analog_Input_Offset_4
Analog input channel 4 offset input connector.
Definition: P017_52_KG3_CI.h:234
TBlock_Output_Connector object_u16_Analog_Input_Raw_Data_4
Analog input channel 4 block output as U16.
Definition: P017_52_KG3_CI.h:274
TBlock_Output_Connector object_bool_Hardware_Error
Critical hardware error flag connecto.
Definition: P017_52_KG3_CI.h:289
F32 f32_Offset_3
Effective offset of the channel 3.
Definition: P017_52_KG3_CI.h:388
volatile TP017_52_KG3_CI_Registers * struct_Registers
Hardware mapped registers.
Definition: P017_52_KG3_CI.h:367
TBlock_Output_Connector object_u16_Analog_Input_Status
Analog input status output connector.
Definition: P017_52_KG3_CI.h:262
F32 f32_Offset_2
Effective offset of the channel 2.
Definition: P017_52_KG3_CI.h:385
VOID Map(TP017_52_KG3_CI_Registers *struct_Registers_Base_Address)
Map function block to the hardware.
Definition: P017_52_KG3_CI.cpp:136
F32 f32_Offset_4
Effective offset of the channel 4.
Definition: P017_52_KG3_CI.h:391
TBlock_Input_Connector object_f32_Analog_Input_Offset_1
Analog input channel 1 offset input connector.
Definition: P017_52_KG3_CI.h:225
virtual ~TP017_52_KG3_CI_T1()
Class destructor method.
Definition: P017_52_KG3_CI.cpp:128
TBlock_Output_Connector object_u16_Analog_Input_Raw_Data_2
Analog input channel 2 block output as U16.
Definition: P017_52_KG3_CI.h:268
TBlock_Output_Connector object_f32_Analog_Input_Data_2
Analog input channel 2 block output connector.
Definition: P017_52_KG3_CI.h:280
TBlock_Input_Connector object_f32_Analog_Input_Gain_2
Analog input channel 2 gain input connector.
Definition: P017_52_KG3_CI.h:240
Definition: Protocol_Base.h:57
Register structure for generic access.
Definition: P017_52_KG3_CI.h:80
U16 u16_Analog_Input_Filtered_Data_2
0x08 : Analog input channel 2 filtered data register as U16 value
Definition: P017_52_KG3_CI.h:128
U16 u16_Analog_Input_Data_3
0x05 : Analog input channel 3 data register as U16 value
Definition: P017_52_KG3_CI.h:119
U16 u16_Analog_Input_Filtered_Data_4
0x0A : Analog input channel 4 filtered data register as U16 value
Definition: P017_52_KG3_CI.h:134
U16 u16_Analog_Input_Status
0x02 : Status register
Definition: P017_52_KG3_CI.h:101
U16 u16_Analog_Input_Data_4
0x06 : Analog input channel 4 data register as U16 value
Definition: P017_52_KG3_CI.h:122
U16 u16_Analog_Input_Filtered_Data_1
0x07 : Analog input channel 1 filtered data register as U16 value
Definition: P017_52_KG3_CI.h:125
U16 u16_Analog_Input_Filtered_Data_3
0x09 : Analog input channel 3 filtered data register as U16 value
Definition: P017_52_KG3_CI.h:131
U16 u16_Analog_Input_Data_1
0x03 : Analog input channel 1 data register as U16 value
Definition: P017_52_KG3_CI.h:113
U16 u16_Unit_ID_L
0x00 : Module identification register, low word
Definition: P017_52_KG3_CI.h:87
U16 u16_Analog_Input_Control
0x02 : Control register
Definition: P017_52_KG3_CI.h:104
U16 u16_Analog_Input_Data_2
0x04 : Analog input channel 2 data register as U16 value
Definition: P017_52_KG3_CI.h:116
U16 u16_Unit_ID_H
0x01 : Module identification register, high word
Definition: P017_52_KG3_CI.h:90
U16 u16_ADC_Hardware_Fault_4
Bit 3 : Hardware fault of ADC channel 4.
Definition: P017_52_KG3_CI.h:324
U16 u16_ADC_Hardware_Fault_1
Bit 0 : Hardware fault of ADC channel 1.
Definition: P017_52_KG3_CI.h:315
U16 u16_ADC_Hardware_Fault_3
Bit 2 : Hardware fault of ADC channel 3.
Definition: P017_52_KG3_CI.h:321
U16 u16_ADC_Hardware_Fault_2
Bit 2 : Hardware fault of ADC channel 2.
Definition: P017_52_KG3_CI.h:318
U16 u16_Status
Definition: P017_52_KG3_CI.h:308