Modbus® Protocol For pCO Controllers
Modbus® Protocol For pCO Controllers
User manual
CONTENTS:
1 INTRODUCTION .................................................................................................................................................. 3
6 MODBUS COMMANDS....................................................................................................................................... 9
6.1 Error codes (Modbus exceptions) ............................................................................................................... 9
6.2 Response to the Report Slave ID message ................................................................................................ 9
1 INTRODUCTION
The Modbus® Slave protocol can be used to directly connect pCO controllers to a Modbus® supervisory system. The
protocol implemented is RTU (Remote Terminal Unit). Communication with the supervisor is managed by 8-bit data
encoding and 16-bit CRC error control. Communication is asynchronous serial, 8 data bits, parity and settable stop
bits; the baud rate and supervisor address can also be set.
2 CONNECTION MODES
Connection can be managed over both RS485 and RS232 (half duplex point-to-point), the latter only for serial
communication using the corresponding optional card (see pCO sistema manual)
Fig. 1 Fig. 2
For the technical specifications, meanings of the connections (pins) and details on the activation procedure, see the
instructions shown on the instruction sheet included in the packaging on the optional card.
4
Data Terminal Equipment, DB9 pin, male
ModBus® protocoll - cod. +030221945 – rel. 1.1 18.07.2012
3
Modbus® protocol for pCO controllers
4 PROTOCOL ACTIVATION
The protocol is activated by setting the system variables used as communication protocol selector for the required
serial interface. The size of the variable database (registers and coils) will vary depending on the value used to
activate communication. The system variable values required to activate Modbus® protocol are shown in Tab.2.
Baud rate
System variable 1200 2400 4800 9600 19200 38400
COM_BAUDRATE_PLAN 0 1 2 3 4
COM_BAUDRATE_BMS(1)(3) 0 1 2 3 4 5
COM_BAUDRATE_FIELDBUS 0 1 2 3 4
COM_BAUDRATE_BMS2(2)(3) 0 1 2 3 4 5
Tab. 17
(1)
The value 5 (38400 bps) can only be selected on Supernode, pCOCOMPACT and pCO5.
(2)
The value 5 (38400 bps) can only be selected on Supernode and pCO5.
(3)
The value 5 (38400 bps) can only be selected starting from BIOS 5.17 and higher.
As an example, to transmit with 1 stop bit and odd parity, the variables must be assigned the value 0x21 (d33).
5
COM_CONFIG_PLAN, COM_CONFIG_BMS, COM_CONFIG_FIELDBUS, COM_CONFIG_BMS2, COM_CONFIG_FIELDBUS2
ModBus® protocoll - cod. +030221945 – rel. 1.1 18.07.2012
5
Modbus® protocol for pCO controllers
5.1 Threshold
The threshold, used to distinguish Modbus registers reserved for Carel analogue variables from those reserved for
Carel integer variables, depends on the protocol activation value (Tab. 2) and the value of the BMS_EXTENSION
system variable. The frame address (PDU) of threshold Th is described in Tab. 6.
BMS_EXTENSION
0 1
MODBUS® SELECTION NUMBER
3, 5 Th = 128 Th = 208
30, 50 Th = 5001 Th = 5001
33 Th = 128 Th = 5001
Tab. 6
5.2 Relationship between Carel variable index and Modbus data address
The threshold described in the previous paragraph is used to calculate, based on the supervisor index of the Carel
variable (Analogue, Integer, Digital), the corresponding Modbus data (Register, Coil) index (see par. 5.1). Tab. 7
shows the correspondence, where Th refers to the threshold described in Tab. 6.
CAREL MODBUS®
A[N] REGISTER[N]
I[N] REGISTER[Th+N]
D[N] COIL[N]
Tab. 7
Consequently, for example, the first analogue variable A[1] will correspond to register Reg[2], the second A[2] to
register Reg[3], and so on. The same is true for digital variables, only these are mapped to Modbus coils rather than
registers. Similarly, the first integer variable I[1], will be mapped to register Reg[129] if the threshold Th is equal to
128, to register Reg[209] if the threshold is 208, or to register Reg[5002] if the threshold is 5001.
SUPERVISOR_EXTENSION = 0 SUPERVISOR_EXTENSION = 1
127 A 127 I 199 D 207 A 207 I 207 D
Tab. 8
BMS_EXTENSION = 0 BMS_EXTENSION = 1
CAREL MODBUS CAREL MODBUS
Type Address Type Address Type Address Type Address
Digital 1 Coil 1 Digital 1 Coil 1
Digital 2 Coil 2 Digital 2 Coil 2
Digital … Coil … Digital … Coil …
Digital 198 Coil 198 Digital 206 Coil 206
Digital 199 Coil 199 Digital 207 Coil 207
Analogue 1 Register 1
Analogue 2 Register 2
Analogue … Register …
Analogue 207 Register 207
Analogue 208 Register 208
Analogue … Register …
Analogue 4999 Register 4999
Analogue 5000 Register 5000
SUPERVISOR_EXTENSION = 0 SUPERVISOR_EXTENSION = 1
127 A 10000 I 2048 D 5000 A 10000 I 2048 D
Tab. 11
When the value is 0 the analogue variable database has no extension, and the size coincides with the value
envisaged for versions 3 and 5 of the Modbus protocol (see Tab. 8). When the value is 1, on the other hand, the
extension is the same as envisaged by versions 30 and 50 (see Tab. 10). The integer and digital variables always
extend beyond the maximum index managed by the Carel protocol (207). The correspondence is shown in Tab. 12,
where the indices in bold are those managed by the Carel protocol, while those in italics correspond to the extension
of the database if the BMS_EXTENSION system variable is 1. The Modbus addresses are the physical addresses of
the registers and coils (see par. 5.1).
BMS_EXTENSION = 0 BMS_EXTENSION = 1
CAREL MODBUS® CAREL MODBUS®
Type Address Type Address Type Address Type Address
Digital 1 Coil 1 Digital 1 Coil 1
Digital 2 Coil 2 Digital 2 Coil 2
Digital … Coil … Digital … Coil …
Digital 207 Coil 207 Digital 207 Coil 207
Digital 208 Coil 208 Digital 208 Coil 208
Digital 209 Coil 209 Digital 209 Coil 209
Digital … Coil … Digital … Coil …
Digital 2047 Coil 2047 Digital 2047 Coil 2047
Digital 2048 Coil 2048 Digital 2048 Coil 2048
6 MODBUS COMMANDS
The Modbus commands implemented are described in Tab. 13. Digital variables can be read both with Read Coil
Status (code 1) and Read Input Status (code 2). The controller manages these supervisor requests in the same way.
Similarly, analogue and integer variables can be read with Read Holding Register (code 3) and Read Input Register
(code 4).
Reading/writing of supervisor variables using the commands described in Tab. 13 during normal controller operation
depends on the application software that manages these.
The controller does not verify the range of values received by writing analogue and/or integer supervisor variables
using the Modbus Preset Single/Multiple Register commands.
01,11,16,C9,FF,05,0C,13,88,27,10,08,00,00,02,13,89,13,8B,3A,9A,00,02,08,01,64,08
Fig. 4
timeout: ≥1000 ms
turnaround delay6: from 50 to 200 ms
6
Delay before a subsequent request after having received the response to the previous one.
ModBus® protocoll - cod. +030221945 – rel. 1.1 18.07.2012
10
NOTE: ______________________________________________________________________
Agency: