ConOpSys V2970  P004.07
ANVILEX control operating system
P013_49_V1_0_RTD.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file P013_49_V1_0_RTD.h
3 //! @brief RTD input board P013.49 V1.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/P013_49_V1_0_RTD/P013_49_V1_0_RTD.h $
7 //! $Revision: 2262 $
8 //! $Date: 2020-12-05 07:20:48 +0500 (Sa, 05 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 #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 "Functional_Block_Base.h"
55 
56 //------------------------------------------------------------------------------
57 // Include ConOpSys application header files
58 //------------------------------------------------------------------------------
59 
60 //! @brief KG2 RTD P013.49 V1.0 board class
61 class TP013_49_V1_0_RTD : public TFunctional_Block_Base
62 {
63 
64  //----------------------------------------------------------------------------
65  // Public defines, methods and variables
66  //----------------------------------------------------------------------------
67 
68  public:
69 
70  //--------------------------------------------------------------------------
71  // Public type declarations
72  //--------------------------------------------------------------------------
73 
74  // Register structure for generic access
75  typedef struct
76  {
77 
78  // Board identification registers
79 // U16 u16_Board_ID;
80 // U16 u16_Driver_ID;
81 
82  union
83  {
84  U16 u16_RTD_Control; //!< Control register
85  U16 u16_RTD_Status; //!< Status register
86  };
87 
88  U16 u16_RTD_Data; //!< Data register
89 
91 
92  // Constructor and destructor
93  TP013_49_V1_0_RTD(); //!< Constructor method
94  ~TP013_49_V1_0_RTD(); //!< Destructor method
95 
96  VOID Map( TP013_49_V1_0_RTD_Registers *struct_Registers_Base_Address );
97  virtual VOID Init(); //!< Functional block initialisation method
98  virtual VOID Execute(); //!< Functional block execution method
99  virtual VOID Send_Information( TProtocol_Base *object_Protocol ); //!< Send information method
100 
101  // Parameters
106 
111 
112 
113  // Outputs
118 
123 
124  union
125  {
127  struct
128  {
137  U32 :24;
139  };
140 
141  //----------------------------------------------------------------------------
142  // Protected defines, methods and variables
143  //----------------------------------------------------------------------------
144 
145  protected:
146 
147  //----------------------------------------------------------------------------
148  // Private defines, methods and variables
149  //----------------------------------------------------------------------------
150 
151  private:
152 
153  // Hardware communication related methods
154  BOOL RTD_Wait(); //!< Wait for RTD ready
155  BOOL RTD_Read( U16 u16_Command, U16 *u16_Data ); //!< Read register value
156  BOOL RTD_Write( U16 u16_Command, U16 u16_Data ); //!< Write register value
157 
158  // Channel configuration related methods
159  BOOL Configure_Channel( U16 u16_Command, U16 u16_Data ); //!< RTD chip configuration method
160 
161  // Temperature measurement related methods
166 
167  // Calculation related methods
168  F32 Calculate_Resistance( U16 u16_ADC_Value ); //!< Calculate resistance from ADC value
169 
170  // FPGA memory mapped registers
171  volatile TP013_49_V1_0_RTD_Registers *struct_Registers; //!< FPGA memory mapped registers
172 
173  // Relability statistical data
175 
180 
185 
190 
195 
200 
201  volatile U32 u32_Dummy_Counter; //! ANVILEX: To remove
202 
203 };
204 
205 //------------------------------------------------------------------------------
206 // End Of File
207 //------------------------------------------------------------------------------
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
float F32
IEEE-754 32-Bit single presession floating point numbers datatype defenition.
Definition: Defines.h:324
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
KG2 RTD P013.49 V1.0 board class.
Definition: P013_49_V1_0_RTD.h:62
F32 f32_RTD_Temperature_3
Definition: P013_49_V1_0_RTD.h:198
U32 bool_RTD_Hardware_Fault_Channel_2
Definition: P013_49_V1_0_RTD.h:132
U32 u32_RTD_Hardware_Error_Count_2
Definition: P013_49_V1_0_RTD.h:187
U32 bool_FPGA_Timeout_Fault_Channel_2
Definition: P013_49_V1_0_RTD.h:131
TBlock_Output_Connector object_f32_Temperature_Channel_2
Definition: P013_49_V1_0_RTD.h:120
TBlock_Input_Connector object_f32_Temperature_Offset_Channel_2
Definition: P013_49_V1_0_RTD.h:108
U32 bool_RTD_Hardware_Fault_Channel_3
Definition: P013_49_V1_0_RTD.h:134
TBlock_Input_Connector object_f32_Temperature_Gain_Channel_2
Definition: P013_49_V1_0_RTD.h:103
TBlock_Output_Connector object_f32_Temperature_Channel_3
Definition: P013_49_V1_0_RTD.h:121
virtual VOID Execute()
Functional block execution method.
Definition: P013_49_V1_0_RTD.cpp:418
U32 u32_RTD_Temperature_Read_Count_3
Definition: P013_49_V1_0_RTD.h:178
TBlock_Input_Connector object_f32_Temperature_Gain_Channel_1
Definition: P013_49_V1_0_RTD.h:102
VOID Map(TP013_49_V1_0_RTD_Registers *struct_Registers_Base_Address)
RTD board P013.49 V1.0 memory mapping.
Definition: P013_49_V1_0_RTD.cpp:359
U32 u32_RTD_Hardware_Error_Count_1
Definition: P013_49_V1_0_RTD.h:186
U32 bool_FPGA_Timeout_Fault_Channel_1
Definition: P013_49_V1_0_RTD.h:129
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send information method.
Definition: P013_49_V1_0_RTD.cpp:1325
BOOL Configure_Channel(U16 u16_Command, U16 u16_Data)
RTD chip configuration method.
Definition: P013_49_V1_0_RTD.cpp:597
BOOL Get_Temperature_Channel_3()
Definition: P013_49_V1_0_RTD.cpp:977
U32 bool_FPGA_Timeout_Fault_Channel_4
Definition: P013_49_V1_0_RTD.h:135
TBlock_Output_Connector object_f32_Temperature_Channel_4
Definition: P013_49_V1_0_RTD.h:122
volatile TP013_49_V1_0_RTD_Registers * struct_Registers
FPGA memory mapped registers.
Definition: P013_49_V1_0_RTD.h:171
TP013_49_V1_0_RTD()
Constructor method.
Definition: P013_49_V1_0_RTD.cpp:246
BOOL Get_Temperature_Channel_2()
Definition: P013_49_V1_0_RTD.cpp:817
F32 Calculate_Resistance(U16 u16_ADC_Value)
Calculate resistance from ADC value.
Definition: P013_49_V1_0_RTD.cpp:1307
struct TP013_49_V1_0_RTD::@141::@145 u32_Status_Bits
TBlock_Input_Connector object_f32_Temperature_Gain_Channel_3
Definition: P013_49_V1_0_RTD.h:104
TBlock_Input_Connector object_f32_Temperature_Offset_Channel_4
Definition: P013_49_V1_0_RTD.h:110
TBlock_Input_Connector object_f32_Temperature_Gain_Channel_4
Definition: P013_49_V1_0_RTD.h:105
U32 u32_RTD_Temperature_Read_Count_2
Definition: P013_49_V1_0_RTD.h:177
U32 u32_Status
Definition: P013_49_V1_0_RTD.h:126
U32 u32_RTD_Temperature_Read_Success_Count_4
Definition: P013_49_V1_0_RTD.h:184
U16 u16_RTD_Status_1
Definition: P013_49_V1_0_RTD.h:191
U32 u32_RTD_Hardware_Error_Count_3
Definition: P013_49_V1_0_RTD.h:188
U32 bool_RTD_Hardware_Fault_Channel_4
Definition: P013_49_V1_0_RTD.h:136
BOOL RTD_Wait()
Wait for RTD ready.
Definition: P013_49_V1_0_RTD.cpp:433
U32 u32_RTD_Hardware_Error_Count_4
Definition: P013_49_V1_0_RTD.h:189
U32 u32_RTD_Temperature_Read_Count_1
Definition: P013_49_V1_0_RTD.h:176
virtual VOID Init()
Functional block initialisation method.
Definition: P013_49_V1_0_RTD.cpp:373
U32 u32_RTD_Temperature_Read_Count_4
Definition: P013_49_V1_0_RTD.h:179
F32 f32_RTD_Temperature_4
Definition: P013_49_V1_0_RTD.h:199
U16 u16_RTD_Status_4
Definition: P013_49_V1_0_RTD.h:194
TBlock_Output_Connector object_u16_RTD_Raw_Data_Channel_1
Definition: P013_49_V1_0_RTD.h:114
TBlock_Output_Connector object_u16_RTD_Raw_Data_Channel_2
Definition: P013_49_V1_0_RTD.h:115
TBlock_Output_Connector object_u16_RTD_Raw_Data_Channel_3
Definition: P013_49_V1_0_RTD.h:116
U16 u16_RTD_Status_3
Definition: P013_49_V1_0_RTD.h:193
volatile U32 u32_Dummy_Counter
Definition: P013_49_V1_0_RTD.h:201
U32 u32_RTD_Temperature_Read_Success_Count_3
Definition: P013_49_V1_0_RTD.h:183
BOOL RTD_Write(U16 u16_Command, U16 u16_Data)
Write register value.
Definition: P013_49_V1_0_RTD.cpp:555
~TP013_49_V1_0_RTD()
Destructor method.
Definition: P013_49_V1_0_RTD.cpp:348
BOOL Get_Temperature_Channel_4()
Definition: P013_49_V1_0_RTD.cpp:1137
U32 u32_RTD_Timeout_Error_Count
Definition: P013_49_V1_0_RTD.h:174
U16 u16_RTD_Status_2
Definition: P013_49_V1_0_RTD.h:192
BOOL RTD_Read(U16 u16_Command, U16 *u16_Data)
Read register value.
Definition: P013_49_V1_0_RTD.cpp:489
U32 u32_RTD_Temperature_Read_Success_Count_1
Definition: P013_49_V1_0_RTD.h:181
F32 f32_RTD_Temperature_1
Definition: P013_49_V1_0_RTD.h:196
BOOL Get_Temperature_Channel_1()
Definition: P013_49_V1_0_RTD.cpp:636
TBlock_Input_Connector object_f32_Temperature_Offset_Channel_3
Definition: P013_49_V1_0_RTD.h:109
TBlock_Input_Connector object_f32_Temperature_Offset_Channel_1
Definition: P013_49_V1_0_RTD.h:107
F32 f32_RTD_Temperature_2
Definition: P013_49_V1_0_RTD.h:197
TBlock_Output_Connector object_u16_RTD_Raw_Data_Channel_4
Definition: P013_49_V1_0_RTD.h:117
TBlock_Output_Connector object_f32_Temperature_Channel_1
Definition: P013_49_V1_0_RTD.h:119
U32 bool_RTD_Hardware_Fault_Channel_1
Definition: P013_49_V1_0_RTD.h:130
U32 u32_RTD_Temperature_Read_Success_Count_2
Definition: P013_49_V1_0_RTD.h:182
U32 bool_FPGA_Timeout_Fault_Channel_3
Definition: P013_49_V1_0_RTD.h:133
Definition: Protocol_Base.h:57
Definition: P013_49_V1_0_RTD.h:76
U16 u16_RTD_Data
Data register.
Definition: P013_49_V1_0_RTD.h:88
U16 u16_RTD_Status
Status register.
Definition: P013_49_V1_0_RTD.h:85
U16 u16_RTD_Control
Control register.
Definition: P013_49_V1_0_RTD.h:84