ConOpSys V2970  P004.07
ANVILEX control operating system
P005_03_V2_0_AI_V.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file P005_03_V2_0_AI_V.h
3 //! @brief Analog input board P005.03 V2.0 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/P005_03_V2_0_AI/P005_03_V2_0_AI_V.h $
7 //! $Revision: 2280 $
8 //! $Date: 2020-12-12 16:29:27 +0500 (Sa, 12 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 //! @brief Analog input P005.03 V2.0 board TP005_03_V2_0_AI_V class
65 class TP005_03_V2_0_AI_V : public TFunctional_Block_Base
66 {
67 
68  //----------------------------------------------------------------------------
69  // Public defines, methods and variables
70  //----------------------------------------------------------------------------
71 
72  public:
73 
74  //--------------------------------------------------------------------------
75  // Public defines
76  //--------------------------------------------------------------------------
77 
78  // Register structure for generic access
79  typedef struct
80  {
81 
82  // Analog value registers
83  U16 u16_Analog_Input_Status; //!< Status register
84  I16 i16_Analog_Input_Data_1; //!< Analog input channel 1 data register as I16 value
85  I16 i16_Analog_Input_Data_2; //!< Analog input channel 2 data register as I16 value
86  I16 i16_Analog_Input_Data_3; //!< Analog input channel 3 data register as I16 value
91 
93 
94  //--------------------------------------------------------------------------
95  // Public methods
96  //--------------------------------------------------------------------------
97 
98  //!-------------------------------------------------------------------------
99  //! @brief Class constructor method.
100  //! @note None
101  //! \par Override
102  //! Not allowed
103  //! @attention Don't call this method directly.
104  //--------------------------------------------------------------------------
105 
107 
108  //!-------------------------------------------------------------------------
109  //! @brief Class destructor method.
110  //! @note None
111  //! \par Override
112  //! Not allowed
113  //! @attention Don't call this method directly.
114  //--------------------------------------------------------------------------
115 
117 
118  VOID Map( TP005_03_V2_0_AI_V_Registers *struct_Registers_Base_Address );
119  virtual VOID Init();
120  virtual VOID Execute();
121  virtual VOID Send_Information( TProtocol_Base *object_Protocol );
122 
123  //--------------------------------------------------------------------------
124  // Block parameter signals
125  //--------------------------------------------------------------------------
126 
127  TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_1; //!< Analog input channel 1 fill scale value. Also used for channel total gain adjustment.
128  TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_2; //!< Analog input channel 1 fill scale value. Also used for channel total gain gain adjustment.
129  TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_3; //!< Analog input channel 1 fill scale value. Also used for channel total gain gain adjustment.
130 
131  TBlock_Input_Connector object_f32_Analog_Input_Offset_1; //!< Analog input channel 1 offset
132  TBlock_Input_Connector object_f32_Analog_Input_Offset_2; //!< Analog input channel 2 offset
133  TBlock_Input_Connector object_f32_Analog_Input_Offset_3; //!< Analog input channel 3 offset
134 
135  //--------------------------------------------------------------------------
136  // Block input signals
137  //--------------------------------------------------------------------------
138 
140 
141  //--------------------------------------------------------------------------
142  // Block output signals
143  //--------------------------------------------------------------------------
144 
145  U16 u16_Analog_Input_Status; //!< Analog input status
146  I16 i16_Analog_Input_Data_1; //!< Analog input channel 1 block output as I16
147  I16 i16_Analog_Input_Data_2; //!< Analog input channel 2 block output as I16
148  I16 i16_Analog_Input_Data_3; //!< Analog input channel 3 block output as I16
149 
150  TBlock_Output_Connector object_f32_Analog_Input_Data_1; //!< Analog input channel 1 block output
151  TBlock_Output_Connector object_f32_Analog_Input_Data_2; //!< Analog input channel 2 block output
152  TBlock_Output_Connector object_f32_Analog_Input_Data_3; //!< Analog input channel 3 block output
153  TBlock_Output_Connector object_f32_Analog_Input_Data_DC; //!< Analog input channels DC offset
154 
155  TBlock_Output_Connector object_f32_AN; //!< Analog input channel 1 block output
156  TBlock_Output_Connector object_f32_BN; //!< Analog input channel 2 block output
157  TBlock_Output_Connector object_f32_CN; //!< Analog input channel 3 block output
158 
159  TBlock_Output_Connector object_bool_Hardware_Error; //!< Critical hardware error flag
160  TBlock_Output_Connector object_bool_Symmenty_Error; //!< Signal symmery error flag
162  TBlock_Output_Connector object_bool_Magnitude_Software_Level_Error; // !< Software magnitude limit reached error flag
163 
164  //----------------------------------------------------------------------------
165  // Protected defines, methods and variables
166  //----------------------------------------------------------------------------
167 
168  protected:
169 
170  //----------------------------------------------------------------------------
171  // Private defines, methods and variables
172  //----------------------------------------------------------------------------
173 
174  private:
175 
176  typedef union
177  {
179  struct
180  {
184  U16 :1;
185  U16 :1;
186  U16 :1;
187  U16 :1;
194  U16 :1;
195  U16 :1;
196  U16 :1;
197  };
198  } TStatus;
199 
200  volatile TP005_03_V2_0_AI_V_Registers *struct_Registers; //!< Hardware mapped registers
201 
202  F32 f32_Gain_1; //!< Effective gain of the channel 1
203  F32 f32_Gain_2; //!< Effective gain of the channel 2
204  F32 f32_Gain_3; //!< Effective gain of the channel 3
205 
206  F32 f32_Offset_1; //!< Effective offset of the channel 1
207  F32 f32_Offset_2; //!< Effective offset of the channel 2
208  F32 f32_Offset_3; //!< Effective offset of the channel 3
209 
210 };
211 
212 //------------------------------------------------------------------------------
213 // End of file
214 //------------------------------------------------------------------------------
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
Analog input P005.03 V2.0 board TP005_03_V2_0_AI_V class.
Definition: P005_03_V2_0_AI_V.h:66
virtual VOID Init()
Analog input board P005.03 V2.0 object initialization.
Definition: P005_03_V2_0_AI_V.cpp:189
TBlock_Output_Connector object_bool_Magnitude_Hardware_Level_Error
Hardware limit reached error flag.
Definition: P005_03_V2_0_AI_V.h:161
TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_3
Analog input channel 1 fill scale value. Also used for channel total gain gain adjustment.
Definition: P005_03_V2_0_AI_V.h:129
~TP005_03_V2_0_AI_V()
Class destructor method.
Definition: P005_03_V2_0_AI_V.cpp:164
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: P005_03_V2_0_AI_V.h:127
TBlock_Input_Connector object_f32_Analog_Input_Offset_2
Analog input channel 2 offset.
Definition: P005_03_V2_0_AI_V.h:132
virtual VOID Execute()
Analog input board P005.03 V2.0 execute method.
Definition: P005_03_V2_0_AI_V.cpp:209
F32 f32_Gain_3
Effective gain of the channel 3.
Definition: P005_03_V2_0_AI_V.h:204
TBlock_Output_Connector object_f32_Analog_Input_Data_2
Analog input channel 2 block output.
Definition: P005_03_V2_0_AI_V.h:151
F32 f32_Gain_1
Effective gain of the channel 1.
Definition: P005_03_V2_0_AI_V.h:202
TBlock_Output_Connector object_f32_Analog_Input_Data_DC
Analog input channels DC offset.
Definition: P005_03_V2_0_AI_V.h:153
TBlock_Output_Connector object_f32_Analog_Input_Data_1
Analog input channel 1 block output.
Definition: P005_03_V2_0_AI_V.h:150
TBlock_Output_Connector object_bool_Hardware_Error
Critical hardware error flag.
Definition: P005_03_V2_0_AI_V.h:159
TBlock_Output_Connector object_f32_CN
Analog input channel 3 block output.
Definition: P005_03_V2_0_AI_V.h:157
F32 f32_Gain_2
Effective gain of the channel 2.
Definition: P005_03_V2_0_AI_V.h:203
TBlock_Output_Connector object_bool_Symmenty_Error
Signal symmery error flag.
Definition: P005_03_V2_0_AI_V.h:160
volatile TP005_03_V2_0_AI_V_Registers * struct_Registers
Hardware mapped registers.
Definition: P005_03_V2_0_AI_V.h:200
TBlock_Output_Connector object_f32_Analog_Input_Data_3
Analog input channel 3 block output.
Definition: P005_03_V2_0_AI_V.h:152
TBlock_Input_Connector object_f32_Analog_Input_Offset_3
Analog input channel 3 offset.
Definition: P005_03_V2_0_AI_V.h:133
F32 f32_Offset_2
Effective offset of the channel 2.
Definition: P005_03_V2_0_AI_V.h:207
TP005_03_V2_0_AI_V()
Class constructor method.
Definition: P005_03_V2_0_AI_V.cpp:70
TBlock_Input_Connector object_f32_Magnitude_Software_Level
Definition: P005_03_V2_0_AI_V.h:139
TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_2
Analog input channel 1 fill scale value. Also used for channel total gain gain adjustment.
Definition: P005_03_V2_0_AI_V.h:128
TBlock_Output_Connector object_f32_BN
Analog input channel 2 block output.
Definition: P005_03_V2_0_AI_V.h:156
TBlock_Output_Connector object_f32_AN
Analog input channel 1 block output.
Definition: P005_03_V2_0_AI_V.h:155
I16 i16_Analog_Input_Data_3
Analog input channel 3 block output as I16.
Definition: P005_03_V2_0_AI_V.h:148
VOID Map(TP005_03_V2_0_AI_V_Registers *struct_Registers_Base_Address)
Analog input board P005.03 V2.0 memory map.
Definition: P005_03_V2_0_AI_V.cpp:175
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send detailed information about functional block.
Definition: P005_03_V2_0_AI_V.cpp:260
F32 f32_Offset_1
Effective offset of the channel 1.
Definition: P005_03_V2_0_AI_V.h:206
TBlock_Input_Connector object_f32_Analog_Input_Offset_1
Analog input channel 1 offset.
Definition: P005_03_V2_0_AI_V.h:131
I16 i16_Analog_Input_Data_1
Analog input channel 1 block output as I16.
Definition: P005_03_V2_0_AI_V.h:146
I16 i16_Analog_Input_Data_2
Analog input channel 2 block output as I16.
Definition: P005_03_V2_0_AI_V.h:147
TBlock_Output_Connector object_bool_Magnitude_Software_Level_Error
Definition: P005_03_V2_0_AI_V.h:162
U16 u16_Analog_Input_Status
Analog input status.
Definition: P005_03_V2_0_AI_V.h:145
F32 f32_Offset_3
Effective offset of the channel 3.
Definition: P005_03_V2_0_AI_V.h:208
Definition: Protocol_Base.h:57
Definition: P005_03_V2_0_AI_V.h:80
U16 u16_Reserve_0x04
Definition: P005_03_V2_0_AI_V.h:87
I16 i16_Analog_Input_Data_2
Analog input channel 2 data register as I16 value.
Definition: P005_03_V2_0_AI_V.h:85
I16 i16_Analog_Input_Filtered_Data_1
Definition: P005_03_V2_0_AI_V.h:88
I16 i16_Analog_Input_Filtered_Data_2
Definition: P005_03_V2_0_AI_V.h:89
I16 i16_Analog_Input_Data_1
Analog input channel 1 data register as I16 value.
Definition: P005_03_V2_0_AI_V.h:84
I16 i16_Analog_Input_Filtered_Data_3
Definition: P005_03_V2_0_AI_V.h:90
I16 i16_Analog_Input_Data_3
Analog input channel 3 data register as I16 value.
Definition: P005_03_V2_0_AI_V.h:86
U16 u16_Analog_Input_Status
Status register.
Definition: P005_03_V2_0_AI_V.h:83
U16 u16_CMP_P_3_Status
Definition: P005_03_V2_0_AI_V.h:192
U16 u16_ADC_Hardware_Fault_1
Definition: P005_03_V2_0_AI_V.h:181
U16 u16_CMP_N_2_Status
Definition: P005_03_V2_0_AI_V.h:191
U16 u16_CMP_P_2_Status
Definition: P005_03_V2_0_AI_V.h:190
U16 u16_CMP_N_1_Status
Definition: P005_03_V2_0_AI_V.h:189
U16 u16_CMP_P_1_Status
Definition: P005_03_V2_0_AI_V.h:188
U16 u16_ADC_Hardware_Fault_2
Definition: P005_03_V2_0_AI_V.h:182
U16 u16_CMP_N_3_Status
Definition: P005_03_V2_0_AI_V.h:193
U16 u16_ADC_Hardware_Fault_3
Definition: P005_03_V2_0_AI_V.h:183
U16 u16_Status
Definition: P005_03_V2_0_AI_V.h:178