Frames; Command Frames - Omron EJ1 User Manual

Modular temperature controllers
Hide thumbs Also See for EJ1:
Table of Contents

Advertisement

Frames

7-2

Frames

Modbus
Communications
Protocol
7-2-1

Command Frames

Example of CRC-16
Calculation
1,2,3...
192
Commands from the host computer and responses from the EJ1 take the form
of frames that conform to the Modbus (RTU) protocol. The data included in
command frames and response frames is described in this section.
In the following descriptions, an "H" before a numeric value (for example H'02)
indicates that the value is a hexadecimal number. Numbers or letters
enclosed in quotation marks (for example "00") are ASCII characters.
Modbus is a communications control method that conforms to the RTU Mode
of the Modbus protocol (specifications PI-MBUS-300 Rev. J) of Modicon Inc.
Refer to the OMRON specifications for detailed specifications of the Modbus
protocol.
In RTU Mode, each frame begins and ends with a silent time interval that is at
least 3.5 characters long.
Slave
Function
address
code
Bytes:
1
1
CRC-16 calculation range
Silent interval at least 3.5 characters long.
Slave address
Specify the unit number of the EJ1 between H'00 and H'3F (0 to
63). When broadcasting to all nodes, specify H'00. Responses are
not returned for broadcasts.
Function code
The function code specifies the command from the host computer.
The code is set in hexadecimal and is 1 byte long. For more infor-
mation, refer to 7-3 Function Codes.
Data
The text of command based on the function code. Specifies vari-
able addresses and the values for set values in hexadecimal.
CRC-16
Cyclical Redundancy Check
These two bytes store check code calculated from the slave
address to the end of the data in hexadecimal.
Silent interval at least 3.5 characters long.
A message is processed 1 byte at a time in a 16-bit processing register called
the CRC register.
1. An initial value of H'FFFF is set in the CRC register.
2. An XOR is taken of the contents of the CRC register and the 1st byte of the
message, and the result is returned to the CRC register.
3. The contents of the CRC register is shifted 1 bit to the right, and 0 is placed
in the MSB.
4. If the bit shifted from the LSB is 0, step 3 is repeated (i.e., the contents of
the register is shifted 1 more bit).
If the bit shifted from the LSB is 1, an XOR is taken of the contents of the
CRC register and H'A001, and the result is returned to the CRC register.
5. Steps 3 and 4 are repeated until the contents of the register have been
shifted 8 bits to the right.
6. If the end of the message has not been reached, an XOR is taken of the
next byte of the CRC register and the message, the result is returned to
the CRC register, and the procedure is repeated from step (3).
Data
CRC-16
2
Section 7-2

Advertisement

Table of Contents
loading

Table of Contents