ConOpSys V2970  P004.07
ANVILEX control operating system
P011_35_V2_0_DC_Bus.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file P011_35_V2_0_DC_Bus.h
3 //! @brief DC bus I/O board P011.35 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/P011_35_V2_0_DC_BUS/P011_35_V2_0_DC_Bus.h $
7 //! $Revision: 2933 $
8 //! $Date: 2022-02-13 21:16:07 +0500 (So, 13 Feb 2022) $
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 #pragma once
41 
42 //------------------------------------------------------------------------------
43 // Include standard libraries header files
44 //------------------------------------------------------------------------------
45 
46 //------------------------------------------------------------------------------
47 // Include thrid party header files
48 //------------------------------------------------------------------------------
49 
50 //------------------------------------------------------------------------------
51 // Include ConOpSys header files
52 //------------------------------------------------------------------------------
53 
54 #include "Function_Block_Base.h"
55 
56 //------------------------------------------------------------------------------
57 // Include ConOpSys application header files
58 //------------------------------------------------------------------------------
59 
60 //------------------------------------------------------------------------------
61 // Macros
62 //------------------------------------------------------------------------------
63 
64 //! @brief DC bus board P011.35 V2.0 board TP011_35_V2_0_DC_Bus class
66 {
67 
68  //----------------------------------------------------------------------------
69  // Public methods and variables
70  //----------------------------------------------------------------------------
71 
72  public:
73 
74  // Register structure for generic access
75  typedef struct
76  {
77 
78  union
79  {
80  U16 u16_Status; //!< Status register
81  U16 u16_Control; //!< Control register
82  };
83  I16 i16_Analog_Input_Data; //!< Analog input channel 1 data register
90 
92 
93  //--------------------------------------------------------------------------
94  // Public methods
95  //--------------------------------------------------------------------------
96 
97  // Constructor and destructor
98  TP011_35_V2_0_DC_Bus(); //!< Constructor method
99  ~TP011_35_V2_0_DC_Bus(); //!< Destructor method
100 
101  VOID Map( TP011_35_V2_0_DC_Bus_Registers *struct_Registers_Base_Address ); //!< Hardware mapping method
102 
103  virtual VOID Init(); //!< Initialisation method
104 
105  virtual VOID Execute_Inputs(); //!< Execute inputs
106 
107  virtual VOID Execute(); //!< Execution method
108 
109  virtual VOID Execute_Outputs(); //!< Execute outputs
110 
111  virtual VOID Send_Information( TProtocol_Base *object_Protocol ); //!< Send information about functional block
112 
113  //--------------------------------------------------------------------------
114  // Block parameters
115  //--------------------------------------------------------------------------
116 
117  TBlock_Input_Connector object_f32_Analog_Input_Full_Scale; //!< Analog input channel fill scale value. Also used for channel total gain adjustment.
118  TBlock_Input_Connector object_f32_Analog_Input_Offset; //!< Analog input channel offset
119 
120  //--------------------------------------------------------------------------
121  // Block inputs
122  //--------------------------------------------------------------------------
123 
126 
127  //--------------------------------------------------------------------------
128  // Block outputs
129  //--------------------------------------------------------------------------
130 
131  TBlock_Output_Connector object_f32_Analog_Input_Data; //!< Analog input data block output connector
132 
133  TBlock_Output_Connector object_bool_Hardware_Error; //!< Critical hardware error flag
134  TBlock_Output_Connector object_bool_Hardware_Limit_Error; //!< Hardware limit reached error flag
135  TBlock_Output_Connector object_bool_Software_Limit_Error; // !< Software limit reached error flag
136 
139 
140  U16 u16_Analog_Input_Status; //!< Analog input status
141  I16 i16_Analog_Input_Data; //!< Analog input data block output as I16
142 
143  //----------------------------------------------------------------------------
144  // Protected methods and variables
145  //----------------------------------------------------------------------------
146 
147  protected:
148 
149  //----------------------------------------------------------------------------
150  // Private methods and variables
151  //----------------------------------------------------------------------------
152 
153  private:
154 
155  typedef union
156  {
158  struct
159  {
160  U16 u16_ADC_Hardware_Fault_1:1; // Bit 0 - Not used
161  U16 :1; // Bit 1 - Not used
162  U16 :1; // Bit 2 - Not used
163  U16 :1; // Bit 3 - Not used
164  U16 :1; // Bit 4 - Not used
165  U16 :1; // Bit 5 - Not used
166  U16 :1; // Bit 6 - Not used
167  U16 u16_CMP_P_1_Status:1; // Bit 7 - Not used
168  U16 u16_CMP_P_2_Status:1; // Bit 8 - Not used
169  U16 :1; // Bit 9 - Not used
170  U16 :1; // Bit 10 - Not used
171  U16 :1; // Bit 11 - Not used
172  U16 :1; // Bit 12 - Not used
173  U16 :1; // Bit 13 - Not used
174  U16 :1; // Bit 14 - Not used
175  U16 :1; // Bit 15 - Not used
176  };
177  } TStatus;
178 
179  //!< Pointer to register in FPGA
181 
182  U16 u16_Status = (U16)0x0000;
183 
184  U16 u16_Control = (U16)0x0000;
185 
186  //!< Effective gain of the voltage measurement channel
187  F32 f32_Gain = (F32)1.0f;
188 
189  //!< Effective offset of the voltage measurement channel
190  F32 f32_Offset = (F32)0.0f;
191 
192 };
193 
194 //------------------------------------------------------------------------------
195 // End of file
196 //------------------------------------------------------------------------------
#define NULL
Definition: Defines.h:388
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 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
DC bus board P011.35 V2.0 board TP011_35_V2_0_DC_Bus class.
Definition: P011_35_V2_0_DC_Bus.h:66
volatile TP011_35_V2_0_DC_Bus_Registers * struct_Registers
Definition: P011_35_V2_0_DC_Bus.h:180
TBlock_Output_Connector object_bool_Hardware_Limit_Error
Hardware limit reached error flag.
Definition: P011_35_V2_0_DC_Bus.h:134
VOID Map(TP011_35_V2_0_DC_Bus_Registers *struct_Registers_Base_Address)
Hardware mapping method.
Definition: P011_35_V2_0_DC_Bus.cpp:122
U16 u16_Control
Effective gain of the voltage measurement channel.
Definition: P011_35_V2_0_DC_Bus.h:184
F32 f32_Gain
Effective offset of the voltage measurement channel.
Definition: P011_35_V2_0_DC_Bus.h:187
virtual VOID Execute_Outputs()
Execute outputs.
Definition: P011_35_V2_0_DC_Bus.cpp:200
I16 i16_Analog_Input_Data
Analog input data block output as I16.
Definition: P011_35_V2_0_DC_Bus.h:141
TBlock_Output_Connector object_bool_Ballast_Error
Ballast status signal.
Definition: P011_35_V2_0_DC_Bus.h:137
TBlock_Output_Connector object_bool_Hardware_Error
Critical hardware error flag.
Definition: P011_35_V2_0_DC_Bus.h:133
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send information about functional block.
Definition: P011_35_V2_0_DC_Bus.cpp:236
virtual VOID Init()
Initialisation method.
Definition: P011_35_V2_0_DC_Bus.cpp:136
U16 u16_Status
Definition: P011_35_V2_0_DC_Bus.h:182
F32 f32_Offset
Definition: P011_35_V2_0_DC_Bus.h:190
TBlock_Output_Connector object_bool_Crowbar_Error
Crowbar status signal.
Definition: P011_35_V2_0_DC_Bus.h:138
virtual VOID Execute_Inputs()
Execute inputs.
Definition: P011_35_V2_0_DC_Bus.cpp:154
TBlock_Input_Connector object_f32_Analog_Input_Offset
Analog input channel offset.
Definition: P011_35_V2_0_DC_Bus.h:118
TBlock_Input_Connector object_bool_Ballast_Control
Ballast status.
Definition: P011_35_V2_0_DC_Bus.h:124
TBlock_Output_Connector object_bool_Software_Limit_Error
Definition: P011_35_V2_0_DC_Bus.h:135
TBlock_Output_Connector object_f32_Analog_Input_Data
Analog input data block output connector.
Definition: P011_35_V2_0_DC_Bus.h:131
TBlock_Input_Connector object_bool_Crowbar_Control
Crowbar status.
Definition: P011_35_V2_0_DC_Bus.h:125
virtual VOID Execute()
Execution method.
Definition: P011_35_V2_0_DC_Bus.cpp:190
~TP011_35_V2_0_DC_Bus()
Destructor method.
Definition: P011_35_V2_0_DC_Bus.cpp:111
TP011_35_V2_0_DC_Bus()
Constructor method.
Definition: P011_35_V2_0_DC_Bus.cpp:68
TBlock_Input_Connector object_f32_Analog_Input_Full_Scale
Analog input channel fill scale value. Also used for channel total gain adjustment.
Definition: P011_35_V2_0_DC_Bus.h:117
U16 u16_Analog_Input_Status
Analog input status.
Definition: P011_35_V2_0_DC_Bus.h:140
Definition: Protocol_Base.h:57
Definition: P011_35_V2_0_DC_Bus.h:76
U16 u16_Reserve_0x03
Definition: P011_35_V2_0_DC_Bus.h:85
U16 u16_Reserve_0x06
Definition: P011_35_V2_0_DC_Bus.h:88
U16 u16_Status
Status register.
Definition: P011_35_V2_0_DC_Bus.h:80
I16 i16_Analog_Input_Data
Analog input channel 1 data register.
Definition: P011_35_V2_0_DC_Bus.h:83
U16 u16_Reserve_0x02
Definition: P011_35_V2_0_DC_Bus.h:84
I16 i16_Analog_Input_Filtered_Data
Definition: P011_35_V2_0_DC_Bus.h:86
U16 u16_Reserve_0x07
Definition: P011_35_V2_0_DC_Bus.h:89
U16 u16_Reserve_0x05
Definition: P011_35_V2_0_DC_Bus.h:87
U16 u16_Control
Control register.
Definition: P011_35_V2_0_DC_Bus.h:81
U16 u16_CMP_P_2_Status
Definition: P011_35_V2_0_DC_Bus.h:168
U16 u16_Status
Definition: P011_35_V2_0_DC_Bus.h:157
U16 u16_CMP_P_1_Status
Definition: P011_35_V2_0_DC_Bus.h:167
U16 u16_ADC_Hardware_Fault_1
Definition: P011_35_V2_0_DC_Bus.h:160