modbus_srvr_serial
Purpose:
Initialize and run a Modbus server for serial communication with slave devices, managing configuration, shared memory allocation, and spawning streaming tasks.
Enter:
-
modbus_srvr_serial <priority> [device_parameters] [ais] [dis] [dos] [de] [aid] [aod] [did] [dod] [noerr]
Where:
-
priority
Specify the priority level of the task.
device_parameters
Optional. Specify one or more strings containing serial device information, such as device path, baud rate, data bits, stop bits, parity, and endianness (e.g., /dev/tty0:9600:8:1:0:l).
ais
Optional. Specify this option to read all of the input and holding registers one at a time. See Notes for additional details.
dis
Optional. Specify this option to read all of the coil and discrete registers one at a time. See Notes for additional details.
dos Optional. Specify this option to write all of the coil registers one at a time. See Notes for additional details.
de
Optional. Specify this option to produce general debug information.
aid
Optional. Specify this option to produce AI debug information.
aod
Optional. Specify this option to produce AO debug information.
did
Optional. Specify this option to produce DI debug information.
dod
Optional. Specify this option to produce DO debug information.
noerr
Optional. Specify this option to prevent certain errors rom triggering restarts.
Example:
-
modbus_srvr_serial 24 /dev/tty0:9600:8:1:0:l &
The preceding communicates with the /dev/tty0 device, with a 9600 Baudrate, 8 databits, 1 stop bit, no parity, and is little endian.
modbus_srvr_serial 24 /dev/tty0:9600:8:1:0:l /dev/ttyS1:19200:7:1:1:b &
The preceding communicates with 2 interfaces. The first interface is /dev/tty0 device, with a 9600 Baudrate, 8 databits, 1 stop bit, no parity, and is little endian. The second interface is /dev/tty0 device, with a 19200 Baudrate, 7 databits, 1 stop bit, parity, and is big endian.
-
modbus_srvr_serial 24 /dev/tty0:9600:8:1:0:l /dev/ttyS1:19200:7:1:1:b dis ais &
The preceding communicates with 2 interfaces. The first interface is /dev/tty0 device, with a 9600 Baudrate, 8 databits, 1 stop bit, no parity, and is little endian. The second interface is /dev/tty0 device, with a 19200 Baudrate, 7 databits, 1 stop bit, parity, and is big endian. The task will read all registers one at a time.
-
modbus_srvr_serial 24 /dev/tty0:9600:8:1:0:l /dev/ttyS1:19200:7:1:1:b noerr &
The preceding communicates with 2 interfaces. The first interface is /dev/tty0 device, with a 9600 Baudrate, 8 databits, 1 stop bit, no parity, and is little endian. The second interface is /dev/tty0 device, with a 19200 Baudrate, 7 databits, 1 stop bit, parity, and is big endian. This will also not have some errors cause the task to re-connect.
Notes:
-
The ‘ais’, ‘dis’, ‘dos’ options will make the task slower because it is unable to batch the registers. So, these options should not be used unless necessary.