CPR04 Modbus Protocol 2v01
CPR04 Modbus Protocol 2v01
OVERVIEW ....................................................................................... 2
THG – Trip history group described above MEMORY MAP DATA TYPE
FORMATS ....................................................................................... 18
Page 1 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
OVERVIEW
The CPR04 feeder protection relay includes MODBUS protocol for compatibility to most communication systems.
The Windows software for setting up the CPR04 still uses the IEC 870-5-1 format protocol. The data structure is the
same for both cases.
PHYSICAL LAYER
The CPR04 communicates via RS485 or RS232. The transmit format is settable from the relay front panel menu.
The settable parameters include the following:
1. Baud rate – 115200, 57600, 38400, 19200, 9600, 4800, 2400 or 1200 b/s
2. Data bits – 8 bits
3. Start and stop bits fixed to 1
4. Parity – Even, Odd and if 8 bits data selected, None
5. Slave address – (1 – 255)
6. Answer response time – (0.01s – 10.0s) – minimum time to respond to a request
7. Receive dead time – (0.01s – 10.0s) – maximum time before a received character string is terminated
SLAVE ADDRESS
This is the address of the slave device that is intended to receive the packet sent by the master and performs the
desired action. Each slave device on a communication bus must have a unique address to prevent bus contention. All
of the relay's ports have the same address, which is programmable from 1 to 255. Only the addressed slave will
respond to a packet that starts with its address.
A master transmit packet with a slave address of 0 indicates a broadcast command. All slaves on the communication
link will take action based on the packet, but none will respond to the master. Broadcast mode is only recognized
when associated with FUNCTION CODE 05h. For any other function code, a packet with broadcast mode slave
address 0 will be ignored.
FUNCTION CODE
This is one of the supported functions codes of the CPR04, which tells the slave what action to perform. The
supported function codes are described later for complete details. Setting the high order bit of the function code in
the response packet indicates an exception response from the slave.
DATA
This will be a variable number of bytes depending on the function code. This may include actual values, setpoints,
or addresses sent by the master to the slave or by the slave to the master.
Page 2 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
CRC
This is a two-byte error checking code. The RTU version of Modbus includes a 16-bit cyclic redundancy check
(CRC-16) with every packet, which is an industry standard method used for error detection. If a CPR04 Modbus
slave device receives a packet in which an error is indicated by the CRC, the slave device will not act upon or
respond to the packet thus preventing any erroneous operations.
DEAD TIME
A packet is terminated when no data is received for a period of the “receive dead time setting” (0.01s-10.0s)
Consequently, the transmitting device must not allow gaps between bytes longer than this interval. Once the dead
time has expired without a new byte transmission, all slaves start listening for a new packet from the master except
for the addressed slave.
CRC-16 ALGORITHM
The CRC-16 algorithm essentially treats the entire data stream (data bits only; start, stop and parity ignored) as one
continuous binary number. This number is first shifted left 16 bits and then divided by a characteristic polynomial
(11000000000000101 B). The 16-bit remainder of the division is appended to the end of the packet, most significant
byte first. The resulting packet including CRC, when divided by the same polynomial at the receiver will give a zero
remainder if no transmission errors have occurred. This algorithm requires the characteristic polynomial to be
reverse bit ordered. The most significant bit of the characteristic polynomial is dropped, since it does not affect the
value of the remainder.
Note: A C programming language implementation of the CRC algorithm will be provided upon request.
Page 3 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 4 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 5 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 6 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 7 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 8 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 9 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
EXCEPTION RESPONSES
Programming or operation errors happen because of illegal data in a packet, hardware or software problems in the
slave device, etc. These errors result in an exception response from the slave. The CPR04implements the error codes
listed below. The slave detecting one of these errors sends a response packet to the master with the high order bit of
the function code set to 1.
The following table shows the format of the master and slave packets. The example shows a master device sending
the unsupported function code 39h to slave device 11.
The function code of the master query packet is not a function code supported by the
01 ILLEGAL FUNCTION
slave.
The address referenced in the data field of the master query packet is not an address
02 ILLEGAL DATA ADDRESS
supported by the slave.
The value referenced in the data field of the master query packet is not allowable in
03 ILLEGAL DATA VALUE
the addressed slave location.
The packet was received without error, but the slave device is engaged in processing
06 BUSY, REJECTED PACKET
a long duration command. Retransmit later, when the slave device may be free.
NAK - NEGATIVE The packet was received without error, but the request could not be performed,
07
ACKNOWLEDGE because this version of the CPR04 does not have the requested operation available.
NAK – RELAY SETUP The packet was received without error, but the request could not be performed,
08
INCORRECT because the CPR04 setup is incorrect for this function.
Page 10 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 11 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 12 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 13 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 14 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 15 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Time stamp group (TSG) start address = 400 to 631 (33 time stamp * 7)
16bit – Trip second 0 - 59
16bit – Trip minute 0-59
16bit – Trip hour 0-23
16bit – Trip day 1-31
16bit – Trip day of week 0 – 6 (Sunday = 0)
16bit – Trip month 1-12
16bit – Trip year 2000-2099
(14 bytes data)
Page 16 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Trip history group (THG) start address = 1026 to 1626 (25 history * 24)
32bit – First measurement value floating point number (F5)
32bit – Second measurement value floating point number (F5)
32bit – Third measurement value floating point number (F5)
32bit – First angle measurement value floating point number (F5)
32bit – Second angle measurement value floating point number (F5)
32bit – Third angle measurement value floating point number (F5)
32bit – Time it took to trip unsigned integer must be divided by 100 for seconds
16bit – Trip function 0 – 24 (F14)
16bit – Trip second 0 - 59
16bit – Trip minute 0-59
16bit – Trip hour 0-23
16bit – Trip day 1-31
16bit – Trip day of week 0 – 6 (Sunday = 0)
16bit – Trip month 1-12
16bit – Trip year 0-99
16bit – Trip element 0x70 + 1 – 3 (0 = event input, 1-3 = value 1 – 3)
16bit – Trip output relay (bit 1 = output relay 1 … bit 5 = output relay 5)
(48 bytes data)
The three measurement values are used for the extended history display. The bottom four bits of the trip element
value points to the measurement value that caused the trip. The top four bits describe the state of the other elements
at time of trip. If one or two of the element measurements was over the threshold it will be recorded as (bit 0x10 =
element 1; bit 0x20 = element 2; bit 0x40 = element 3). The trip function describes the trip that is in the trip data
block and how it will be displayed. The time it took to trip is a integer number that must be divided with 100 to get
(0.00) seconds. The trip output relay describes the output relays that tripped for this history block.
Page 17 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 18 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 19 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 20 of 21
File: CPR04 MODBUS PROTOCOL 2V01Communication Protocol 22 November, 2010
Page 21 of 21