ConOpSys V2970
P004.07
ANVILEX control operating system
|
MODBUS generic PDU base class. More...
#include <MODBUS_PDU.h>
Public Member Functions | |
TMODBUS_PDU_Base () | |
Class constructor method. More... | |
virtual | ~TMODBUS_PDU_Base () |
Class destructor method. More... | |
BOOL | Is_Empty () |
Returns PDU buffer empty status. More... | |
U32 | Get_Size () |
Returns PDU buffer size. More... | |
U32 | Get_Index () |
Returns actual PDU buffer index. More... | |
VOID | Set_Index (U32 u32_New_Index) |
Set PDU buffer index. More... | |
U8 * | Get_Buffer_Pointer () |
Returns pointer to PDU buffer. More... | |
VOID | Init () |
PDU initialisation method. More... | |
VOID | Init (U8 u8_Slave_Address) |
PDU initialisation with specifird slave address. More... | |
virtual BOOL | Done ()=0 |
PDU finalization method. More... | |
VOID | Set_Slave_Address (U8 u8_Slave_Address) |
Set slave address. More... | |
U8 | Get_Slave_Address () |
Returns actual slave address. More... | |
VOID | Set_Function_Code (U8 u8_Function_Code) |
Set function code method. More... | |
U8 | Get_Function_Code () |
Get function code method. More... | |
U8 | Read_U8_Value () |
Read U8 value at actual address method. More... | |
U8 | Read_U8_Value (U32 u32_Address) |
Read U8 value at specifird address method. More... | |
VOID | Append_U8_Value (U8 u8_Value) |
Append U8 value at the buffer end method. More... | |
U16 | Read_U16_Value () |
Read U16 value at specifird address method. More... | |
U16 | Read_U16_Value (U32 u32_Address) |
Read U16 value at specifird address method. More... | |
VOID | Append_U16_Value (U16 u16_Value) |
Append U16 value at the buffer end method. More... | |
U32 | Read_U32_Value () |
Read U32 value at specifird address method. More... | |
U32 | Read_U32_Value (U32 u32_Address) |
Read U32 value at specifird address method. More... | |
VOID | Append_U32_Value (U32 u32_Value) |
Append U32 value at the buffer end method. More... | |
F32 | Read_F32_Value () |
Read F32 value at specifird address method. More... | |
F32 | Read_F32_Value (U32 u32_Address) |
Read F32 value at specifird address method. More... | |
VOID | Append_F32_Value (F32 f32_Value) |
Append F32 value at the buffer end method. More... | |
U16 | Get_CRC () |
Get cyclic redundancy check method. More... | |
BOOL | Is_Overrun () |
Return PDU overrun status method. More... | |
BOOL | Is_Size_Valid () |
Return PDU size valid status method. More... | |
Public Attributes | |
U16 | u16_Received_CRC = (U16)0x0000 |
PDU received CRC. More... | |
Protected Attributes | |
U8 | u8_Buffer [MODBUS_PDU_BUFFER_SIZE] = { (U8)0x00 } |
PDU buffer data field. More... | |
U32 | u32_PDU_Size = (U32)0 |
PDU buffer size in byte. More... | |
U32 | u32_PDU_Index = (U32)0 |
PDU buffer index. More... | |
U16 | u16_PDU_CRC = (U32)0x0000 |
PDU buffer CRC. More... | |
MODBUS generic PDU base class.
TMODBUS_PDU_Base::TMODBUS_PDU_Base | ( | ) |
Class constructor method.
|
virtual |
Class destructor method.
Append F32 value at the buffer end method.
[in] | f32_Value | - Append velue |
References Extract_U8_From_F32(), Increment_Saturated(), MODBUS_PDU_BUFFER_SIZE, u32_PDU_Index, u32_PDU_Size, and u8_Buffer.
Referenced by TProtocol_MODBUS_Over_UART::Read_Holding_Registers(), and TProtocol_MODBUS_Over_UART::Read_Input_Register().
Append U16 value at the buffer end method.
[in] | u16_Value | - Append velue |
References Extract_U8_From_U16(), Increment_Saturated(), MODBUS_PDU_BUFFER_SIZE, u32_PDU_Index, u32_PDU_Size, and u8_Buffer.
Referenced by TProtocol_MODBUS_Over_UART::Get_Communication_Event_Counter(), TProtocol_MODBUS_Over_UART::Get_Communication_Event_Log(), TProtocol_MODBUS_Over_UART::Read_Holding_Registers(), TProtocol_MODBUS_Over_UART::Read_Input_Register(), TProtocol_MODBUS_Over_UART::Write_Multiple_Registers(), and TProtocol_MODBUS_Over_UART::Write_Single_Coil().
Append U32 value at the buffer end method.
[in] | u32_Value | - Append velue |
References Extract_U8_From_U32(), Increment_Saturated(), MODBUS_PDU_BUFFER_SIZE, u32_PDU_Index, u32_PDU_Size, and u8_Buffer.
Referenced by TProtocol_MODBUS_Over_UART::Read_Holding_Registers(), and TProtocol_MODBUS_Over_UART::Read_Input_Register().
Append U8 value at the buffer end method.
[in] | u8_Value | - Append velue |
References Increment_Saturated(), MODBUS_PDU_BUFFER_SIZE, u32_PDU_Index, u32_PDU_Size, and u8_Buffer.
Referenced by TProtocol_MODBUS_Over_UART::Communication_Data_Receive(), TProtocol_MODBUS_Over_UART::Get_Communication_Event_Log(), TProtocol_MODBUS_Over_UART::Read_Coils(), TProtocol_MODBUS_Over_UART::Read_Discrete_Inputs(), TProtocol_MODBUS_Over_UART::Read_Holding_Registers(), TProtocol_MODBUS_Over_UART::Read_Input_Register(), and TProtocol_MODBUS_Over_UART::Write_Single_Coil().
|
pure virtual |
PDU finalization method.
Implemented in TMODBUS_Response_PDU, and TMODBUS_Request_PDU.
U8 * TMODBUS_PDU_Base::Get_Buffer_Pointer | ( | ) |
Returns pointer to PDU buffer.
References u8_Buffer.
Referenced by TProtocol_MODBUS_Over_UART::Execute(), and TProtocol_MODBUS_Over_UART::Send_Information().
U16 TMODBUS_PDU_Base::Get_CRC | ( | ) |
Get cyclic redundancy check method.
References u16_PDU_CRC.
Referenced by TProtocol_MODBUS_Over_UART::Send_Information().
U8 TMODBUS_PDU_Base::Get_Function_Code | ( | ) |
Get function code method.
References u8_Buffer.
Referenced by TProtocol_MODBUS_Over_UART::Execute(), and TProtocol_MODBUS_Over_UART::Send_Information().
U32 TMODBUS_PDU_Base::Get_Index | ( | ) |
Returns actual PDU buffer index.
References u32_PDU_Index.
U32 TMODBUS_PDU_Base::Get_Size | ( | ) |
Returns PDU buffer size.
References u32_PDU_Size.
Referenced by TProtocol_MODBUS_Over_UART::Execute(), and TProtocol_MODBUS_Over_UART::Send_Information().
U8 TMODBUS_PDU_Base::Get_Slave_Address | ( | ) |
Returns actual slave address.
References u8_Buffer.
Referenced by TProtocol_MODBUS_Over_UART::Send_Information().
VOID TMODBUS_PDU_Base::Init | ( | ) |
PDU initialisation method.
References MODBUS_PDU_BUFFER_SIZE, u32_PDU_Index, u32_PDU_Size, and u8_Buffer.
Referenced by TProtocol_MODBUS_Over_UART::Execute(), TProtocol_MODBUS_Over_UART::Execute_1ms(), Init(), and TMODBUS_Response_PDU::Init().
PDU initialisation with specifird slave address.
[in] | u8_Slave_Address | - New slave address |
References Init(), Set_Slave_Address(), u32_PDU_Index, and u32_PDU_Size.
BOOL TMODBUS_PDU_Base::Is_Empty | ( | ) |
Returns PDU buffer empty status.
false | - PDU buffer is not empty |
true | - PDU buffer is empty |
References u32_PDU_Size.
Referenced by TProtocol_MODBUS_Over_UART::Execute_1ms().
BOOL TMODBUS_PDU_Base::Is_Overrun | ( | ) |
Return PDU overrun status method.
false | - PDU is not overrun |
true | - PDU is overrun |
References MODBUS_PDU_BUFFER_SIZE, and u32_PDU_Size.
Referenced by TProtocol_MODBUS_Over_UART::Execute_1ms().
BOOL TMODBUS_PDU_Base::Is_Size_Valid | ( | ) |
Return PDU size valid status method.
false | - PDU size invalid |
true | - PDU size valid |
References u32_PDU_Size.
Referenced by TProtocol_MODBUS_Over_UART::Execute().
F32 TMODBUS_PDU_Base::Read_F32_Value | ( | ) |
Read F32 value at specifird address method.
References Compose_F32(), Increment_Saturated(), MODBUS_PDU_BUFFER_SIZE, u32_PDU_Index, and u8_Buffer.
Referenced by Read_F32_Value().
Read F32 value at specifird address method.
[in] | u32_Address | - Address for reading |
References Read_F32_Value(), and u32_PDU_Index.
U16 TMODBUS_PDU_Base::Read_U16_Value | ( | ) |
Read U16 value at specifird address method.
References Compose_U16(), Increment_Saturated(), MODBUS_PDU_BUFFER_SIZE, u32_PDU_Index, and u8_Buffer.
Referenced by TProtocol_MODBUS_Over_UART::Read_Coils(), TProtocol_MODBUS_Over_UART::Read_Discrete_Inputs(), TProtocol_MODBUS_Over_UART::Read_Holding_Registers(), TProtocol_MODBUS_Over_UART::Read_Input_Register(), Read_U16_Value(), TProtocol_MODBUS_Over_UART::Read_Write_Multiple_Registers(), TProtocol_MODBUS_Over_UART::Write_Multiple_Coils(), TProtocol_MODBUS_Over_UART::Write_Multiple_Registers(), and TProtocol_MODBUS_Over_UART::Write_Single_Coil().
Read U16 value at specifird address method.
[in] | u32_Address | - Address for reading |
References Read_U16_Value(), and u32_PDU_Index.
U32 TMODBUS_PDU_Base::Read_U32_Value | ( | ) |
Read U32 value at specifird address method.
References Compose_U32(), Increment_Saturated(), MODBUS_PDU_BUFFER_SIZE, u32_PDU_Index, and u8_Buffer.
Referenced by Read_U32_Value(), and TProtocol_MODBUS_Over_UART::Write_Multiple_Registers().
Read U32 value at specifird address method.
[in] | u32_Address | - Address for reading |
References Read_U32_Value(), and u32_PDU_Index.
U8 TMODBUS_PDU_Base::Read_U8_Value | ( | ) |
Read U8 value at actual address method.
References Increment_Saturated(), MODBUS_PDU_BUFFER_SIZE, u32_PDU_Index, and u8_Buffer.
Referenced by TProtocol_MODBUS_Over_UART::Encapsulated_Interface_Transport(), Read_U8_Value(), TProtocol_MODBUS_Over_UART::Read_Write_Multiple_Registers(), TProtocol_MODBUS_Over_UART::Write_Multiple_Coils(), and TProtocol_MODBUS_Over_UART::Write_Multiple_Registers().
Read U8 value at specifird address method.
[in] | u32_Address | - Address for reading |
References Read_U8_Value(), and u32_PDU_Index.
Set function code method.
[in] | u8_Function_Code | - Function code |
References u8_Buffer.
Set PDU buffer index.
[in] | u32_New_Index | - New PDU buffer index |
References u32_PDU_Index.
Referenced by TProtocol_MODBUS_Over_UART::Execute().
PDU buffer CRC.
Referenced by TMODBUS_Response_PDU::Done(), Get_CRC(), and TMODBUS_Request_PDU::Is_CRC_Valid().
PDU received CRC.
Referenced by TMODBUS_Request_PDU::Is_CRC_Valid(), and TProtocol_MODBUS_Over_UART::Send_Information().
PDU buffer index.
Referenced by Append_F32_Value(), Append_U16_Value(), Append_U32_Value(), Append_U8_Value(), TMODBUS_Response_PDU::Done(), Get_Index(), Init(), TMODBUS_Response_PDU::Init(), Read_F32_Value(), Read_U16_Value(), Read_U32_Value(), Read_U8_Value(), Set_Index(), TMODBUS_Response_PDU::Write_F32_Value(), TMODBUS_Response_PDU::Write_U16_Value(), TMODBUS_Response_PDU::Write_U32_Value(), and TMODBUS_Response_PDU::Write_U8_Value().
PDU buffer size in byte.
Referenced by Append_F32_Value(), Append_U16_Value(), Append_U32_Value(), Append_U8_Value(), TMODBUS_Response_PDU::Done(), Get_Size(), Init(), TMODBUS_Response_PDU::Init(), TMODBUS_Request_PDU::Is_Broadcast(), TMODBUS_Request_PDU::Is_CRC_Valid(), Is_Empty(), Is_Overrun(), Is_Size_Valid(), TMODBUS_Request_PDU::Is_Slave_Address_Valid(), TMODBUS_Response_PDU::Write_F32_Value(), TMODBUS_Response_PDU::Write_U16_Value(), TMODBUS_Response_PDU::Write_U32_Value(), and TMODBUS_Response_PDU::Write_U8_Value().
|
protected |
PDU buffer data field.
Referenced by Append_F32_Value(), Append_U16_Value(), Append_U32_Value(), Append_U8_Value(), TMODBUS_Response_PDU::Done(), Get_Buffer_Pointer(), Get_Function_Code(), Get_Slave_Address(), Init(), TMODBUS_Response_PDU::Init(), TMODBUS_Request_PDU::Is_Broadcast(), TMODBUS_Request_PDU::Is_CRC_Valid(), TMODBUS_Request_PDU::Is_Slave_Address_Valid(), Read_F32_Value(), Read_U16_Value(), Read_U32_Value(), Read_U8_Value(), Set_Function_Code(), Set_Slave_Address(), TMODBUS_Request_PDU::Test_Data(), TMODBUS_Response_PDU::Write_U16_Value(), TMODBUS_Response_PDU::Write_U32_Value(), and TMODBUS_Response_PDU::Write_U8_Value().