User manual
Modbus server (MBTCP)
10
5. Modbus server (MBTCP)
For each of the ipCore's serial ports - including the two USB hosts - an instance of the
Modbus TCP server (MBTCP) can be launched. The server manages access to the devices
that are attached to its related serial port. It configures the hardware, queques requests
and finally submits the results to their originators.
MBTCP provides a standard Modbus TCP and an ASCII connection for debugging and
simple programs that do not need the Modbus TCP stack. The user is free to use either.
The configuration file is located in "/etc/mbtcp.conf". It contains all the vital information
for the MBTCP servers and clients. By default, there are three sections: RS485, USB1 and
USB2. Parameters used for LEM and the Modbus servers are stored as simple key-value
pairs with an equals sign as delimiter between key and value. A sections begins with its
name in square brackets and ends with the start of the next section or the end of file. The
following except makes this more clear.
[USB1]
dev=/dev/USB1
mode=ascii
tcp_port=12346
ascii_port=33334
host=localhost
timeout=100
[RS485]
...
Table5.1, “MBTCP configuration” describes the config items, their use and default values.
Some items from this configuration are also used by the LUA machine (LEM).
Item MBTCP LEM Default
value
Description
dev yes no The device file used as Modbus connection
baud_rate yes no 9600 Selects connection speed
data_bits yes no 8 Bits used per character
parity yes no even Method user for parity checking
stop_bits yes no 1 Number of stop bits per character
media yes no rs485 Selects between RS232 and RS485 handling
mode yes no rtu Modbus mode on serial line (rtu or ascii)
timeout yes no 1000 Max. time in ms used for packet reception
host no yes Host to connect to
bind yes no 0.0.0.0 Interface for listening
max_conn yes no 16 Max. number of open connections handled by
server
tcp_port yes no Port used for Modbus TCP
ascii_port yes yes Port used for Modbus ASCII protocol over TCP
Table5.1.MBTCP configuration