ConOpSys V2970  P004.07
ANVILEX control operating system
P018_20_KG3_EXT_VI.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file P018_20_KG3_EXT_VI.h
3 //! @brief Remote voltage input board P018.20 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_20_KG3_EXT_VI/P018_20_KG3_EXT_VI.h $
7 //! $Revision: 2305 $
8 //! $Date: 2020-12-25 03:00:01 +0500 (Fr, 25 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 "Functional_Block_Base.h"
59 
60 //------------------------------------------------------------------------------
61 // Macros
62 //------------------------------------------------------------------------------
63 
64 //------------------------------------------------------------------------------
65 // Class definition
66 //------------------------------------------------------------------------------
67 
68 //! @brief Extern analog input board P018.20 class
69 class TP018_20_KG3_EXT_VI : public TFunctional_Block_Base
70 {
71 
72  //----------------------------------------------------------------------------
73  // Public defines, methods and variables
74  //----------------------------------------------------------------------------
75 
76  public:
77 
78  // Register structure for generic access
79  typedef struct
80  {
81 
82  U16 u16_Module_ID; //!< 0x00 : Module ID read register
83  union
84  {
85  U16 u16_Status; //!< 0x01 : Status register
86  U16 u16_Control; //!< 0x01 : Control register
87  };
88  I16 i16_Analog_Input_Data_1; //!< 0x02 : Analog input channel 1 data register as I16 value
89  I16 i16_Analog_Input_Data_2; //!< 0x03 : Analog input channel 2 data register as I16 value
90  I16 i16_Analog_Input_Data_3; //!< 0x04 : Analog input channel 3 data register as I16 value
91  I16 i16_Analog_Input_Filtered_Data_1; //!< 0x05 : Analog input channel 1 filtered data register as I16 value
92  I16 i16_Analog_Input_Filtered_Data_2; //!< 0x06 : Analog input channel 2 filtered data register as I16 value
93  I16 i16_Analog_Input_Filtered_Data_3; //!< 0x07 : Analog input channel 3 filtered data register as I16 value
94 
96 
97  //--------------------------------------------------------------------------
98  // Public methods
99  //--------------------------------------------------------------------------
100 
101  // Constructor and destructor
102  TP018_20_KG3_EXT_VI(); //!< Constructor method
103  ~TP018_20_KG3_EXT_VI(); //!< Destructor method
104 
105  VOID Map( TP018_20_KG3_EXT_VI_Registers *struct_Registers_Base_Address );
106  virtual VOID Init();
107  virtual VOID Execute();
108  virtual VOID Send_Information( TProtocol_Base *object_Protocol );
109 
110  //--------------------------------------------------------------------------
111  // Block parameters
112  //--------------------------------------------------------------------------
113 
114  TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_1; //!< Analog input channel 1 fill scale value. Also used for channel total gain adjustment.
115  TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_2; //!< Analog input channel 2 fill scale value. Also used for channel total gain adjustment.
116  TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_3; //!< Analog input channel 3 fill scale value. Also used for channel total gain adjustment.
117 
118  TBlock_Input_Connector object_f32_Analog_Input_Offset_1; //!< Analog input channel 1 offset
119  TBlock_Input_Connector object_f32_Analog_Input_Offset_2; //!< Analog input channel 2 offset
120  TBlock_Input_Connector object_f32_Analog_Input_Offset_3; //!< Analog input channel 3 offset
121 
122  TBlock_Input_Connector object_bool_Negate; //!< Negate input analog signal value
123 
124  //--------------------------------------------------------------------------
125  // Block inputs
126  //--------------------------------------------------------------------------
127 
128  TBlock_Input_Connector object_f32_Software_Overcurrent_Level; //!< Software defined overcurrent level
129 
130  //--------------------------------------------------------------------------
131  // Block outputs
132  //--------------------------------------------------------------------------
133 
134  U16 u16_Analog_Input_Status; //!< Analog input status
135  I16 i16_Analog_Input_Data_1; //!< Analog input channel 1 block output as I16
136  I16 i16_Analog_Input_Data_2; //!< Analog input channel 2 block output as I16
137  I16 i16_Analog_Input_Data_3; //!< Analog input channel 3 block output as I16
138 
139  TBlock_Output_Connector object_f32_Analog_Input_Data_1; //!< Analog input channel 1 block output
140  TBlock_Output_Connector object_f32_Analog_Input_Data_2; //!< Analog input channel 2 block output
141  TBlock_Output_Connector object_f32_Analog_Input_Data_3; //!< Analog input channel 3 block output
142  TBlock_Output_Connector object_f32_Analog_Input_Data_DC; //!< Analog input channels DC offset
143 
144  TBlock_Output_Connector object_bool_Hardware_Error; //!< Critical hardware error flag
145  TBlock_Output_Connector object_bool_Symmenty_Error; //!< Signal symmery error flag
148 
149  //----------------------------------------------------------------------------
150  // Protected defines, methods and variables
151  //----------------------------------------------------------------------------
152 
153  protected:
154 
155  //----------------------------------------------------------------------------
156  // Private defines, methods and variables
157  //----------------------------------------------------------------------------
158 
159  private:
160 
161  typedef union
162  {
164  struct
165  {
169  U16 :1; // Bit 3
170  U16 :1; // Bit 4
171  U16 :1; // Bit 5
172  U16 :1; // Bit 6
176  U16 u16_CMP_N_2_Status:1; // Bit 10
177  U16 u16_CMP_P_3_Status:1; // Bit 11
178  U16 u16_CMP_N_3_Status:1; // Bit 12
179  U16 :1; // Bit 13
180  U16 :1; // Bit 14
181  U16 :1; // Bit 15
182  };
183  } TStatus;
184 
185  volatile TP018_20_KG3_EXT_VI_Registers *struct_Registers; //!< Hardware mapped registers
186 
187  F32 f32_Gain_1; //!< Effective gain of the channel 1
188  F32 f32_Gain_2; //!< Effective gain of the channel 2
189  F32 f32_Gain_3; //!< Effective gain of the channel 3
190 
191  F32 f32_Offset_1; //!< Effective offset of the channel 1
192  F32 f32_Offset_2; //!< Effective offset of the channel 2
193  F32 f32_Offset_3; //!< Effective offset of the channel 3
194 
195 };
196 
197 //------------------------------------------------------------------------------
198 // End of file
199 //------------------------------------------------------------------------------
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
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 input connector class.
Definition: Block_Input_Connector.h:83
Function block output connector class.
Definition: Block_Output_Connector.h:59
Extern analog input board P018.20 class.
Definition: P018_20_KG3_EXT_VI.h:70
I16 i16_Analog_Input_Data_1
Analog input channel 1 block output as I16.
Definition: P018_20_KG3_EXT_VI.h:135
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: P018_20_KG3_EXT_VI.h:114
TBlock_Input_Connector object_f32_Analog_Input_Offset_3
Analog input channel 3 offset.
Definition: P018_20_KG3_EXT_VI.h:120
F32 f32_Gain_3
Effective gain of the channel 3.
Definition: P018_20_KG3_EXT_VI.h:189
TBlock_Input_Connector object_bool_Negate
Negate input analog signal value.
Definition: P018_20_KG3_EXT_VI.h:122
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send detailed information about functional block.
Definition: P018_20_KG3_EXT_VI.cpp:252
TBlock_Output_Connector object_bool_Symmenty_Error
Signal symmery error flag.
Definition: P018_20_KG3_EXT_VI.h:145
TBlock_Output_Connector object_bool_Magnitude_Hardware_Level_Error
Hardware overcurrent limit.
Definition: P018_20_KG3_EXT_VI.h:146
TBlock_Output_Connector object_f32_Analog_Input_Data_1
Analog input channel 1 block output.
Definition: P018_20_KG3_EXT_VI.h:139
F32 f32_Offset_3
Effective offset of the channel 3.
Definition: P018_20_KG3_EXT_VI.h:193
I16 i16_Analog_Input_Data_2
Analog input channel 2 block output as I16.
Definition: P018_20_KG3_EXT_VI.h:136
TBlock_Output_Connector object_f32_Analog_Input_Data_DC
Analog input channels DC offset.
Definition: P018_20_KG3_EXT_VI.h:142
TBlock_Input_Connector object_f32_Software_Overcurrent_Level
Software defined overcurrent level.
Definition: P018_20_KG3_EXT_VI.h:128
virtual VOID Init()
Analog input board P018.20 object initialization.
Definition: P018_20_KG3_EXT_VI.cpp:183
TP018_20_KG3_EXT_VI()
Constructor method.
Definition: P018_20_KG3_EXT_VI.cpp:70
F32 f32_Offset_1
Effective offset of the channel 1.
Definition: P018_20_KG3_EXT_VI.h:191
TBlock_Input_Connector object_f32_Analog_Input_Offset_1
Analog input channel 1 offset.
Definition: P018_20_KG3_EXT_VI.h:118
volatile TP018_20_KG3_EXT_VI_Registers * struct_Registers
Hardware mapped registers.
Definition: P018_20_KG3_EXT_VI.h:185
TBlock_Input_Connector object_f32_Analog_Input_Offset_2
Analog input channel 2 offset.
Definition: P018_20_KG3_EXT_VI.h:119
TBlock_Output_Connector object_bool_Software_Overcurrent
Definition: P018_20_KG3_EXT_VI.h:147
I16 i16_Analog_Input_Data_3
Analog input channel 3 block output as I16.
Definition: P018_20_KG3_EXT_VI.h:137
~TP018_20_KG3_EXT_VI()
Destructor method.
Definition: P018_20_KG3_EXT_VI.cpp:158
U16 u16_Analog_Input_Status
Analog input status.
Definition: P018_20_KG3_EXT_VI.h:134
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: P018_20_KG3_EXT_VI.h:116
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: P018_20_KG3_EXT_VI.h:115
F32 f32_Offset_2
Effective offset of the channel 2.
Definition: P018_20_KG3_EXT_VI.h:192
F32 f32_Gain_2
Effective gain of the channel 2.
Definition: P018_20_KG3_EXT_VI.h:188
VOID Map(TP018_20_KG3_EXT_VI_Registers *struct_Registers_Base_Address)
Analog input board P017.42 KG3 AI memory map.
Definition: P018_20_KG3_EXT_VI.cpp:169
F32 f32_Gain_1
Effective gain of the channel 1.
Definition: P018_20_KG3_EXT_VI.h:187
TBlock_Output_Connector object_bool_Hardware_Error
Critical hardware error flag.
Definition: P018_20_KG3_EXT_VI.h:144
virtual VOID Execute()
Analog input board P017.42 KG3 AI execute method.
Definition: P018_20_KG3_EXT_VI.cpp:207
TBlock_Output_Connector object_f32_Analog_Input_Data_3
Analog input channel 3 block output.
Definition: P018_20_KG3_EXT_VI.h:141
TBlock_Output_Connector object_f32_Analog_Input_Data_2
Analog input channel 2 block output.
Definition: P018_20_KG3_EXT_VI.h:140
Definition: Protocol_Base.h:57
Definition: P018_20_KG3_EXT_VI.h:80
I16 i16_Analog_Input_Filtered_Data_1
0x05 : Analog input channel 1 filtered data register as I16 value
Definition: P018_20_KG3_EXT_VI.h:91
U16 u16_Status
0x01 : Status register
Definition: P018_20_KG3_EXT_VI.h:85
I16 i16_Analog_Input_Data_2
0x03 : Analog input channel 2 data register as I16 value
Definition: P018_20_KG3_EXT_VI.h:89
U16 u16_Module_ID
0x00 : Module ID read register
Definition: P018_20_KG3_EXT_VI.h:82
I16 i16_Analog_Input_Filtered_Data_3
0x07 : Analog input channel 3 filtered data register as I16 value
Definition: P018_20_KG3_EXT_VI.h:93
I16 i16_Analog_Input_Data_3
0x04 : Analog input channel 3 data register as I16 value
Definition: P018_20_KG3_EXT_VI.h:90
U16 u16_Control
0x01 : Control register
Definition: P018_20_KG3_EXT_VI.h:86
I16 i16_Analog_Input_Data_1
0x02 : Analog input channel 1 data register as I16 value
Definition: P018_20_KG3_EXT_VI.h:88
I16 i16_Analog_Input_Filtered_Data_2
0x06 : Analog input channel 2 filtered data register as I16 value
Definition: P018_20_KG3_EXT_VI.h:92
U16 u16_Status
Definition: P018_20_KG3_EXT_VI.h:163
U16 u16_ADC_Hardware_Fault_3
Definition: P018_20_KG3_EXT_VI.h:168
U16 u16_CMP_N_1_Status
Definition: P018_20_KG3_EXT_VI.h:174
U16 u16_ADC_Hardware_Fault_1
Definition: P018_20_KG3_EXT_VI.h:166
U16 u16_ADC_Hardware_Fault_2
Definition: P018_20_KG3_EXT_VI.h:167
U16 u16_CMP_P_2_Status
Definition: P018_20_KG3_EXT_VI.h:175
U16 u16_CMP_N_2_Status
Definition: P018_20_KG3_EXT_VI.h:176
U16 u16_CMP_P_3_Status
Definition: P018_20_KG3_EXT_VI.h:177
U16 u16_CMP_P_1_Status
Definition: P018_20_KG3_EXT_VI.h:173
U16 u16_CMP_N_3_Status
Definition: P018_20_KG3_EXT_VI.h:178