SERIAL PORT
If using the ASCII driver (MODBUS.EXE) the COM port is set at: even parity , 1 stop bit, 7 data bits
If using the RTU driver (MOD_RTU.EXE) the COM port is set at: even parity, 1 stop bit, 8 data bits
HOST OPERATION
Each "I", "O", "A", "S"cluster is specified by 6 numbers:
FIRST, QUANTITY, SITE, POSITION, ALARM, ENABLE
Serial port version: Each "G" clusters is specified by 7 numbers:
FIRST, QUANTITY, SITE, POSITION, ALARM, ENABLE, FORMAT
TCP/IP version: Each "G" clusters is specified by 6 numbers:
FIRST, QUANTITY, SITE, POSITION, ALARM, ENABLE
|
FIRST |
First RTES point/channel in the cluster |
|
QUANTITY |
Number of consecutive points/channels in the cluster (1 TO 16) |
|
SITE |
Address on the modbus unit (0 - 255) |
|
POSITION |
Position of the first point/channel on the MODBUS unit (0-64000) |
|
ALARM |
Index of the RTES register that will be set if a communication error occurs with this cluster. (0 - 2047). |
|
ENABLE |
RTES communication enable register. (1 - 2047). 0 for 'always enabled' |
|
FORMAT |
"G" clusters in the Serial Port driver only. 0 if reading integers, 1 if reading IEEE floating point numbers |
.
In the following, C1,C2,... represent the 6 numbers that form the cluster specifications (C1 consists of 6 numbers, C2 consists of 6 numbers, etc) and p is the number of clusters.
To define the binary input clusters from PLC registers to RTES 'I' registers
I=p C1,C2,C3,....,Cp
The 'POSITION' argument selects where the data comes from:
|
00xxx |
reads data from 'coils' (00xxx) |
|
10xxx |
reads data from status inputs (10xxx) |
|
30xxx |
reads data from 30xxx holding registers. Each bit corresponding to one RTES I register. |
|
40xxx |
reads data from 40xxx holding registers. Each bit corresponding to one RTES I register |
To define the binary output clusters from RTES 'O' registers to PLC registers,
O=p C1,C2,C3,....,Cp
The 'POSITION' argument selects where the data is written at the PLC:
|
00xxx |
writes data to 'coils' (00xxx) |
|
40xxx |
writes data to 40xxx registers. Each RTES O register corresponding to one bit of the 16 bit word. |
To define the analog input clusters from 40xxx registers to RTES 'R' registers
G=p C1,C2,C3,....,Cp
If the FORMAT parameter is 0, the values are interpreted as 2's complement
If the FORMAT parameter is 1, the values are interpreted as 32 bit IEEE floating point. Each value is obtained from two consecutive MODBUS addresses
To define the analog output clusters from RTES 'R' registers to 40xxx registers
S=p C1,C2,C3,....,Cp
The 2's complement of the integer values of the registers are sent to the slave device.
To define the analog input clusters from 30xxx registers to RTES 'A' registers
A=p C1,C2,C3,....,Cp
The data is interpreted as 12 bit raw values.
This is how the MOD_RTU driver selects the command depending on the RTU' variable number you use in the cluster.
|
--- 'position' variable --- |
||||
|
Cluster type |
00XXX |
10XXX |
30XXX |
40XXX |
|
"I" |
01 |
02 |
04 |
03 |
|
"G" |
03 |
03 |
03 |
03 |
|
"O" |
15(*) |
15(*) |
15(*) |
16 |
|
"S" |
16 |
16 |
16 |
16 |
|
"A" |
04 |
04 |
04 |
04 |
(*) note: If the O cluster defines a single output (QUANTITY=1), command 05 is used in lieu of 15.
SLAVE OPERATION
The MOD_RTU driver operates as a slave when it is not active as a host. To inhibit activity as a host,
you must not have any clusters defined in the PORTn.CNF file, or you must turn off the 'enable'
registers of all the clusters that are defined.
Under these conditions, the driver may receive unsolicited messages from a host using a subset of the
Modbus RTU protocol. The Modbus commands supported are:
|
Function Code |
MODBUS Command |
RTES Response |
|
01 |
REQUEST COIL STATUS |
RTES responds with the status of the O registers specified in the command. Coil 1 is O001, coil 2 is O002, etc |
|
02 |
REQUEST INPUT STATUS |
RTES responds with the status of the I registers specified in the command. Input 10001 is I001, input 10002 is I002, etc. |
|
03 |
READ OUTPUT REGISTERS |
RTES responds with the numeric values (signed integers) of the R registers specified in the command. Register 40001 is R0001, register 40002 is R0002, etc. |
|
04 |
READ INPUT REGISTERS |
If C=0 (default) RTES responds with the numeric raw values (0 to 4095) of the A registers specified in the command. Register 30001 is A001, register 30002 is A002, etc. If C>0 RTES executes this command exactly like a 03 (but returns 04 in the response) |
|
05 |
FORCE SINGLE COIL |
RTES sets the specified O register at the value specified by the least significant bit of the first data byte received |
|
06 |
PRESET SINGLE REGISTER |
RTES sets the specified R register at the value specified by the data word received. |
|
07 |
READ EXCEPTION STATUS |
RTES responds with the value of the first 8 O registers (O001 to O008) |
|
15 |
FORCE MULTIPLE COILS |
RTES sets the specified O registers at the specified values. |
|
16 |
FORCE MULTIPLE REGISTERS |
RTES sets the specified R registers at the specified values. |
|
17 |
REPORT SLAVE ID |
RTES returns two bytes. Both are FFhex. |
CONFIGURATION
The PORTn.CNF file may contain :
|
N=id |
specifies the slave ID. (1 to 255). Default is 255. This driver does not support broadcast commands |
|
C=0 |
return A register raw values in command 04 (default) |
|
C=1 |
return R register (2's complement integer values) in command 04 |
.
TCP/IP
Application note for Modicon 170 ENT 110 00
The following configuration file will read 16 inputs into I0001-I0016 and write O0001-O0016 to 16 output, for station 2 at IP 111.111.111.7
N=1 P=1 2 111,111,111,7 I=1 0,16,2,40000,0,0 O=1 0,16,2,40000,0,0
MOD485 Version
This version of the MOD-RTU driver is designed for use on RS485 networks.
The receive is shut-off at the start of a transmission to suppress the echo
and is turned back on X milliseconds after the last byte has left the buffer.
The X parameter may be defined in milliseconds in the configuration file.
The default value is X=3.
![]()
Reference: MODBUS Protocol Specifications
Revision History:
October 01, 1993
October 21, 1993
March 30, 1995
June 02, 1997
November 30, 1998 (added C option in slave operation)
April 12, 2002 - added notes re TCP/IP and MOD485