modbus_srvr_tcp

Purpose:

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

Enter:

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

Where:

priority

Specify the priority level of the task. 

interfaces

Specify TCP device information to communicate with a modbus slave including, IP, port, 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_tcp 24 127.0.0.1:34567:l &

The preceding communicates with a device at IP 127.0.0.1, port 34567, and uses little endian.

modbus_srvr_tcp 24 127.0.0.1:34567:l 10.0.0.1:502:b &

The preceding communicates with 2 interfaces. The first is a device at IP 127.0.0.1, port 34567, and uses little endian. The second interface is a device at IP 10.0.0.1, port 502, and uses big endian.

modbus_srvr_tcp 24 127.0.0.1:34567:l 10.0.0.1:502:b dis ais &

The preceding communicates with 2 interfaces. The first is a device at IP 127.0.0.1, port 34567, and uses little endian. The second interface is a device at IP 10.0.0.1, port 502, and uses big endian. The task will read all registers one at a time.

modbus_srvr_tcp 24 127.0.0.1:34567:l 10.0.0.1:502:b dis ais noerr &

The preceding communicates with 2 interfaces. The first is a device at IP 127.0.0.1, port 34567, and uses little endian. The second interface is a device at IP 10.0.0.1, port 502, and uses big endian. The task will read all registers one at a time. This will also not have some errors cause the task to re-connect. 

Notes:

The ‘ais’ and ‘dis’ 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