ConOpSys V2970  P004.07
ANVILEX control operating system
P019_11_KG3_MOD.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file P019_11_KG3_MOD.h
3 //! @brief KG3 modulator board P019.11 MOD V1 T1 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/P019_11_KG3_MOD/P019_11_KG3_MOD.h $
7 //! $Revision: 2877 $
8 //! $Date: 2021-10-18 23:04:26 +0500 (Mo, 18 Okt 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 #include "NTCT_Sensor.h"
60 
61 //------------------------------------------------------------------------------
62 // Include ConOpSys application header files
63 //------------------------------------------------------------------------------
64 
65 //------------------------------------------------------------------------------
66 // Macros
67 //------------------------------------------------------------------------------
68 
69 //------------------------------------------------------------------------------
70 // Class definitions
71 //------------------------------------------------------------------------------
72 
73 //! @brief Extention board driver block P019.11 (KG3 MOD) class definition
75 {
76 
77  //----------------------------------------------------------------------------
78  // Public defines, variables and methods
79  //----------------------------------------------------------------------------
80 
81  public:
82 
83  //! @brief Register structure for I/O access
84  typedef struct
85  {
86 
87  //! @brief 0x00 : Module identification low register
89 
90  //! @brief 0x01 : Module identification high register
92 
93  //! @brief Control and status registars
94  union
95  {
96 
97  //! @brief 0x02 : Modulator status register
99 
100  //! @brief 0x02 : Modulator control register
101  // Bit 0 : Modulator enable
102  // Bit 1 : Modulator PWM T1 output enable
103  // Bit 2 : Modulator PWM T2 output enable
104  // Bit 3 : Modulator PWM T3 output enable
105  // Bit 4 : Modulator PWM T5 output enable
106  // Bit 5 : Modulator driver enable
107  // Bit 15-6 : Not used
109 
110  };
111 
112  //! @brief 0x03 : Reserved
114 
115  //! @brief 0x04 : Modulator "on" time in clock cycles (low register)
117 
118  //! @brief 0x05 : Modulator "on" time in clock cycles (high register)
120 
121  //! @brief 0x06 : Modulator "off" time in clock cycles (low register)
123 
124  //! @brief 0x07 : Modulator "off" time in clock cycles (high register)
126 
127  //! @brief 0x08 : Modulator dead time
129 
130  //! @brief 0x09 : Reserved
132 
133  //! @brief 0x0A : Temperature time register
135 
136  //! @brief 0x0B : Reserved
138 
139  //! @brief 0x0C : Reserved
141 
142  //! @brief 0x0D : Reserved
144 
145  //! @brief 0x0E : Reserved
147 
148  //! @brief 0x0F : Reserved
150 
152 
153  //!-------------------------------------------------------------------------
154  //! @brief Function block class constructor method.
155  //! @note None
156  //! \par Override
157  //! Not allowed
158  //! @attention Don't call this method directly.
159  //--------------------------------------------------------------------------
160 
162 
163  //!-------------------------------------------------------------------------
164  //! @brief Function block class desstructor method.
165  //! @note None
166  //! \par Override
167  //! Not allowed
168  //! @attention Don't call this method directly.
169  //--------------------------------------------------------------------------
170 
171  virtual ~TP019_11_KG3_MOD();
172 
173  //!-------------------------------------------------------------------------
174  //! @brief Hardware mapping method.
175  //! @note None
176  //! @param [in] *struct_Registers_Base_Address - Base adress to register structure mapping
177  //! \par Override
178  //! Not allowed
179  //! @attention none
180  //--------------------------------------------------------------------------
181 
182  VOID Map( TP019_11_KG3_MOD_Registers *struct_Registers_Base_Address );
183 
184  //!-------------------------------------------------------------------------
185  //! @brief Function block initialisation method.
186  //! @note None
187  //! \par Override
188  //! Not allowed
189  //! @attention None
190  //--------------------------------------------------------------------------
191 
192  virtual VOID Init();
193 
194  //!-------------------------------------------------------------------------
195  //! @brief Function block execution method.
196  //! @note None
197  //! \par Override
198  //! Not allowed
199  //! @attention None
200  //--------------------------------------------------------------------------
201 
202  virtual VOID Execute();
203 
204  //!-------------------------------------------------------------------------
205  //! @brief Send information about modulator board driver over communication link protocol
206  //! @note This method sends information about modulator board driver over specified communication link protocol.
207  //! @param [in] *object_Protocol - Pointer to the communication link protocol
208  //! @return None
209  //! \par Override
210  //! Optional
211  //! @attention None
212  //--------------------------------------------------------------------------
213 
214  virtual VOID Send_Information( TProtocol_Base *object_Protocol );
215 
216  //--------------------------------------------------------------------------
217  // Function block parameters
218  //--------------------------------------------------------------------------
219 
220  //--------------------------------------------------------------------------
221  // Function block inputs
222  //--------------------------------------------------------------------------
223 
224  //! @brief Enable modulator
226 
227  //! @brief Modulator dead time
229 
230  //! @brief Frequency setpoint
232 
233  //! @brief Duty setpoint
235 
236  //! @brief Temperature gain calibration
238 
239  //! @brief Temperature offset calibration
241 
244 
245  //--------------------------------------------------------------------------
246  // Function block outputs
247  //--------------------------------------------------------------------------
248 
249  //! @brief Actual modulator temperature as raw data
251 
252  //! @brief Actual modulator temperature in gradus celsius
254 
255  //----------------------------------------------------------------------------
256  // Protected defines, variables and methods
257  //----------------------------------------------------------------------------
258 
259  protected:
260 
261  //----------------------------------------------------------------------------
262  // Private defines, variables and methods
263  //----------------------------------------------------------------------------
264 
265  private:
266 
267  //! @brief NTC sensor object
269 
270  //! @brief Control register structure
271  typedef union
272  {
273 
274  //! @brief Control register raw U16 data
276 
277  //! @brief Control register bit parsing structure
278  struct
279  {
280 
281  //! @brief Bit 0 : Enable modulator ( 0 - Disabled, 1 - Enabled )
283 
284  //! @brief Bit 1 : Enable PWM output T1 ( 0 - Disabled, 1 - Enabled )
286 
287  //! @brief Bit 2 : Enable PWM output T2 ( 0 - Disabled, 1 - Enabled )
289 
290  //! @brief Bit 3 : Enable PWM output T3 ( 0 - Disabled, 1 - Enabled )
292 
293  //! @brief Bit 4 : Enable PWM output T4 ( 0 - Disabled, 1 - Enabled )
295 
296  //! @brief Bit 5 : Enable gate driver ( 0 - Disabled, 1 - Enabled )
298 
299  //! @brief Bits 6..15 : Reserved
301 
302  };
303 
304  } TControl_Register;
305 
306  //! @brief Status register structure
307  typedef struct
308  {
309 
310  //! @brief Temperature data valid ( 0 - Data invalid, 1 - Data valid)
312 
313  //! @brief Bits 1..15 : Reserved
315 
317 
318  //! @brief FPGA mapped registers
320 
321  //! @brief Clock cycle per period as float point number
323 
324  //! @brief Clock cycle per on state as float point number
326 
327  //! @brief Clock cycle per off state as float point number
329 
337 
338  //! @brief Temperature value
340 
341 };
342 
343 //------------------------------------------------------------------------------
344 // End of file
345 //------------------------------------------------------------------------------
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
float F32
IEEE-754 32-Bit single presession floating point numbers datatype defenition.
Definition: Defines.h:324
double F64
IEEE-754 64-Bit double presession floating point numbers datatype defenition.
Definition: Defines.h:327
unsigned short U16
Binary 16-Bit unsigned integer datatype defenition.
Definition: Defines.h:193
Function block base class header file.
NTC termoresistor 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
Negative temperature coefficient thermistor (NTC) class.
Definition: NTCT_Sensor.h:74
Extention board driver block P019.11 (KG3 MOD) class definition.
Definition: P019_11_KG3_MOD.h:75
TP019_11_KG3_MOD()
Function block class constructor method.
Definition: P019_11_KG3_MOD.cpp:68
U16 u16_Off_Cycles_L
Definition: P019_11_KG3_MOD.h:335
U32 u32_On_Cycles
Definition: P019_11_KG3_MOD.h:331
TBlock_Input_Connector object_f32_Temperature_Gain
Temperature gain calibration.
Definition: P019_11_KG3_MOD.h:237
F64 f64_Cycles
Clock cycle per period as float point number.
Definition: P019_11_KG3_MOD.h:322
TBlock_Input_Connector object_f32_Temperature_Offset
Temperature offset calibration.
Definition: P019_11_KG3_MOD.h:240
U16 u16_Off_Cycles_H
Definition: P019_11_KG3_MOD.h:336
TBlock_Input_Connector object_f32_Duty
Duty setpoint.
Definition: P019_11_KG3_MOD.h:234
virtual VOID Init()
Function block initialisation method.
Definition: P019_11_KG3_MOD.cpp:128
TBlock_Input_Connector object_bool_Enable
Enable modulator.
Definition: P019_11_KG3_MOD.h:225
U32 u32_Cycles
Definition: P019_11_KG3_MOD.h:330
F64 f64_On_Cycles
Clock cycle per on state as float point number.
Definition: P019_11_KG3_MOD.h:325
TBlock_Input_Connector object_f32_Negative_Current_Magnitude
Definition: P019_11_KG3_MOD.h:243
TNTC object_NTC
NTC sensor object.
Definition: P019_11_KG3_MOD.h:268
F32 f32_Temperature
Temperature value.
Definition: P019_11_KG3_MOD.h:339
F64 f64_Off_Cycles
Clock cycle per off state as float point number.
Definition: P019_11_KG3_MOD.h:328
TBlock_Output_Connector object_u16_Temperature_Raw_Data
Actual modulator temperature as raw data.
Definition: P019_11_KG3_MOD.h:250
U16 u16_On_Cycles_L
Definition: P019_11_KG3_MOD.h:332
TBlock_Input_Connector object_u16_Dead_Time
Modulator dead time.
Definition: P019_11_KG3_MOD.h:228
virtual VOID Execute()
Function block execution method.
Definition: P019_11_KG3_MOD.cpp:173
U16 u16_On_Cycles_H
Definition: P019_11_KG3_MOD.h:333
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send information about modulator board driver over communication link protocol.
Definition: P019_11_KG3_MOD.cpp:479
TBlock_Output_Connector object_f32_Temperature
Actual modulator temperature in gradus celsius.
Definition: P019_11_KG3_MOD.h:253
virtual ~TP019_11_KG3_MOD()
Function block class desstructor method.
Definition: P019_11_KG3_MOD.cpp:108
volatile TP019_11_KG3_MOD_Registers * struct_Registers
FPGA mapped registers.
Definition: P019_11_KG3_MOD.h:319
TBlock_Input_Connector object_f32_Frequency
Frequency setpoint.
Definition: P019_11_KG3_MOD.h:231
VOID Map(TP019_11_KG3_MOD_Registers *struct_Registers_Base_Address)
Hardware mapping method.
Definition: P019_11_KG3_MOD.cpp:116
U32 u32_Off_Cycles
Definition: P019_11_KG3_MOD.h:334
TBlock_Input_Connector object_f32_Positive_Current_Magnitude
Definition: P019_11_KG3_MOD.h:242
Definition: Protocol_Base.h:57
Register structure for I/O access.
Definition: P019_11_KG3_MOD.h:85
U16 u16_Temperature
0x0A : Temperature time register
Definition: P019_11_KG3_MOD.h:134
U16 u16_Off_Cycles_H
0x07 : Modulator "off" time in clock cycles (high register)
Definition: P019_11_KG3_MOD.h:125
U16 u16_Control_Register
0x02 : Modulator control register
Definition: P019_11_KG3_MOD.h:108
U16 u16_Reserve_15
0x0F : Reserved
Definition: P019_11_KG3_MOD.h:149
U16 u16_Unit_ID_H
0x01 : Module identification high register
Definition: P019_11_KG3_MOD.h:91
U16 u16_Reserve_11
0x0B : Reserved
Definition: P019_11_KG3_MOD.h:137
U16 u16_Reserve_9
0x09 : Reserved
Definition: P019_11_KG3_MOD.h:131
U16 u16_Off_Cycles_L
0x06 : Modulator "off" time in clock cycles (low register)
Definition: P019_11_KG3_MOD.h:122
U16 u16_Unit_ID_L
0x00 : Module identification low register
Definition: P019_11_KG3_MOD.h:88
U16 u16_Status_Register
0x02 : Modulator status register
Definition: P019_11_KG3_MOD.h:98
U16 u16_On_Cycles_H
0x05 : Modulator "on" time in clock cycles (high register)
Definition: P019_11_KG3_MOD.h:119
U16 u16_Dead_Time
0x08 : Modulator dead time
Definition: P019_11_KG3_MOD.h:128
U16 u16_Reserve_3
0x03 : Reserved
Definition: P019_11_KG3_MOD.h:113
U16 u16_On_Cycles_L
0x04 : Modulator "on" time in clock cycles (low register)
Definition: P019_11_KG3_MOD.h:116
U16 u16_Reserve_12
0x0C : Reserved
Definition: P019_11_KG3_MOD.h:140
U16 u16_Reserve_13
0x0D : Reserved
Definition: P019_11_KG3_MOD.h:143
U16 u16_Reserve_14
0x0E : Reserved
Definition: P019_11_KG3_MOD.h:146
Status register structure.
Definition: P019_11_KG3_MOD.h:308
U16 bit15_Reserved_1
Bits 1..15 : Reserved.
Definition: P019_11_KG3_MOD.h:314
U16 bit1_Temperature_Data_Valid
Temperature data valid ( 0 - Data invalid, 1 - Data valid)
Definition: P019_11_KG3_MOD.h:311
U16 bit1_Enable_Output_T4
Bit 4 : Enable PWM output T4 ( 0 - Disabled, 1 - Enabled )
Definition: P019_11_KG3_MOD.h:294
U16 bit1_Enable_Modulator
Bit 0 : Enable modulator ( 0 - Disabled, 1 - Enabled )
Definition: P019_11_KG3_MOD.h:282
U16 u16_Raw_Data
Control register raw U16 data.
Definition: P019_11_KG3_MOD.h:275
U16 bit1_Enable_Output_T1
Bit 1 : Enable PWM output T1 ( 0 - Disabled, 1 - Enabled )
Definition: P019_11_KG3_MOD.h:285
U16 bit10_Reserved
Bits 6..15 : Reserved.
Definition: P019_11_KG3_MOD.h:300
U16 bit1_Enable_Driver
Bit 5 : Enable gate driver ( 0 - Disabled, 1 - Enabled )
Definition: P019_11_KG3_MOD.h:297
U16 bit1_Enable_Output_T3
Bit 3 : Enable PWM output T3 ( 0 - Disabled, 1 - Enabled )
Definition: P019_11_KG3_MOD.h:291
U16 bit1_Enable_Output_T2
Bit 2 : Enable PWM output T2 ( 0 - Disabled, 1 - Enabled )
Definition: P019_11_KG3_MOD.h:288