ConOpSys V2970  P004.07
ANVILEX control operating system
P017_41_KG3_RTD.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file P017_41_KG3_RTD.h
3 //! @brief KG3 RTD input board P017.41 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/P017_41_KG3_RTD/P017_41_KG3_RTD.h $
7 //! $Revision: 2457 $
8 //! $Date: 2021-03-11 11:54:01 +0500 (Do, 11 Mrz 2021) $
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 //------------------------------------------------------------------------------
65 //! @brief KG3 RTD P017.41 board class
66 //------------------------------------------------------------------------------
67 
69 {
70 
71  //----------------------------------------------------------------------------
72  // Public defines, methods and variables
73  //----------------------------------------------------------------------------
74 
75  public:
76 
77  //--------------------------------------------------------------------------
78  // Public type declarations
79  //--------------------------------------------------------------------------
80 
81  // Register structure for generic access
82  typedef struct
83  {
84 
85  // Unit identification registers
86  U16 u16_Unit_ID_L; //!< 0x00 : Module identification register
87  U16 u16_Unit_ID_H; //!< 0x01 : Module identification register
88 
89  union
90  {
91  U16 u16_RTD_Control; //!< 0x02 : Control register
92  U16 u16_RTD_Status; //!< 0x02 : Status register
93  };
94 
95  U16 u16_RTD_Data; //!< 0x03 : Data register
96 
98 
99  //--------------------------------------------------------------------------
100  // Public methods
101  //--------------------------------------------------------------------------
102 
103  // Constructor and destructor
104  TP017_41_KG3_RTD(); //!< Class constructor method
105  virtual ~TP017_41_KG3_RTD(); //!< Class destructor method
106 
107  VOID Map( TP017_41_KG3_RTD_Registers *struct_Registers_Base_Address );
108  virtual VOID Init(); //!< Functional block initialisation method
109  virtual VOID Execute(); //!< Functional block execution method
110  virtual VOID Send_Information( TProtocol_Base *object_Protocol ); //!< Send information method
111 
112  // Parameters
117 
122 
123 
124  // Outputs
129 
134 
135  union
136  {
138  struct
139  {
148  U32 :24;
150  };
151 
152  //----------------------------------------------------------------------------
153  // Protected defines, methods and variables
154  //----------------------------------------------------------------------------
155 
156  protected:
157 
158  //----------------------------------------------------------------------------
159  // Private defines, methods and variables
160  //----------------------------------------------------------------------------
161 
162  private:
163 
164  // Hardware communication related methods
165  BOOL RTD_Wait(); //!< Wait for RTD ready
166  BOOL RTD_Read( U16 u16_Command, U16 *u16_Data ); //!< Read register value
167  BOOL RTD_Write( U16 u16_Command, U16 u16_Data ); //!< Write register value
168 
169  // Channel configuration related methods
170  BOOL Configure_Channel( U16 u16_Command, U16 u16_Data ); //!< RTD chip configuration method
171 
172  // Temperature measurement related methods
177 
178  // Calculation related methods
179  F32 Calculate_Resistance( U16 u16_ADC_Value ); //!< Calculate resistance from ADC value
180 
181  // FPGA memory mapped registers
182  volatile TP017_41_KG3_RTD_Registers *struct_Registers; //!< FPGA memory mapped registers
183 
184  // Relability statistical data
186 
191 
196 
201 
206 
211 
212  volatile U32 u32_Dummy_Counter; //! ANVILEX: To remove
213 
214 };
215 
216 //------------------------------------------------------------------------------
217 // End of file
218 //------------------------------------------------------------------------------
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 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
KG3 RTD P017.41 board class.
Definition: P017_41_KG3_RTD.h:69
TBlock_Output_Connector object_f32_Temperature_Channel_3
Definition: P017_41_KG3_RTD.h:132
TBlock_Input_Connector object_f32_Temperature_Offset_Channel_4
Definition: P017_41_KG3_RTD.h:121
TBlock_Output_Connector object_f32_Temperature_Channel_1
Definition: P017_41_KG3_RTD.h:130
F32 f32_RTD_Temperature_4
Definition: P017_41_KG3_RTD.h:210
virtual ~TP017_41_KG3_RTD()
Class destructor method.
Definition: P017_41_KG3_RTD.cpp:314
BOOL RTD_Wait()
Wait for RTD ready.
Definition: P017_41_KG3_RTD.cpp:393
TBlock_Output_Connector object_u16_RTD_Raw_Data_Channel_3
Definition: P017_41_KG3_RTD.h:127
U32 u32_RTD_Hardware_Error_Count_1
Definition: P017_41_KG3_RTD.h:197
TBlock_Output_Connector object_u16_RTD_Raw_Data_Channel_1
Definition: P017_41_KG3_RTD.h:125
F32 f32_RTD_Temperature_3
Definition: P017_41_KG3_RTD.h:209
U32 u32_RTD_Temperature_Read_Count_3
Definition: P017_41_KG3_RTD.h:189
U32 u32_RTD_Temperature_Read_Count_4
Definition: P017_41_KG3_RTD.h:190
BOOL Get_Temperature_Channel_2()
Definition: P017_41_KG3_RTD.cpp:777
U16 u16_RTD_Status_1
Definition: P017_41_KG3_RTD.h:202
BOOL Get_Temperature_Channel_3()
Definition: P017_41_KG3_RTD.cpp:937
U32 bool_RTD_Hardware_Fault_Channel_1
Definition: P017_41_KG3_RTD.h:141
F32 Calculate_Resistance(U16 u16_ADC_Value)
Calculate resistance from ADC value.
Definition: P017_41_KG3_RTD.cpp:1268
TBlock_Input_Connector object_f32_Temperature_Offset_Channel_1
Definition: P017_41_KG3_RTD.h:118
TBlock_Input_Connector object_f32_Temperature_Gain_Channel_2
Definition: P017_41_KG3_RTD.h:114
TBlock_Input_Connector object_f32_Temperature_Offset_Channel_2
Definition: P017_41_KG3_RTD.h:119
U32 bool_FPGA_Timeout_Fault_Channel_3
Definition: P017_41_KG3_RTD.h:144
virtual VOID Execute()
Functional block execution method.
Definition: P017_41_KG3_RTD.cpp:378
U32 bool_RTD_Hardware_Fault_Channel_2
Definition: P017_41_KG3_RTD.h:143
U32 bool_RTD_Hardware_Fault_Channel_3
Definition: P017_41_KG3_RTD.h:145
TBlock_Output_Connector object_u16_RTD_Raw_Data_Channel_2
Definition: P017_41_KG3_RTD.h:126
TBlock_Input_Connector object_f32_Temperature_Gain_Channel_1
Definition: P017_41_KG3_RTD.h:113
struct TP017_41_KG3_RTD::@225::@229 u32_Status_Bits
U32 u32_RTD_Temperature_Read_Count_2
Definition: P017_41_KG3_RTD.h:188
TBlock_Input_Connector object_f32_Temperature_Gain_Channel_4
Definition: P017_41_KG3_RTD.h:116
U16 u16_RTD_Status_2
Definition: P017_41_KG3_RTD.h:203
TBlock_Output_Connector object_f32_Temperature_Channel_2
Definition: P017_41_KG3_RTD.h:131
U32 u32_RTD_Temperature_Read_Success_Count_4
Definition: P017_41_KG3_RTD.h:195
U32 u32_RTD_Temperature_Read_Count_1
Definition: P017_41_KG3_RTD.h:187
TBlock_Output_Connector object_u16_RTD_Raw_Data_Channel_4
Definition: P017_41_KG3_RTD.h:128
U32 bool_RTD_Hardware_Fault_Channel_4
Definition: P017_41_KG3_RTD.h:147
U32 u32_RTD_Timeout_Error_Count
Definition: P017_41_KG3_RTD.h:185
TP017_41_KG3_RTD()
Class constructor method.
Definition: P017_41_KG3_RTD.cpp:244
TBlock_Output_Connector object_f32_Temperature_Channel_4
Definition: P017_41_KG3_RTD.h:133
U32 bool_FPGA_Timeout_Fault_Channel_1
Definition: P017_41_KG3_RTD.h:140
BOOL Get_Temperature_Channel_1()
Definition: P017_41_KG3_RTD.cpp:596
F32 f32_RTD_Temperature_2
Definition: P017_41_KG3_RTD.h:208
U32 u32_RTD_Temperature_Read_Success_Count_1
Definition: P017_41_KG3_RTD.h:192
U32 u32_Status
Definition: P017_41_KG3_RTD.h:137
U32 u32_RTD_Hardware_Error_Count_2
Definition: P017_41_KG3_RTD.h:198
BOOL RTD_Read(U16 u16_Command, U16 *u16_Data)
Read register value.
Definition: P017_41_KG3_RTD.cpp:449
TBlock_Input_Connector object_f32_Temperature_Offset_Channel_3
Definition: P017_41_KG3_RTD.h:120
volatile TP017_41_KG3_RTD_Registers * struct_Registers
FPGA memory mapped registers.
Definition: P017_41_KG3_RTD.h:182
BOOL RTD_Write(U16 u16_Command, U16 u16_Data)
Write register value.
Definition: P017_41_KG3_RTD.cpp:515
VOID Map(TP017_41_KG3_RTD_Registers *struct_Registers_Base_Address)
Definition: P017_41_KG3_RTD.cpp:322
TBlock_Input_Connector object_f32_Temperature_Gain_Channel_3
Definition: P017_41_KG3_RTD.h:115
volatile U32 u32_Dummy_Counter
Definition: P017_41_KG3_RTD.h:212
BOOL Get_Temperature_Channel_4()
Definition: P017_41_KG3_RTD.cpp:1097
U32 bool_FPGA_Timeout_Fault_Channel_2
Definition: P017_41_KG3_RTD.h:142
U32 u32_RTD_Hardware_Error_Count_4
Definition: P017_41_KG3_RTD.h:200
U32 bool_FPGA_Timeout_Fault_Channel_4
Definition: P017_41_KG3_RTD.h:146
U16 u16_RTD_Status_4
Definition: P017_41_KG3_RTD.h:205
U16 u16_RTD_Status_3
Definition: P017_41_KG3_RTD.h:204
U32 u32_RTD_Temperature_Read_Success_Count_3
Definition: P017_41_KG3_RTD.h:194
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send information method.
Definition: P017_41_KG3_RTD.cpp:1283
U32 u32_RTD_Temperature_Read_Success_Count_2
Definition: P017_41_KG3_RTD.h:193
virtual VOID Init()
Functional block initialisation method.
Definition: P017_41_KG3_RTD.cpp:333
F32 f32_RTD_Temperature_1
Definition: P017_41_KG3_RTD.h:207
BOOL Configure_Channel(U16 u16_Command, U16 u16_Data)
RTD chip configuration method.
Definition: P017_41_KG3_RTD.cpp:557
U32 u32_RTD_Hardware_Error_Count_3
Definition: P017_41_KG3_RTD.h:199
Definition: Protocol_Base.h:57
Definition: P017_41_KG3_RTD.h:83
U16 u16_Unit_ID_L
0x00 : Module identification register
Definition: P017_41_KG3_RTD.h:86
U16 u16_Unit_ID_H
0x01 : Module identification register
Definition: P017_41_KG3_RTD.h:87
U16 u16_RTD_Data
0x03 : Data register
Definition: P017_41_KG3_RTD.h:95
U16 u16_RTD_Control
0x02 : Control register
Definition: P017_41_KG3_RTD.h:91
U16 u16_RTD_Status
0x02 : Status register
Definition: P017_41_KG3_RTD.h:92