modbus_srvr_serial

Purpose:

Communicate with a modbus protocol slave device via serial similar to how GModBus works. Use this instead of GModBus when desiring to calibrate your hardware channels.

Enter:

modbus_srvr_serial <priority> <interfaces> [ais] [dis] [dos] [debug] [aid] [aod] [did] [dod] [noerr]

Where:

 

priority

Specify the priority level of the task. 

interfaces

Specify RTU device information to communicate with a modbus slave including, device path, baud rate, databits, stopbits, parity, and endianess.

ais

Optional argument. If this option is used the task will read all of the input and holding registers one at a time, instead of grouping them together if possible. See Notes for additional details.

dis

Optional argument. If this option is used the task will read all of the coil and discrete registers one at a time, instead of grouping them together if possible. See Notes for additional details.

dos

 

Optional argument. If this option is used the task will write all of the coil registers one at a time, instead of grouping them together if possible. See Notes for additional details.

debug

Optional argument. This will add extra information being printed to the console. This is a lot of data that will output to the screen, use only if necessary.

aid

Optional argument. This will add extra information about Analog inputs being printed to the console. This is a lot of data that will output to the screen, use only if necessary.

aod

Optional argument. This will add extra information about Analog outputs being printed to the console. This is a lot of data that will output to the screen, use only if necessary.

did

Optional argument. This will add extra information about digital inputs being printed to the console. This is a lot of data that will output to the screen, use only if necessary.

dod

Optional argument. This will add extra information about digital outputs being printed to the console. This is a lot of data that will output to the screen, use only if necessary.

noerr

Optional argument. This will cause certain errors to not be generated when there are some errors detected, and will not cause the task to re-connect to the device.

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’ option will make the task slower because it is unable to batch the registers. So this option should not be used unless necessary. A device that seems to need these options is a JC-30D2-EZ Smoke Opacity meter.

See Also:

gmodbus, GModBus Setup