ModbusServer (FB) ¶ FUNCTION_BLOCK ModbusServer InOut: Scope Name Type Initial Comment Input byUnitID BYTE wPort: WORD:= 502; // Modbus server port - 502 is Modbus default comPortSettings ComSettings Comport Settings pInputData POINTER TO WORD Input Registers pOutputData POINTER TO WORD Holding Registers uiInputDataSize UINT Size in words of Input Register data area uiOutputDataSize UINT Size in words of Holding Register data area xEnable BOOL FALSE Flag to enable execution - default is FALSE xReset BOOL FALSE Flag to reset - default is FALSE tTimeout UDINT 0 Modbus Write timeout, resets outputs if passed EOFDetectionTimeout UDINT 0 Timeout for end of frame detection (in micro-seconds!), if not set the default of (3.5 char times is used) Output xError BOOL FALSE Properties: IsComPortValid Structure: IsComPortValid (Property)
ModbusServer.IsComPortValid (PROP) ¶ PROPERTY IsComPortValid : BOOL
ModbusSerialMaster.DoModbusRequests (METH) ¶ METHOD DoModbusRequests InOut: Scope Name Type Input bIsStartCycle BOOL
ModbusSerialPort (FB) ¶ FUNCTION_BLOCK ModbusSerialPort InOut: Scope Name Type Initial Output usiLinkNumber USINT 1
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