UM-0085-B09
DT80 Range User Manual
Page 176
RG
Serial Sensor Port
The serial sensor port can be used to connect to a Modbus client via a multi-drop (RS422/ 485) or point-to-point (RS232/
422/ 485) link.
In order to use Modbus on the serial sensor port it is necessary to set the port function, as follows:
PROFILE SERSEN_PORT FUNCTION=MODBUS
You may also need to configure the baud rate or other serial parameters to suit the system to which you are connecting.
Modbus systems commonly use
19200 baud, 8 data bits, 1 stop bit, even parity, no flow control
.
For more details on setting up the port and the possible wiring configurations, see
.
Note:
Do not use software flow control (SWFC) on a Modbus serial connection. This is because flow control characters (
XON
/
XOFF
)
may legitimately appear in Modbus data, and if they do then they will be stripped out. This will cause data errors.
Host RS232 Port
The host RS232 port can be used for a point-to-point serial Modbus connection.
As with the serial sensor port, the port function must be set:
PROFILE HOST_PORT FUNCTION=MODBUS
along with the serial parameters to match the connected system.
For more details on setting up the port and the possible wiring configurations, see
.
USB Port
A USB connection can also be used where the client system is within a few metres of the DT80.
USB is convenient because you don't have to set serial parameters. The port function does need to be set, however:
PROFILE USB_PORT FUNCTION=MODBUS
For more details, see
.
Slave Address
To enable Modbus operation on the serial sensor port, it is also necessary to set the DT80's slave address. This is done
using the following profile setting:
PROFILE MODBUS_SERVER SERSEN_ADDRESS=
addr
where addr is the desired address (1-247). Setting the address to zero (which is the default) will disable Modbus on the
serial sensor port.
In the same way, Modbus can be enabled on the host RS232 and USB port using:
PROFILE MODBUS_SERVER HOST_ADDRESS=
addr
PROFILE MODBUS_SERVER USB_ADDRESS=
addr
Again, the default setting is zero, which means "disabled".
Modbus Registers
The Modbus Data Model
The Modbus protocol defines a simple data model. It specifies that any Modbus slave device contains the following
resources:
•
an array of single bit
coils
(digital outputs). When setting up a Modbus client application, a particular coil is
normally referenced using a 5-digit number in the range 00001-09999, or a 6-digit number 0:00001-0:65536
(depending on the Modbus client implementation). In this manual the 6-digit notation will be used.
•
an array of single bit
discrete inputs
(digital inputs), numbered 10001-19999, or 1:00001-1:65536
•
an array of 16-bit
input registers
, numbered 30001-39999, or 3:00001-3:65536
•
an array of 16-bit
output registers
(a.k.a
holding registers
), numbered 40001-49999, or 4:00001-4:65536
As can be seen, the first digit of the register number indicates the type of register – 0, 1, 3 or 4 for coil, discrete input,
input register or output register respectively. This usage is, however, just a convention. This digit is not part of the actual
address transmitted in the Modbus message.
A further potential source of confusion is the fact that the actual transmitted address is zero-based, so register number
x:00003 is actually transmitted as address 0002.
Note:
In some Modbus client applications, register numbers are entered using these raw protocol addresses, while in others you specify
register numbers including the initial "register type" digit, as described above. The documentation for the particular package should
make clear which convention it uses.
The protocol then defines a set of messages which allow the client to:
•
read the current value of one or more of the slave's coils, discrete inputs, input registers or output registers
•
write to one or more of the slave's coils or output registers.
A given type of Modbus slave device will support some quantity of each type of resource – for example a hypothetical
device might support 16 coils, 16 discrete inputs, 4 input registers and no output registers.