Communication - Protocol-TR 42-C1
Communication - Protocol-TR 42-C1
The ORION ITALIA SERIES implement a subset of the AEG Modicon Modbus serial communication standard.
Many devices support this protocol directly with suitable interface card, allowing direct connection of relays.
The Modbus protocol is hardware-independent; that is, the physical layer can be any of variety of standard
hardware configurations. This includes RS232, RS422, RS485, fibber optics, etc. The ORION ITALIA RELAYS
include a rear terminal RS422/RS485 port. Modbus is a single master multiple slave protocol suitable for a
multi-drop configuration as provided by RS422/RS485 hardware. In this configuration up to 32 slaves can be
daisy-chained together on a single communication channel.
The ORION ITALIA SERIES is always a Modbus slave. It cannot be programmed as a Modbus master. The
Modbus protocol exists in two versions: Remote Terminal Unit (RTU, binary) and ASCII. Only the RTU version
is supported by the Orion Italia Relay. Monitoring, programming and control functions are possible using read
and write register commands.
2 ELECTRICAL INTERFACE.
In a two-wire RS485 link, data flow is bi-directional. The four-wire RS422 port uses two terminals for receive
lines, and two other terminals for transmit lines. As a result, both RS422 and RS485 ports cannot be used at
the same time. The data flow is half duplex. That is, data is never transmitted and received at the same time.
RS485 and RS422 lines should be connected in a daisy chain configuration (avoid star connections) with
terminating resistors and capacitors installed each end of the link, i.e. at the master end and the slave farthest
from the master. That value of the terminating resistors should be equal to the characteristic impedance of the
line. This is approximately 120 Ohms for standard 24 AWG twisted pair wire. The value of the capacitors
should be 1 nF. Shielded wire should always be used to minimize noise. Polarity is important in RS485
communications. See figure below for more details.
Convertitore Convertitore
TR-42 RS-422 a RS-232 TR-42 RS-485 a RS-232
RxA TxA TXA DATA (+)
RxB TxB
TXA RxA TXB DATA (-)
TXB RxB
GND GND
To PC
RxA TXA To PC
RxB
TXA TXB
TXB
COMMUNICATION 1
TEMPERATURE RELAY TR-42
One data frame of an asynchronous transmission to or from a Orion Italia Relay consists of 1 start bit, 8 data
bits, not parity and 1 stop bit. This produces a 10 bit frame. This is important for transmission though modems
at high bit rates (11 bit data frames are not supported by hayes modems at bit rates of greater than 300 bps).
The rear RS485/RS422 external communication port of the Orion Italia Relay supports operation at
1200,2400,4800 and 9600 baud.
A complete request/response consists of the following bytes transmitted as separate data frames:
A message is terminated when no data is received for a period of 3 1/2 character transmission times.
Consequently, the transmitting device must not allow gaps between bytes larger than this interval (about 3ms
at 9600 baud).
SLAVE ADDRESS: This is the first byte of every message. This byte represents the user-assigned address of
the slave device that is to receive the message sent by the master. Each slave device must be assigned a
unique address, and only the addressed slave will respond to a message that starts with its address. In a
master query message the SLAVE ADDRESS represents the address of the slave to which the request is
being sent. In a slave response message the SLAVE ADDRESS is a confirmation representing the address of
the slave that is sending the response. A master query message with a SLAVE ADDRESS of 0 indicates a
broadcast command. All slaves on the communication link will take action based on the message, but none will
respond to the master.
FUNCTION CODE: This is the second byte of every message. Modbus defines function codes of 1 to 127. The
Orion Italia Relay implements some of this functions. See section 7 for details of the function codes supported
by the Orion Italia Relay Series Modbus Protocol. In a master query message the FUNCTIONS CODE tells the
slave what action to perform. In a slave response message, if the FUNCTION CODE sent from the slave is the
same as the FUNCTION CODE sent from the master then the slave performed the function as requested.
DATA: This will be a variable number of bytes 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. See section 7 for a
description of the Orion-supported functions and the data required for each.
CRC: This is a two byte error checking code. CRC is sent LSByte first followed by the MSByte. The RTU
version of Modbus includes a two byte CRC-16 (16 bit cyclic redundancy check) with every message. 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
2 COMMUNICATION
TEMPERATURE RELAY TR-42
polynomial (11000000000000101B). The 16 bit remainder of the division is appended to the end of the
message, MSByte first. The resulting message including CRC, when divided by the same polynomial at the
receiver will give a zero remainder if no transmission errors have occurred. If a Orion Modbus slave device
receives a message in which an error is indicated by the CRC-16 calculation, the slave device will not respond
to the message. A CRC-16 error indicates that one or more bytes of the message were received incorrectly
and thus the entire message should be ignored in order to avoid the slave device performing any incorrect
operation. The CRC-16 calculation is an industry standard method used for error detection. An algorithm is
included in section 5 CRC-16 algorithm to assist programmers in situations where no standard CRC-16
calculation routines are available.
5 CRC-16 ALGORITHM
Once the following algorithm is completed, the working register "A" will contain the CRC value to be
transmitted. Note that 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.
The following symbols are used in the algorithm:
Symbols:
--> data transfer
A 16 bit working register
Alow low order byte of A
Ahigh high order byte of A
CRC 16 bit CRC-16 value
i,j loop counter
(+) logical EXCLUSIVE-OR operator
N total number of data bytes
Di i-th data byte (i=0 to N-1)
G 16 bit characteristic polynomial =1010000000000001(binary) with MSbit dropped and bit
order reversed
shr(x) right shit operator (the LSbit of x is shifted into a carry lag, a '0' is shifted into the MSbit of x,
all other bits are shifted right one location)
Algorithm:
1. FFFF(hex) --> A
2. O --> i
3. O --> j
4. Di (+) Alow --> Alow
5. j + 1 --> j
6. shr (A)
7. Is there a carry ? No: go to step 8
Yes: G (+) A --> A and continue
8. Is j = 8 ? No: go to 5
Yes: continue
9. i + 1 --> i
10. Is i = N ? No: go to 3
Yes: continue
11. A ----> CRC
COMMUNICATION 3
TEMPERATURE RELAY TR-42
6 MESSAGE TIMING
Communication message synchronization is maintained by timing constraints. The receiving device must
measure the time between the reception of characters. If three and one half character times elapse without a
new character or completion of the message, then the communication link must be reset (i.e. all slaves start
listening for a new query message from the master). Thus at 1200 baud a delay of greater than 3.5 x 1/1200 x
10 = 29.2 msec cause the communication link to be reset. At 9600 baud a delay of greater than 3.5 x 1/9600
x 10 = 3.6 ms will cause the communication link to be reset. Most master query messages will be responded to
in less than 50 ms. The maximum time for the Orion Italia Relay to return a slave response message for any
function code will never exceed 1 second.
The second byte of every message is the function code. Modbus defines function codes of 01h to 7Fh. The
Orion Italia Relay Modbus protocol supports some of these functions, as summarized in Table No. 1
TABLE No. 1
Since some programmable logic controllers only support function codes 03h (or 04h) and 10h, most of the
above Modbus commands can be performed by reading from or writing to special addresses in the Orion Italia
Relay memory map using these function codes.
The Orion Italia Relay implementation of Modbus views "holding registers" as any setpoint or actual values
register in the Orion Italia Relay memory map. Registers are 16 (two byte) values transmitted high order byte
first. Thus all Orion Italia Relay setpoints and actual values in the memory map are sent as two byte registers.
This function code allows the master to read one or more consecutive setpoints or actual values from
addressed slave device.
The slave response to these function codes is the slave address, function code, a count of the number of data
bytes to follow, the data itself and the CRC. Each data item is sent as a two byte number with the high order
byte sent first. The CRC is sent as a two byte number with the low order byte sent first.
The maximum number of values of Setpoints that can be read in a single message is 6 word (12 bytes). The
TR-42 Setpoint data starts at address 0100h.
4 COMMUNICATION
TEMPERATURE RELAY TR-42
The maximum number of values of Actual Values that can be read in a single message is 14 word (28 bytes).
The TR-42 Actual Values data starts at address 0200h.
If the function code or the address of any of the requested data is illegal, the slave will not respond the
message. Otherwise, the slave will respond as follows:
This function code allows the master to request TR-42 to perform specific command operations. The
commands Number Listed in the Commands Area of the Relay memory map correspond to operations codes
for function code 05h.
The Slave Response to this function is to echo the entire master transmission.
The operation codes can also be initiated by writing to the commands area of the memory map using function
codes 06h or 10h.
COMMUNICATION 5
TEMPERATURE RELAY TR-42
This function code allows the master to store single setpoints into the memory map of the TR-42.
The Slave Response to this function is to echo the entire master transmission.
6 COMMUNICATION
TEMPERATURE RELAY TR-42
This function code allows the master to modify the contest of a one or more consecutive setpoint in the
addressed slave device. Setpoint registers are 16 bit (two byte) values transmitted high order byte first.
The maximum number of register values (setpoints) that can be stored in a single message is 6 word (12
bytes). The TR-42 Setpoint data starts at address 0100h.
To store the value of one or more setpoints in the internal memory of the TR-42, the following steps shall be
realized:
a) First shall be read all setpoint group ( 6 word = 12 bytes) with function 03h or 04h.
b) Modify the values of setpoints according to setpoint map.
c) Send all setpoint group, 6 word (12 bytes) with function 10h.
The TR-42 response to this function code is to echo the slave address, function code, starting address, the
number of setpoints stored, and the CRC.
Request slave device 11h to write the value 0064h at setpoint address 0100h, and the value 0070h at setpoint
address 0101h.
COMMUNICATION 7
TEMPERATURE RELAY TR-42
If the function code or the address or value of any of the data, is illegal, the slave will not respond to the
message. Otherwise, the slave will respond as follows:
8 COMMUNICATION
TEMPERATURE RELAY TR-42
The data stored in the TR-42 is grouped as Setpoints, Actual Values, Product ID & Commands. Setpoints can
be read and written by a master computer. Actual Values & Product ID are read only, Commands are Write
Only. All setpoints and Actual Values are stored as two bytes values. Addresses are listed in hexadecimal.
Data values (Setpoint ranges, increments, factory value) are in decimal.
MEMORY MAP
COMMUNICATION 9
TEMPERATURE RELAY TR-42
10 COMMUNICATION
TEMPERATURE RELAY TR-42
COMMUNICATION 11
TEMPERATURE RELAY TR-42
12 COMMUNICATION
TEMPERATURE RELAY TR-42
COMMUNICATION 13