ConOpSys V2970  P004.07
ANVILEX control operating system
P018_34_KG3_BLCP.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file P018_34_KG3_BLCP.h
3 //! @brief KG3 control board P013.34 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/P018_34_KG3_BLCP/P018_34_KG3_BLCP.h $
7 //! $Revision: 2328 $
8 //! $Date: 2020-12-29 09:26:49 +0500 (Di, 29 Dez 2020) $
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 //! @brief Control panel board P018.34 class
66 {
67 
68  //----------------------------------------------------------------------------
69  // Public defines, methods and variables
70  //----------------------------------------------------------------------------
71 
72  public:
73 
74  //! @brief Encoder status register structure
75  typedef union
76  {
77 
78  //! @brief Encoder status word
80 
81  //! @brief Encoder status bits
82  struct
83  {
84 
85  //! @brief Bit 0 :
87 
88  //! @brief Bit 1 :
90 
91  //! @brief Bit 2 : reserved
92  U16 :1;
93 
94  //! @brief Bit 3 :
96 
97  //! @brief Bit 4 :
99 
100  //! @brief Bit 5 : Reserved
101  U16 :1;
102 
103  //! @brief Bits 6..7 : Rotation direction
105 
106  //! @brief Bit 8 : Button status
108 
109  //! @brief Bit 9 : Button filtered status
111 
112  //! @brief Bits 10..15 : Reserved
113  U16 :6;
114 
115  }; // u16_Status_Bits;
116 
117  } TEncoder_Status;
118 
119  //! @brief Register structure of the board for generic access
120  typedef struct
121  {
122 
123  // Unit identification registers
124  U16 u16_Unit_ID_L; //!< 0x00 : Module identification register
125  U16 u16_Unit_ID_H; //!< 0x01 : Module identification register
126 
127  U16 u16_Unused_0x02; //!< 0x02 : Reserved register
128  U16 u16_Unused_0x03; //!< 0x03 : Reserved register
129  U16 u16_Unused_0x04; //!< 0x04 : Reserved register
130  U16 u16_Unused_0x05; //!< 0x05 : Reserved register
131  U16 u16_Unused_0x06; //!< 0x06 : Reserved register
132  U16 u16_Unused_0x07; //!< 0x07 : Reserved register
133 
134  U16 u16_Encoder_Status; //!< 0x08 : Encoder status register
135  U16 u16_Encoder_Counter; //!< 0x09 : Encoder counter register
136  U16 u16_Encoder_Counter_Latch; //!< 0x0A : Encoder counter latch register
137  U16 u16_Encoder_Counter_Delta_Latch; //!< 0x0B : Encoder counter latch register
138 
139 // U16 u16_Unused_0x0B; //!< 0x0B : Reserved register
140  U16 u16_Unused_0x0C; //!< 0x0C : Reserved register
141  U16 u16_Unused_0x0D; //!< 0x0D : Reserved register
142  U16 u16_Unused_0x0E; //!< 0x0E : Reserved register
143  U16 u16_Unused_0x0F; //!< 0x0F : Reserved register
144 
145  U16 u16_Display_D2_P1_A; //!< 0x10 : Display 2, segnant A dara register
153 
162 
171 
180 
189 
198 
200 
201  //--------------------------------------------------------------------------
202  // Public methods
203  //--------------------------------------------------------------------------
204 
205  //!-------------------------------------------------------------------------
206  //! @brief Class constructor method.
207  //! @note None
208  //! \par Override
209  //! Not allowed
210  //! @attention Don't call this method directly.
211  //--------------------------------------------------------------------------
212 
214 
215  //!-------------------------------------------------------------------------
216  //! @brief Class destructor method.
217  //! @note None
218  //! \par Override
219  //! Not allowed
220  //! @attention Don't call this method directly.
221  //--------------------------------------------------------------------------
222 
223  virtual ~TP018_34_KG3_BLCP_T1();
224 
225  VOID Map( TP018_34_KG3_BLCP_Registers *struct_Registers_Base_Address );
226  virtual VOID Init(); //!< Initialisation method
227  virtual VOID Execute(); //!< Execute method
228  virtual VOID Send_Information( TProtocol_Base *object_Protocol ); //!< Send information about functional block
229 
230  //--------------------------------------------------------------------------
231  // Function block parameters
232  //--------------------------------------------------------------------------
233 
234  //! @brief Function block sample timr in seconds
236 
237 // TBlock_Input_Connector object_u32_Pulse; //!< [-] Encoder pulse per revolution
238 
239  //! @brief Encoder counter clock frequency in herz
241 
242  //--------------------------------------------------------------------------
243  // Function block inputs
244  //--------------------------------------------------------------------------
245 
246  //! @brief Display 1, position 1 symbol data
248 
249  //! @brief Display 1, position 2 symbol data
251 
252  //! @brief Display 1, position 3 symbol data
254 
255  //! @brief Display 1 symbol color data
257 
258  //! @brief Display 2, position 1 symbol data
260 
261  //! @brief Display 2, position 2 symbol data
263 
264  //! @brief Display 2, position 3 symbol data
266 
267  //! @brief Display 2 symbol color data
269 
270  //--------------------------------------------------------------------------
271  // Function block outputs
272  //--------------------------------------------------------------------------
273 
274  //! @brief Encoder counter
276 
277  //! @brief Encoder counter delta
279 
280  //! @brief Encoder button status
282 
283  //! @brief Error flag
285 
286  //----------------------------------------------------------------------------
287  // Protected defines, methods and variables
288  //----------------------------------------------------------------------------
289 
290  protected:
291 
292  //----------------------------------------------------------------------------
293  // Private defines, methods and variables
294  //----------------------------------------------------------------------------
295 
296  private:
297 
298  //! @brief Hardware mapped registers
300 
301  //! @brief Error counter
303 
304  //! @brief Display update timr
306 
307  //! @brief Display update counter
309 
310 // F32 f32_Theta_Gain; //!< Internal variable
311 // F32 f32_Omega_Gain; //!< Internal variable
312 // F32 f32_Omega_Magnitude_Storage; //!< Omega magnitude storage
313 // F32 f32_Max_Omega_Change_Rate; //!< Maximal omega change rate
314 
315  //! @brief First iteration flag
317 
319 
320 };
321 
322 //------------------------------------------------------------------------------
323 // End of file
324 //------------------------------------------------------------------------------
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
short I16
2s Compliment 16-Bit signed integer datatype defenition
Definition: Defines.h:196
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
Control panel board P018.34 class.
Definition: P018_34_KG3_BLCP.h:66
virtual VOID Execute()
Execute method.
Definition: P018_34_KG3_BLCP.cpp:177
TBlock_Input_Connector object_u8_Display_1_Position_2
Display 1, position 2 symbol data.
Definition: P018_34_KG3_BLCP.h:250
I16 i16_Debug
Definition: P018_34_KG3_BLCP.h:318
TBlock_Output_Connector object_f32_Counter
Encoder counter.
Definition: P018_34_KG3_BLCP.h:275
TBlock_Input_Connector object_u16_Display_2_Color_Data
Display 2 symbol color data.
Definition: P018_34_KG3_BLCP.h:268
volatile TP018_34_KG3_BLCP_Registers * struct_Registers
Hardware mapped registers.
Definition: P018_34_KG3_BLCP.h:299
TBlock_Input_Connector object_u8_Display_2_Position_1
Display 2, position 1 symbol data.
Definition: P018_34_KG3_BLCP.h:259
TBlock_Input_Connector object_f32_Counter_Clock_Frequency
Encoder counter clock frequency in herz.
Definition: P018_34_KG3_BLCP.h:240
TBlock_Output_Connector object_bool_Button
Encoder button status.
Definition: P018_34_KG3_BLCP.h:281
TBlock_Output_Connector object_bool_Error
Error flag.
Definition: P018_34_KG3_BLCP.h:284
VOID Map(TP018_34_KG3_BLCP_Registers *struct_Registers_Base_Address)
Definition: P018_34_KG3_BLCP.cpp:152
TP018_34_KG3_BLCP_T1()
Class constructor method.
Definition: P018_34_KG3_BLCP.cpp:71
TBlock_Input_Connector object_f32_Sample_Time
Function block sample timr in seconds.
Definition: P018_34_KG3_BLCP.h:235
U32 u32_Error_Counter
Error counter.
Definition: P018_34_KG3_BLCP.h:302
virtual VOID Init()
Initialisation method.
Definition: P018_34_KG3_BLCP.cpp:164
TBlock_Output_Connector object_f32_Delta
Encoder counter delta.
Definition: P018_34_KG3_BLCP.h:278
virtual ~TP018_34_KG3_BLCP_T1()
Class destructor method.
Definition: P018_34_KG3_BLCP.cpp:144
BOOL bool_First_Iteration
First iteration flag.
Definition: P018_34_KG3_BLCP.h:316
TBlock_Input_Connector object_u8_Display_1_Position_1
Display 1, position 1 symbol data.
Definition: P018_34_KG3_BLCP.h:247
TBlock_Input_Connector object_u8_Display_2_Position_2
Display 2, position 2 symbol data.
Definition: P018_34_KG3_BLCP.h:262
U32 u32_Display_Update_Counter
Display update counter.
Definition: P018_34_KG3_BLCP.h:308
TBlock_Input_Connector object_u16_Display_1_Color_Data
Display 1 symbol color data.
Definition: P018_34_KG3_BLCP.h:256
TBlock_Input_Connector object_u8_Display_2_Position_3
Display 2, position 3 symbol data.
Definition: P018_34_KG3_BLCP.h:265
TBlock_Input_Connector object_u8_Display_1_Position_3
Display 1, position 3 symbol data.
Definition: P018_34_KG3_BLCP.h:253
U32 u32_Display_Update_Time
Display update timr.
Definition: P018_34_KG3_BLCP.h:305
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send information about functional block.
Definition: P018_34_KG3_BLCP.cpp:390
Definition: Protocol_Base.h:57
Register structure of the board for generic access.
Definition: P018_34_KG3_BLCP.h:121
U16 u16_Display_D1_P2_B
0x31 :
Definition: P018_34_KG3_BLCP.h:182
U16 u16_Display_D1_P2_C
0x32 :
Definition: P018_34_KG3_BLCP.h:183
U16 u16_Display_D1_P1_D
0x2B :
Definition: P018_34_KG3_BLCP.h:175
U16 u16_Display_D1_P3_E
0x3C :
Definition: P018_34_KG3_BLCP.h:194
U16 u16_Display_D1_P1_B
0x29 :
Definition: P018_34_KG3_BLCP.h:173
U16 u16_Display_D1_P1_F
0x2D :
Definition: P018_34_KG3_BLCP.h:177
U16 u16_Unused_0x0D
0x0D : Reserved register
Definition: P018_34_KG3_BLCP.h:141
U16 u16_Display_D1_P1_G
0x2E :
Definition: P018_34_KG3_BLCP.h:178
U16 u16_Display_D1_P3_D
0x3B :
Definition: P018_34_KG3_BLCP.h:193
U16 u16_Display_D1_P3_F
0x3D :
Definition: P018_34_KG3_BLCP.h:195
U16 u16_Display_D2_P1_B
0x11 :
Definition: P018_34_KG3_BLCP.h:146
U16 u16_Display_D2_P3_DP
0x27 :
Definition: P018_34_KG3_BLCP.h:170
U16 u16_Display_D1_P1_E
0x2C :
Definition: P018_34_KG3_BLCP.h:176
U16 u16_Display_D2_P3_C
0x22 :
Definition: P018_34_KG3_BLCP.h:165
U16 u16_Unit_ID_L
0x00 : Module identification register
Definition: P018_34_KG3_BLCP.h:124
U16 u16_Display_D2_P3_G
0x26 :
Definition: P018_34_KG3_BLCP.h:169
U16 u16_Encoder_Counter_Latch
0x0A : Encoder counter latch register
Definition: P018_34_KG3_BLCP.h:136
U16 u16_Display_D2_P2_A
0x18 :
Definition: P018_34_KG3_BLCP.h:154
U16 u16_Encoder_Counter
0x09 : Encoder counter register
Definition: P018_34_KG3_BLCP.h:135
U16 u16_Unused_0x07
0x07 : Reserved register
Definition: P018_34_KG3_BLCP.h:132
U16 u16_Display_D2_P3_E
0x24 :
Definition: P018_34_KG3_BLCP.h:167
U16 u16_Display_D1_P3_DP
0x3F :
Definition: P018_34_KG3_BLCP.h:197
U16 u16_Display_D2_P2_B
0x19 :
Definition: P018_34_KG3_BLCP.h:155
U16 u16_Display_D1_P2_D
0x33 :
Definition: P018_34_KG3_BLCP.h:184
U16 u16_Display_D2_P2_D
0x1B :
Definition: P018_34_KG3_BLCP.h:157
U16 u16_Unused_0x0C
0x0C : Reserved register
Definition: P018_34_KG3_BLCP.h:140
U16 u16_Display_D1_P1_A
0x28 :
Definition: P018_34_KG3_BLCP.h:172
U16 u16_Display_D2_P1_F
0x15 :
Definition: P018_34_KG3_BLCP.h:150
U16 u16_Display_D2_P1_E
0x14 :
Definition: P018_34_KG3_BLCP.h:149
U16 u16_Unit_ID_H
0x01 : Module identification register
Definition: P018_34_KG3_BLCP.h:125
U16 u16_Display_D1_P3_G
0x3E :
Definition: P018_34_KG3_BLCP.h:196
U16 u16_Display_D1_P3_A
0x38 :
Definition: P018_34_KG3_BLCP.h:190
U16 u16_Display_D1_P2_DP
0x37 :
Definition: P018_34_KG3_BLCP.h:188
U16 u16_Display_D1_P2_F
0x35 :
Definition: P018_34_KG3_BLCP.h:186
U16 u16_Display_D2_P1_G
0x16 :
Definition: P018_34_KG3_BLCP.h:151
U16 u16_Unused_0x02
0x02 : Reserved register
Definition: P018_34_KG3_BLCP.h:127
U16 u16_Display_D2_P2_E
0x1C :
Definition: P018_34_KG3_BLCP.h:158
U16 u16_Display_D2_P3_A
0x20 :
Definition: P018_34_KG3_BLCP.h:163
U16 u16_Display_D2_P1_A
0x10 : Display 2, segnant A dara register
Definition: P018_34_KG3_BLCP.h:145
U16 u16_Encoder_Status
0x08 : Encoder status register
Definition: P018_34_KG3_BLCP.h:134
U16 u16_Display_D1_P3_C
0x3A :
Definition: P018_34_KG3_BLCP.h:192
U16 u16_Unused_0x0F
0x0F : Reserved register
Definition: P018_34_KG3_BLCP.h:143
U16 u16_Display_D1_P1_C
0x2A :
Definition: P018_34_KG3_BLCP.h:174
U16 u16_Display_D2_P2_C
0x1A :
Definition: P018_34_KG3_BLCP.h:156
U16 u16_Display_D2_P2_DP
0x1F :
Definition: P018_34_KG3_BLCP.h:161
U16 u16_Display_D2_P3_D
0x23 :
Definition: P018_34_KG3_BLCP.h:166
U16 u16_Display_D2_P2_G
0x1E :
Definition: P018_34_KG3_BLCP.h:160
U16 u16_Unused_0x0E
0x0E : Reserved register
Definition: P018_34_KG3_BLCP.h:142
U16 u16_Display_D1_P2_G
0x36 :
Definition: P018_34_KG3_BLCP.h:187
U16 u16_Unused_0x04
0x04 : Reserved register
Definition: P018_34_KG3_BLCP.h:129
U16 u16_Display_D1_P2_A
0x30 :
Definition: P018_34_KG3_BLCP.h:181
U16 u16_Encoder_Counter_Delta_Latch
0x0B : Encoder counter latch register
Definition: P018_34_KG3_BLCP.h:137
U16 u16_Unused_0x06
0x06 : Reserved register
Definition: P018_34_KG3_BLCP.h:131
U16 u16_Display_D2_P1_DP
0x17 :
Definition: P018_34_KG3_BLCP.h:152
U16 u16_Display_D2_P1_C
0x12 :
Definition: P018_34_KG3_BLCP.h:147
U16 u16_Unused_0x03
0x03 : Reserved register
Definition: P018_34_KG3_BLCP.h:128
U16 u16_Display_D1_P1_DP
0x2F :
Definition: P018_34_KG3_BLCP.h:179
U16 u16_Display_D2_P3_F
0x25 :
Definition: P018_34_KG3_BLCP.h:168
U16 u16_Unused_0x05
0x05 : Reserved register
Definition: P018_34_KG3_BLCP.h:130
U16 u16_Display_D2_P1_D
0x13 :
Definition: P018_34_KG3_BLCP.h:148
U16 u16_Display_D2_P3_B
0x21 :
Definition: P018_34_KG3_BLCP.h:164
U16 u16_Display_D1_P3_B
0x39 :
Definition: P018_34_KG3_BLCP.h:191
U16 u16_Display_D2_P2_F
0x1D :
Definition: P018_34_KG3_BLCP.h:159
U16 u16_Display_D1_P2_E
0x34 :
Definition: P018_34_KG3_BLCP.h:185
U16 bool_Button_Status
Bit 8 : Button status.
Definition: P018_34_KG3_BLCP.h:107
U16 u16_Status
Encoder status word.
Definition: P018_34_KG3_BLCP.h:79
U16 bool_Channel_A
Bit 0 :
Definition: P018_34_KG3_BLCP.h:86
U16 bool_Filtered_Channel_A
Bit 3 :
Definition: P018_34_KG3_BLCP.h:95
U16 bool_Filtered_Channel_B
Bit 4 :
Definition: P018_34_KG3_BLCP.h:98
U16 u8_Direction
Bits 6..7 : Rotation direction.
Definition: P018_34_KG3_BLCP.h:104
U16 bool_Filtered_Button_Status
Bit 9 : Button filtered status.
Definition: P018_34_KG3_BLCP.h:110
U16 bool_Channel_B
Bit 1 :
Definition: P018_34_KG3_BLCP.h:89