Skip to content

Mb client

MB_CLIENT (OPEN MODBUS)

Type Function module
IN_OUT IP_C IP_C (parameterization)
S_BUF NETWORK_BUFFER_SHORT (transmit data)
R_BUF NETWORK_BUFFER_SHORT (receive data)
DATA ARRAY [0..255] OF WORD (MODBUS Register)
INPUT DATA_SIZE INT (number of data words in structure MB_DATA)
ENABLE BOOL (release)
UDP BOOL (Prefix TCP / UDP, UDP = TRUE )
FC INT (function number)
UNIT_ID BYTE (Device ID)
R_ADDR INT (Read command: MODBUS data point address)
R_POINTS INT (Read command: MODBUS number of data points)
R_DATA_ADR INT (Read command: DATA data point address)
R_DATA_BITPOS INT (read command: DATA data point bitpos.)
W_ADDR INT (Read command: MODBUS data point address)
W_POINTS INT (Read command: MODBUS number of data points)
W_DATA_ADR INT (Read command: DATA data point address)
W_DATA_BITPOS INT (read command: DATA data point bit pos.)
DELAY TIME (repetition time)
OUTPUT ERROR DWORD (error code)
BUSY BOOL (module is active)
The module provides access to Ethernet devices, the MODBUS TCP or MODBUS UDP supported, or MODBUS RS232/485 devices are connected via Ethernet Modbus gateway. There commands from Classes 0,1,2 are supported. The parameters IP_C, S_BUF, R_BUF this form the interface to the module IP_CONTROL and used here for processing and coordination. The desired IP address and port number (for MODBUS default is 502) must be specified on IP_CONTROL centrally. The DATA structure is designed as a WORD array and contains the MODBUS data for reading and writing. The size of the WORD_ARRAY is given by DATA_SIZE. By ENABLE, the module is released, and by remove of the release a possibly still active query is ended. For devices that support MODBUS with UDP = TRUE this mode can be activated. The parameter UNIT_ID must only at use of Ethernet Modbus provided. The desired function is specified by FC (see function code table). Depending on the function, the R_xxx and W_xxx parameters has to be supplied with data. By specifying the DELAY the repetition time can be specified. If not specify the time an attempt is made as often as possible to execute the command. The integrated access management automatically guarantees to get the other module instances also to the series. A negative command execution is reported by ERROR (see ERROR-table). If the module actively performs a query, then BUSY = TRUE will be passed during this time.
Supported function codes and parameters used
ERROR

mb_client

Function Code Bit Access 16 Bit Access (Register) Group Function Description R_ADDR R_POINTS R_DATA_ADR R_DATA_BITPOS W_ADDR W_POINTS W_DATA_ADR W_DATA_BITPOS
1 x Coils Read Coils x x x x
2 x Input Discrete Read Discrete Inputs x x x x
3 x Holding Register Read Holding Registers x x x
4 x Input Register Read Input Register x x
5 x Coils Write Single Coil x x x
6 x Holding Register Write Single Register x x
15 x Coils Write Multiple Coils x x x x
16 x Holding Register Write Multiple Register x x x
22 x Holding Register Mask Write Register x x
23 x Holding Register Read/Write Multiple Register x x x x x x
Value Source Description
B3 B2 B1
nn nn nn
xx xx xx
xx xx xx
xx xx xx
xx xx xx
xx xx xx
xx xx xx
xx xx xx
xx xx xx
xx xx xx
xx xx xx