ModbusSerialSlave (FB) ¶ FUNCTION_BLOCK ModbusSerialSlave EXTENDS IoDrvModbusBase.ModbusSerialSlaveBase InOut: Scope Name Type Initial Comment Output byCommError BYTE 0 Specifies the current error as defined in the “MB_CommCode_M238” enumeration dwOperError DWORD 0 Specifies the current error as defined in the “MB_OpCode_M238” enumeration
Structs ¶ MBChannel_HighMem (Struct) MBMasterParameter (Struct) MBPortParameter (Struct) MBRegister (Struct) MBSlaveParameter (Struct) MB_CommCode_M238 (Enum) MB_OpCode_M238 (Enum) ModbusCommand (Struct) PARAM_ACCESS (Enum) PARAM_MEDIUM (Enum) PARAM_PARITY (Enum) PARAM_TRANSMISSION (Enum) PARAM_TRIGGER (Enum)
MBChannel_HighMem (STRUCT) ¶ TYPE MBChannel_HighMem : STRUCT This STRUCT matches the data structure that gets read from the config file. As it contains unimportant information like name and comment, it is just used as a single temporary storage before the data gets converted to the leaner version MBChannel InOut: Name Type Initial Comment tCycleTime TIME TIME#100ms Inteval in which the channel is triggered (in case of CYCLIC) uiReadOffset UINT 16#0 First Modbus register to read uiReadLength UINT 1 Number of subsequent register to read, in HEX uiWriteOffset UINT 16#0 First Modbus register to write, in HEX uiWriteLength UINT 1 Number of subsequent register to write stName STRING ‘0123456789’ Name for the particular channel stAccess STRING ‘READWRITE’ READ (FC 0x03), WRITE (FC 0x10) or READWRITE (FC 0x17) stTrigger STRING ‘CYCLIC’ CYCLIC or RISING_EDGE stChannelComment STRING ‘EMPTY’ Channel commment editable by user stKeepLastValue STRING ‘TRUE’
MBMasterParameter (STRUCT) ¶ TYPE MBMasterParameter : STRUCT InOut: Name Type Initial Comment usiTransmission USINT RTU:=0, ASCII:=1 tResponseTimeout TIME Time, in which a Slave has to reply (max 65535ms) tTimeBetweenFrames TIME Delay between Modbus requests (max 65535ms) dwSerialLineNumber DWORD 1 Either 1 or 2
MBPortParameter (STRUCT) ¶ TYPE MBPortParameter : STRUCT InOut: Name Type Initial Comment diBaudrate DINT 19200 1200, 2400, 4800, …, 115000 bps usiMedium USINT 0 RS232:=0, RS485:=1 or ETH:=2 usiParity USINT 0 EVEN:=0, ODD:=1 or NONE:=2 usiDataBits USINT 8 Number of Data Bits usiStopBits USINT 1 Number of Stop Bits xPolarization BOOL FALSE Polarization and Termination Resistors
MBRegister (STRUCT) ¶ TYPE MBRegister : STRUCT InOut: Name Type Initial Comment uiRegister UINT 0 Address offset
MBSlaveParameter (STRUCT) ¶ TYPE MBSlaveParameter : STRUCT InOut: Name Type Initial Comment usiSlaveAddress USINT 1 Slave address in the range between 1 and 247 tSlaveTimeout TIME TIME#1s0ms Time for this Slave to respond. Overrides the Master’s setting, (max 65535ms) dwInstance POINTER TO ModbusSerialSlave 16#0 Stores the instance pointer to this Slave iErrorCounter INT -1 Stores the number of subsequent errors. If Slave never got polled, it is -1
MB_CommCode_M238 (ENUM) ¶ TYPE MB_CommCode_M238 : InOut: Name Initial Comment CommunicationOK 16#0 Exchange is correct TimedOut 16#1 Exchange stopped because timeout expired Canceled 16#2 Exchange stopped on user request (CANCEL) BadAddress 16#3 Address format is incorrect BadRemoteAddr 16#4 Remote address is incorrect BadMgtTable 16#5 Management table format is incorrect BadParameters 16#6 Specific parameters are incorrect ProblemSendingRq 16#7 Problem sending request to destination RecvBufferTooSmall 16#9 Reception buffer size is too small SendBufferTooSmall 16#A Transmission buffer size is too small SystemResourceMissing 16#B System resource is missing BadTransactionNb 16#C Transaction number is incorrect BadLength 16#E Length is incorrect ProtocolSpecificError 16#FE The operation error code contains protocol specific code Refused 16#FF Message has been refused
MB_OpCode_M238 (ENUM) ¶ TYPE MB_OpCode_M238 : InOut: Name Initial Comment OperationOK 16#0 Exchange is correct NotProcessed 16#1 Request has not been processed BadResponse 16#2 Received response is incorrect TargetResourceMissing 16#1 Target system resource is missing BadLength 16#5 Length is incorrect CommChannelErr 16#6 Communication channel is in error BadAddr 16#7 Address is incorrect SystemResourceMissing 16#B System resource is missing TargetCommInactive 16#C Target comm function is not active TargetMissing 16#D Target is absent ChannelNotConfigured 16#F Channel not configured
ModbusCommand (STRUCT) ¶ TYPE ModbusCommand : STRUCT InOut: Name Type Initial uiFunctionCode UINT 3 uiReadOffset UINT 0 uiReadLen UINT 1 uiWriteOffset UINT 0 uiWriteLen UINT 1