IoDrvModbusTCPSlave.Enable (PROP) ¶ PROPERTY Enable : BOOL
IoDrvModbusTCPSlave.UpdateCommunicationSettings (METH) ¶ METHOD UpdateCommunicationSettings : DINT Change the TCP-Port number. Existing TCP Connection will be aborted InOut: Scope Name Type Initial Comment Return UpdateCommunicationSettings DINT Input uiPortNr UINT 502 TCP-Port Number used by Modbus Server
IoDrvModbusTCP_Diag.GetBusScanAsync (METH) ¶ METHOD GetBusScanAsync : DED.PROC_STATE Returns the bus scan of the current node InOut: Scope Name Type Comment Return GetBusScanAsync DED.PROC_STATE Input eCmd DED.PROC_CMD eCommand Output itfFirstDevice DED.INode First node of scanned device list eError DED.ERROR
IoDrvModbusTCP_Diag.GetLogger (METH) ¶ METHOD GetLogger : DED.ILogger InOut: Scope Name Type Return GetLogger DED.ILogger Output eError DED.ERROR
ModbusChannel (FB) ¶ FUNCTION_BLOCK ModbusChannel Starts the execution of a single configured modbus channel. InOut: Scope Name Type Initial Comment Inout slave ModbusTCPSlaveBase Input xExecute BOOL Rising edge: Action start Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or aborted (xAbort), or in the event of an error. In this case, the corresponding output values (xDone, xError, iError) are present at the outputs for exactly one cycle. xAbort BOOL If this input is TRUE, the action is stopped immediately and all outputs are reset to their initial values. iChannelIndex INT The Channel Index that shall be executed. An invalid index results in xError = TRUE (without any Modbus specific error code). Output xBusy BOOL Is TRUE as long as a request is in progress xDone BOOL Is TRUE if a request finished successfully xError BOOL Is TRUE if a request finished unsuccessfully xAborted BOOL Is TRUE after a request in progress has been aborted by “xAbort” ModbusError MB_ErrorCodes MB_ErrorCodes.UNDEFINED Specifies the current error as defined in the “MB_ErrorCodes” enumeration
ModbusCommand (STRUCT) ¶ TYPE ModbusCommand : STRUCT InOut: Name Type Initial FunctionCode IoDrvModbusBase.MBFunctionCode uiReadOffset UINT 0 uiReadLen UINT 1 uiWriteOffset UINT 0 uiWriteLen UINT 1
ModbusRequest (FB) ¶ FUNCTION_BLOCK ModbusRequest In addition to the predefined Modbus commands defined in the tab Modbus Slave Channel, this function block allows to execute dynamically additional commands in the application. For this programmatically created commands CODESYS does not provide an I/O mapping but input/output data ranges of type ARRAY OF BYTE or ARRAY OF WORD. InOut: Scope Name Type Initial Comment Inout slave ModbusTCPSlave Input xExecute BOOL Rising edge: Action start Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or aborted (xAbort), or in the event of an error. In this case, the corresponding output values (xDone, xError, iError) are present at the outputs for exactly one cycle. xAbort BOOL If this input is TRUE, the action is stopped immediately and all outputs are reset to their initial values. usiUnitID USINT 16#FF This field is used for routing purpose when addressing a MODBUS serial line sub-network. On TCP/IP, the MODBUS server is addressed using its IP address, the MODBUS Unit Identifier is useless (value 0xFF has to be used). On serial line, Modbus devcies are adressed with Uint-IDs from 1 to 247, 0 is used as broadcast address. ModbusCommand ModbusCommand The Modbus Command to be executed. Supports FCs for bit and word access pSendData POINTER TO BYTE Pointer to a buffer holding the data to be send to the Slave For Register access the buffer is of type ARRAY[0..ModbusCommand.uiWriteLen - 1] OF WORD. For Bit access the buffer is of type ARRAY[0..ModbusCommand.uiWriteLen / 8] OF BYTE pRecvData POINTER TO BYTE Pointer to a buffer for writing the data received from a Slave For Register access the buffer is of type ARRAY[0..ModbusCommand.uiReadLen - 1] OF WORD. For Bit access the buffer is of type ARRAY[0..ModbusCommand.uiReadLen / 8] OF BYTE Output xBusy BOOL Is TRUE as long as a request is in progress xDone BOOL Is TRUE if a request finished successfully xError BOOL Is TRUE if a request finished unsuccessfully xAborted BOOL Is TRUE after a request in progress has been aborted by “xAbort” ModbusError MB_ErrorCodes MB_ErrorCodes.UNDEFINED Specifies the current error as defined in the “MB_ErrorCodes” enumeration
ModbusTCPComSettings (STRUCT) ¶ TYPE ModbusTCPComSettings : STRUCT InOut: Name Type ipAddress ARRAY [0..3] OF BYTE uiPort UINT xEnableFallback BOOL FirstAddress ARRAY [0..3] OF BYTE SecondAddress ARRAY [0..3] OF BYTE
ModbusTCPComState (ENUM) ¶ TYPE ModbusTCPComState : Attributes: qualified_only InOut: Name Initial Comment OFF 0 no action performed on socket, e.g. if slave is disabled. CONNECTING 1 TCP connect request is currently running CONNECTED 2 TCP connection is established DISCONNECTING 3 TCP connection is aborted (by application) SOCKET_ERROR 4 a TCP socket error occured, e.g. if read/write failed due to a disconnected cable etc.
ModbusTCPSlave (FB) ¶ FUNCTION_BLOCK ModbusTCPSlave EXTENDS ModbusTCPSlaveBase InOut: Scope Name Type Initial Comment Output xInitDone BOOL FALSE xBusy BOOL FALSE Is TRUE as long as a request is in progress xDone BOOL FALSE Is TRUE if a request finished successfully xError BOOL FALSE Is TRUE if a request finished unsuccessfully byModbusError MB_ErrorCodes MB_ErrorCodes.UNDEFINED Specifies the current error as defined in the “MB_ErrorCodes” enumeration ComSettings ModbusTCPComSettings ComState ModbusTCPComState ModbusTCPComState.OFF iChannelIndex INT -1 Input xConfirmError BOOL FALSE continue processing at rising edge xDoInit BOOL TRUE If true then xConfirmError also sends all reset init commands, false (old behaviour) Methods: UpdateCommunicationSettings Structure: UpdateCommunicationSettings (Method)