Documente Academic
Documente Profesional
Documente Cultură
Contents
1. Introduction ................................................................................................. 4
2. Modbus Protocol ........................................................................................ 4
2.1
2.2
2.3
2.4
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
EM-5650 Rev.10
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
EM-5650 Rev.10
EM-5650 Rev.10
1.
Introduction
The Modbus protocol is provided by Modicon Inc. (AEG Schneider Automation International S.A.S.), originally developed for
Modicon programmable controllers. Detailed information is described in Modicon Modbus Protocol Reference Guide (PIMBUS-300 Rev. J).
This protocol defines a message structure, regardless of the physical layer such like the type of networks over which they
communicate.
2.
Modbus Protocol
Device Address
Function Code
Function Code
Query Data
Response Data
Error Check
Error Check
Response Message from Slave
Devices can be setup to communicate on standard Modbus networks either of two transmission modes: ASCII (American
Standard Code for Information Interchange) or RTU (Remote Terminal Unit). The mode must be the same for all devices on
a Modbus network.
In ASCII mode, each 8-bit byte in a message is sent as two ASCII characters. In RTU mode, each 8-bit byte in a message
contains two 4-bit hexadecimal characters. The RTU mode, with its greater character density, allows better data throughput
than ASCII for the same baud rate.
The checking algorithm used in the Error Check Field depends upon which transmission method is employed; LRC (Longitudinal Redundancy Check) in ASCII mode; CRC (Cyclical Redundancy Check) in RTU mode.
EM-5650 Rev.10
START
ADDRESS
FUNCTION
DATA
LRC CHECK
END
1 CHAR
:
2 CHARS
2 CHARS
n CHARS
2 CHARS
2 CHARS
CRLF
RTU Framing
In RTU mode, messages start with a silent interval of at least 3.5 character times, and end with a similar interval of at least 3.5
character times. This is most easily implemented as a multiple of character times at the baud rate that is being used on the
network (shown as T1 T2 T3 T4 in the figure below).
All other fields are composed of 8-bit data.
START
ADDRESS
FUNCTION
DATA
CRC CHECK
END
T1T2T3T4*
8 BITS
8 BITS
n x 8 BITS
16 BITS
T1T2T3T4*
Address Field
Valid slave device addresses are in the range of 0 247 decimal. The individual slave devices are assigned addresses in the
range of 1 247. A master addresses a slave by placing the slave address in the address field of the message. When the
slave sends its response, it places its own address in this address field of the response to let the master know which slave is
responding. Address 0 is used for the broadcast query.
Function Field
Valid function field codes are in the range of 1 255 decimal.
When a message is sent from a master to a slave device the function code field tells the slave what kind of action to perform.
When the slave responds to the master, it uses the function code field to indicate either a normal (error-free) response or that
some kind of error occurred (called an exception response). For a normal response, the slave simply echoes the original
function code. For an exception response, the slave returns a code that is equivalent to the original function code with its
most-significant bit set to a logic 1. This tells the master what kind of error occurred, or the reason for the exception.
Whether a particular function code is applicable or not depends upon the slave device. Check specifications for each slave
device.
Data Field
The data field of messages sent from a master to slave devices contains information which the slave must use to take the
action defined by the function code. The data field may be of various length, or can be nonexistent (of zero length). Refer to
specifications for each slave device for the constructions and meaning of the data field.
EM-5650 Rev.10
LRC Checking
In ASCII mode, messages include an error-checking field that is based on a Longitudinal Redundancy Check (LRC) method.
The LRC field checks the contents of the message, exclusive of the beginning colon and ending CRLF pair. It is applied
regardless of any parity check method used for the individual characters of the message.
The LRC field is one byte, containing an 8-bit binary value. The LRC value is calculated by the transmitting device, which
appends the LRC to the message. The receiving device calculates an LRC during receipt of the message, and compares the
calculated value to the actual value it received in the LRC field. If the two values are not equal, an error results.
The LRC is calculated by adding together successive 8-bit bytes of the message, discarding any carries, and then twos
complementing the result. It is performed on the ASCII message field contents excluding the colon character that begins the
message, and excluding the CRLF pair at the end of the message.
E.g. 1
The query that reads the resistor 30001 in Slave device 1 is following. (Refer to 3.4 about query message)
":", "0", "1", "0", "4", "0", "0", "0", "0", "0", "0", "0", "1", "F", "A", CR/LF
For the above query message, LRC is "F", "A."
CRC Checking
In RTU mode, messages include an error-checking field that is based on a Cyclical Redundancy Check (CRC) method. The
CRC field checks the contents of the entire message. It is applied regardless of any parity check method used for the
individual characters of the message.
The CRC field is two bytes, containing a 16-bit binary value. The CRC value is calculated by the transmitting device, which
appends the CRC to the message. The receiving device recalculates a CRC during receipt of the message, and compares
the calculated value to the actual value it received in the CRC field. If the two values are not equal, an error results.
The CRC is started by first preloading a 16-bit register to all 1s. Then a process begins of applying successive 8-bit bytes of
the message to the current contents of the register. Only the eight bits of data in each character are used to generating the
CRC. Start and stop bits, and the parity bit if one is used, do not apply to the CRC.
During generation of the CRC, each 8-bit character is exclusive ORed with the register contents. Then the result is shifted in
the direction of the least significant bit (LSB), with a zero filled into the most significant bit (MSB) position. The LSB is
extracted and examined. If the LSB was a 1, the register is then exclusive ORed with a preset, fixed value. If the LSB was
a 0, no exclusive OR takes place.
This process is repeated until eight shifts have been performed. After the last (eighth) shift, the next 8-bit byte is exclusive
ORed with the registers current value, and the process repeats for eight more shifts as described above. The final contents
of the register, after all the bytes of the message have been applied, is the CRC value.
E.g. 2
The query that reads the resistor 30001 in Slave device 1 is following. (Refer to 3.4 about query message)
0x01, 0x04, 0x00, 0x00, 0x00, 0x01, 0x31, 0xCA
For the above query message, the calculated value of CRC is 0xCA31. The lower-order byte in CRC is appended first,
consequently the message order is 0x31, 0xCA.
When the CRC is appended to the message, the low-order byte of the field is appended first, followed by the high-order byte.
EM-5650 Rev.10
2.3
Data Address
Data addresses are used in Modbus query messages when reading or modifying data. Four types of data are used: Coil,
Input Status, Input Register and Holding Register.
Coil
Coils are used to force the ON/OFF state of discrete outputs (DO) to the field, or to modify the mode or status of slave
devices. Coil data is either ON or OFF, which can be both read and modified. Valid addresses are in the range of 1 9999.
Input Status
Input Status is used for the ON/OFF state of discrete inputs (DI) from the field, or the status of slave devices. The input status
is either ON or OFF, which can be read only. Valid addresses are in the range of 10001 19999.
Input Register
Input registers are used for the value of analog inputs (AI) from the field, or the information of slave devices. The input
register is of 16-bit long, which can be read only. Valid addresses are in the range of 30001 39999. Floating or doublefloating data can be handled when consecutive addresses are assigned.
Holding Register
Holding registers are used for the value of analog outputs (AO) to the field, or to set information of slave devices. The holding
register is of 16-bit long, which can be both read and modified. Valid addresses are in the range of 40001 49999. Floating
or double-floating data can be handled when consecutive addresses are assigned.
EM-5650 Rev.10
Field Name
Header
Slave Address
Function
Starting Address Hi
Starting Address Lo
No. of Registers Hi
No. of Registers Lo
Error Check
Trailer
Example
(Hex)
0x06
0x03
0x00
0x6B
0x00
0x03
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 6
0 3
0 0
6 B
0 0
0 3
LRC (2 chars.)
CR LF
None
0x06
0x03
0x00
0x6B
0x00
0x03
CRC (16 bits)
None
17
Figure 4 is an example of a normal response from the slave to the master query shown in Figure 3. The slave response
echoes the slave address and function code. The Byte Count field specifies how many 8-bit data items are being returned.
Note that the value does not represent the actual character count transmitted in either ASCII or RTU mode. In this example,
the message contains three sets of 16-bit data, therefore the Byte Count is 6 regardless of the character framing method.
Field Name
Header
Slave Address
Function
Byte Count
Data 1 Hi
Data 1 Lo
Data 2 Hi
Data 2 Lo
Data 3 Hi
Data 3 Lo
Error Check
Trailer
Example
(Hex)
0x06
0x03
0x06
0x03
0xE8
0x01
0xF4
0x00
0x0A
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 6
0 3
0 6
0 3
E 8
0 1
F 4
0 0
0 A
LRC (2 chars.)
CR LF
None
0x06
0x03
0x06
0x03
0xE8
0x01
0xF4
0x00
0x0A
CRC (16 bits)
None
23
11
EM-5650 Rev.10
3.
Field Name
Header
Slave Address
Function
Starting Address Hi
Starting Address Lo
No. of Registers Hi
No. of Registers Lo
Error Check
Trailer
Example
(Hex)
0x03
0x01
0x00
0x13
0x00
0x25
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 3
0 1
0 0
1 3
0 0
2 5
LRC (2 chars.)
CR LF
None
0x03
0x01
0x00
0x13
0x00
0x25
CRC (16 bits)
None
17
Response
The coil status in the response message is packed as one coil per bit of the data field. Status is indicated as: 1 = ON, 0 = OFF.
The LSB of the first data byte contains the coil addressed in the query.
For example, when the status of coils 20 27 is shown ON ON OFF OFF ON OFF ON OFF, represented as the
byte value binary 0101 0011 (0x53). One byte contains the status for eight coils. If the coil quantity is not a multiple of eight,
the remaining bits in the final data byte will be padded with zeros.
Figure 6 shows an example of a response to the query shown in Figure 5.
Field Name
Header
Slave Address
Function
Byte Count
Data 1
Data 2
Data 3
Data 4
Data 5
Error Check
Trailer
Example
(Hex)
0x03
0x01
0x05
0x53
0x6B
0x01
0xF4
0x1B
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 3
0 1
0 5
5 3
6 B
0 1
F 4
1 B
LRC (2 chars.)
CR LF
None
0x03
0x01
0x05
0x53
0x6B
0x01
0xF4
0x1B
CRC (16 bits)
None
21
10
EM-5650 Rev.10
Field Name
Header
Slave Address
Function
Starting Address Hi
Starting Address Lo
No. of Registers Hi
No. of Registers Lo
Error Check
Trailer
Example
(Hex)
0x03
0x02
0x00
0x64
0x00
0x14
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 3
0 2
0 0
6 4
0 0
1 4
LRC (2 chars.)
CR LF
None
0x03
0x02
0x00
0x64
0x00
0x14
CRC (16 bits)
None
17
Response
The construction of the response message is the same as that for Real Coil Status (01) operation.
Figure 8 shows an example of a response to the query shown in Figure 7.
Field Name
Header
Slave Address
Function
Byte Count
Data 1
Data 2
Data 3
Error Check
Trailer
Example
(Hex)
0x03
0x02
0x03
0x53
0x6B
0x01
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 3
0 2
0 3
5 3
6 B
0 1
LRC (2 chars.)
CR LF
None
0x03
0x02
0x03
0x53
0x6B
0x01
CRC (16 bits)
None
17
EM-5650 Rev.10
10
Field Name
Header
Slave Address
Function
Starting Address Hi
Starting Address Lo
No. of Registers Hi
No. of Registers Lo
Error Check
Trailer
Example
(Hex)
0x07
0x03
0x00
0xC8
0x00
0x03
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 7
0 3
0 0
C 8
0 0
0 3
LRC (2 chars.)
CR LF
None
0x07
0x03
0x00
0xC8
0x00
0x03
CRC (16 bits)
None
17
Response
The register data in the response message are packed as 16 bits per register. Figure 10 shows an example of a response to
the query shown in Figure 9.
Field Name
Header
Slave Address
Function
Byte Count
Data 1 Hi
Data 1 Lo
Data 2 Hi
Data 2 Lo
Data 3 Hi
Data 3 Lo
Error Check
Trailer
Example
(Hex)
0x07
0x03
0x06
0x03
0xE8
0x01
0xF4
0x00
0x0A
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 7
0 3
0 6
0 3
E 8
0 1
F 4
0 0
0 A
LRC (2 chars.)
CR LF
None
0x07
0x03
0x06
0x03
0xE8
0x01
0xF4
0x00
0x0A
CRC (16 bits)
None
23
11
EM-5650 Rev.10
11
Field Name
Header
Slave Address
Function
Starting Address Hi
Starting Address Lo
No. of Registers Hi
No. of Registers Lo
Error Check
Trailer
Example
(Hex)
0x07
0x04
0x01
0x2C
0x00
0x03
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 7
0 4
0 1
2 C
0 0
0 3
LRC (2 chars.)
CR LF
None
0x07
0x04
0x01
0x2C
0x00
0x03
CRC (16 bits)
None
17
Response
The register data in the response message are packed as 16 bits per register. Figure 12 shows an example of a response to
the query shown in Figure 11.
Field Name
Header
Slave Address
Function
Byte Count
Data 1 Hi
Data 1 Lo
Data 2 Hi
Data 2 Lo
Data 3 Hi
Data 3 Lo
Error Check
Trailer
Example
(Hex)
0x07
0x04
0x06
0x03
0xE8
0x01
0xF4
0x00
0x0A
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 7
0 4
0 6
0 3
E 8
0 1
F 4
0 0
0 A
LRC (2 chars.)
CR LF
None
0x07
0x04
0x06
0x03
0xE8
0x01
0xF4
0x00
0x0A
CRC (16 bits)
None
23
11
EM-5650 Rev.10
12
Field Name
Header
Slave Address
Function
Starting Address Hi
Starting Address Lo
No. of Registers Hi
No. of Registers Lo
Error Check
Trailer
Example
(Hex)
0x03
0x05
0x00
0x95
0xFF
0x00
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 3
0 5
0 0
9 5
F F
0 0
LRC (2 chars.)
CR LF
None
0x03
0x05
0x00
0x95
0xFF
0x00
CRC (16 bits)
None
17
Response
The normal response is an echo of the query. Figure 14 shows an example of a response to the query shown in Figure 13.
Field Name
Header
Slave Address
Function
Starting Address Hi
Starting Address Lo
No. of Registers Hi
No. of Registers Lo
Error Check
Trailer
Example
(Hex)
0x03
0x05
0x00
0x95
0xFF
0x00
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 3
0 5
0 0
9 5
F F
0 0
LRC (2 chars.)
CR LF
None
0x03
0x05
0x00
0x95
0xFF
0x00
CRC (16 bits)
None
17
EM-5650 Rev.10
13
Field Name
Header
Slave Address
Function
Starting Address Hi
Starting Address Lo
No. of Registers Hi
No. of Registers Lo
Error Check
Trailer
Example
(Hex)
0x03
0x06
0x00
0x95
0x03
0xE8
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 3
0 6
0 0
9 5
0 3
E 8
LRC (2 chars.)
CR LF
None
0x03
0x06
0x00
0x95
0x03
0xE8
CRC (16 bits)
None
17
Response
The normal response is an echo of the query. Figure 16 shows an example of a response to the query shown in Figure 15.
Field Name
Header
Slave Address
Function
Starting Address Hi
Starting Address Lo
No. of Registers Hi
No. of Registers Lo
Error Check
Trailer
Example
(Hex)
0x03
0x06
0x00
0x95
0x03
0xE8
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 3
0 6
0 0
9 5
0 3
E 8
LRC (2 chars.)
CR LF
None
0x03
0x06
0x00
0x95
0x03
0xE8
CRC (16 bits)
None
17
EM-5650 Rev.10
14
Field Name
Header
Slave Address
Function
Subfunction Hi
Subfunction Lo
Data Hi
Data Lo
Error Check
Trailer
Example
(Hex)
0x05
0x08
0x00
0x00
0x03
0xE8
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 5
0 8
0 0
0 0
0 3
E 8
LRC (2 chars.)
CR LF
None
0x05
0x08
0x00
0x00
0x03
0xE8
CRC (16 bits)
None
17
Response
The normal response to the Return Query Data request is a loopback of the same data. Figure 18 shows an example of a
response to the query shown in Figure 17.
Field Name
Header
Slave Address
Function
Subfunction Hi
Subfunction Lo
Data Hi
Data Lo
Error Check
Trailer
Example
(Hex)
0x05
0x08
0x00
0x00
0x03
0xE8
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 5
0 8
0 0
0 0
0 3
E 8
LRC (2 chars.)
CR LF
None
0x05
0x08
0x00
0x00
0x03
0xE8
CRC (16 bits)
None
17
EM-5650 Rev.10
15
Field Name
Header
Slave Address
Function
Error Check
Trailer
Example
(Hex)
0x05
0x0B
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 5
0 B
LRC (2 chars.)
CR LF
None
0x05
0x0B
CRC (16 bits)
None
Response
The normal response contains a two-byte status word, and a two-byte event count. Figure 20 shows an example of a
response to the query shown in Figure 19.
Field Name
Header
Slave Address
Function
Status Hi
Status Lo
Event Count Hi
Event Count Lo
Error Check
Trailer
Example
(Hex)
0x05
0x0B
0x00
0x00
0x03
0xE8
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 5
0 B
0 0
0 0
0 3
E 8
LRC (2 chars.)
CR LF
None
0x05
0x0B
0x00
0x00
0x03
0xE8
CRC (16 bits)
None
17
EM-5650 Rev.10
16
Field Name
Header
Slave Address
Function
Error Check
Trailer
Example
(Hex)
0x05
0x0C
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 5
0 C
LRC (2 chars.)
CR LF
None
0x05
0x0C
CRC (16 bits)
None
Response
The normal response contains a two-byte status word, and a two-byte event count field, a two-byte message count field, and
a field containing 0 64 bytes of events. A byte count field defines the total length of the data in these four fields.
Figure 22 shows an example of a response to the query shown in Figure 21.
Field Name
Header
Slave Address
Function
Byte Count
Status Hi
Status Lo
Event Count Hi
Event Count Lo
Message Count Hi
Message Count Lo
Event 0
Event 1
Error Check
Trailer
Example
(Hex)
0x05
0x0C
0x08
0x00
0x00
0x01
0xE8
0x01
0xF6
0x20
0x00
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 5
0 C
0 8
0 0
0 0
0 1
E 8
0 1
F 6
2 0
0 0
LRC (2 chars.)
CR LF
None
0x05
0x0C
0x08
0x00
0x00
0x01
0xE8
0x01
0xF6
0x20
0x00
CRC (16 bits)
None
25
12
EM-5650 Rev.10
17
Coil
27
26
25
24
23
22
21
20
...
...
...
...
...
30
29
28
Note that the Starting Address is of 19 or 0x13, less than the coil 20 by 1.
Field Name
Header
Slave Address
Function
Starting Address Hi
Starting Address Lo
Quantity of Coils Hi
Quantity of Coils Lo
Byte Count
Force Data Hi
Force Data Lo
Error Check
Trailer
Example
(Hex)
0x05
0x0F
0x00
0x13
0x00
0x0B
0x02
0xD1
0x05
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 5
0 F
0 0
1 3
0 0
0 B
0 2
D 1
0 5
LRC (2 chars.)
CR LF
None
0x05
0x0F
0x00
0x13
0x00
0x0B
0x02
0xD1
0x05
CRC (16 bits)
None
23
11
Response
The normal response returns the slave address, function code, starting address, and quantity of coils forced, excluding byte
count and force data in the query.
Figure 24 shows an example of a response to the query shown in Figure 23.
Field Name
Header
Slave Address
Function
Starting Address Hi
Starting Address Lo
Quantity of Coils Hi
Quantity of Coils Lo
Error Check
Trailer
Example
(Hex)
0x05
0x0F
0x00
0x13
0x00
0x0B
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 5
0 F
0 0
1 3
0 0
0 B
LRC (2 chars.)
CR LF
None
0x05
0x0F
0x00
0x13
0x00
0x0B
CRC (16 bits)
None
17
EM-5650 Rev.10
18
data 0x0164
data 0x0165
data 0x0166
Note that the Starting Address is of 19 or 0x13, less than the register 40020 by 40001.
Field Name
Header
Slave Address
Function
Starting Address Hi
Starting Address Lo
No. of Registers Hi
No. of Registers Lo
Byte Count
Data 1 Hi
Data 1 Lo
Data 2 Hi
Data 2 Lo
Data 3 Hi
Data 3 Lo
Error Check
Trailer
Example
(Hex)
0x05
0x10
0x00
0x13
0x00
0x03
0x06
0x01
0x64
0x01
0x65
0x01
0x66
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 5
1 0
0 0
1 3
0 0
0 3
0 6
0 1
6 4
0 1
6 5
0 1
6 6
LRC (2 chars.)
CR LF
None
0x05
0x10
0x00
0x13
0x00
0x03
0x06
0x01
0x64
0x01
0x65
0x01
0x66
CRC (16 bits)
None
31
15
Response
The normal response returns the slave address, function code, starting address, and quantity of registers preset, excluding
byte count and preset data in the query. Figure 26 shows an example of a response to the query shown in Figure 25.
Field Name
Header
Slave Address
Function
Starting Address Hi
Starting Address Lo
No. of Registers Hi
No. of Registers Lo
Error Check
Trailer
Example
(Hex)
0x05
0x10
0x00
0x13
0x00
0x03
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 5
1 0
0 0
1 3
0 0
0 3
LRC (2 chars.)
CR LF
None
0x05
0x10
0x00
0x13
0x00
0x03
CRC (16 bits)
None
17
19
Field Name
Header
Slave Address
Function
Error Check
Trailer
Example
(Hex)
0x05
0x11
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 5
1 1
LRC (2 chars.)
CR LF
None
0x05
0x11
CRC (16 bits)
None
Response
A typical example of a normal response, with slave ID, RUN indicator status, and other device specific data, is shown below.
Figure 28 shows an example of a response to the query shown in Figure 27.
Field Name
Header
Slave Address
Function
Byte Count
Slave ID
RUN Indicator Status
Additional Data
:
Error Check
Trailer
Example
(Hex)
0x05
0x11
Device Specific
Device Specific
0xFF
Device Specific
:
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 5
1 1
Device Specific
Device Specific
F F
Device Specific
:
LRC (2 chars.)
CR LF
None
0x05
0x11
Device Specific
Device Specific
0xFF
Device Specific
:
CRC (16 bits)
None
Device Specific
Device Specific
EM-5650 Rev.10
20
4.
0x00, 0x00
0x00, 0x01
0x00, 0x01
0x00, 0x02
0x00, 0x00
0x00, 0x04
0x00, 0x00
No Response Returned
0x00, 0x0A
0x00, 0x00
0x00, 0x0B
0x00, 0x00
0x00, 0x0C
0x00, 0x00
EM-5650 Rev.10
21
0x00, 0x0D
0x00, 0x00
0x00, 0x0E
0x00, 0x00
0x00, 0x0F
0x00, 0x00
0x00, 0x11
0x00, 0x00
0x00, 0x12
0x00, 0x00
EM-5650 Rev.10
22
5.
Exception Responses
Except for broadcast messages, when a master device sends a query to a slave device it expects a normal response. One
of four possible events can occur from the masters query:
If the slave device receives the query without a communication error, and can handle the query normally, it returns a
normal response.
If the slave does not receive the query due to a communications error, no response is returned. The master program will
eventually process a timeout condition for the query.
If the slave receives the query, but detects a communication error (parity, LRC, or CRC), no response is returned. The
master program wil eventually process a timeout condition for the query.
If the slave receives the query without a communication error, but cannot handle it (for example, if the request is to read a
non-existent coil or register), the slave will return an exception response informing the master of the nature of the error.
The exception response message contains Slave Address, Function Code Field, and Data Field.
In an exception response, the slave echoes the slave address in the query, and sets the most-significant bit of the function
code to 1. This makes the masters application program recognize the exception response and examine the data field for the
exception code.
Figure 29 shows an example of a master query.
Field Name
Header
Slave Address
Function
Starting Address Hi
Starting Address Lo
No. of Registers Hi
No. of Registers Lo
Error Check
Trailer
Example
(Hex)
0x07
0x04
0x01
0x2C
0x00
0x03
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 7
0 4
0 1
2 C
0 0
0 3
LRC (2 chars.)
CR LF
None
0x07
0x04
0x01
0x2C
0x00
0x03
CRC (16 bits)
None
17
If the input register 30301 does not exist, the slave returns an exception response as shown in Figure 30.
Field Name
Header
Slave Address
Function
Exception Code
Error Check
Trailer
Example
(Hex)
0x07
0x84
0x02
Total Bytes:
ASCII
Characters
RTU
8-Bit Field (Hex)
: (colon)
0 7
8 4
0 2
LRC (2 chars.)
CR LF
None
0x07
0x84
0x02
CRC (16 bits)
None
11
EM-5650 Rev.10
23
Exception Codes:
Code
Name
Meaning
01
ILLEGAL FUNCTION
02
The data address received in the query is not an allowable address for the slave.
03
EM-5650 Rev.10
24
Name*
Notes
01 (0x01)
Reading DO
02 (0x02)
Reading DI
03 (0x03)
04 (0x04)
05 (0x05)
06 (0x06)
15 (0x0F)
16 (0x10)
Writing single DO
Writing multiple DO
Type
J3
A1
D1
Data Name
Format
Coil (0X)
1 32
33 48
--Y
-----
-----
Y
---
DO
Cold junction compensation SW
Input Status
(1X)
1 32
33 48
Y
Y
Y
Y
Y
---
-----
DI
ADC overrange
Input Register
(3X)
1 16
17 48
49 50
81 96
513
514 521
522 529
530 537
538 545
Y
Y
Y
Y
Y
Y
Y
Y
Y
--Y
--Y
Y
Y
Y
Y
Y
--------Y
Y
Y
Y
Y
--------Y
Y
Y
Y
Y
I
F
F
I
I
B16
B16
B16
B16
Holding Register
(4X)
1 16
17 48
145 160
161 176
----Y
Y
----Y
---
---------
---------
I
F
I
I
AI in %
AI per channel in engineering unit
Cold junction temperature
Channel status
System status
Model No.
Serial No.
Hardware version No.
Firmware version No.
(Reserved for AO in %)
(Reserved for AO in engineering unit)
I/O type No.
Burnout type
EM-5650 Rev.10
25
Sign
Exponent
Address n+1
Mantissa
EM-5650 Rev.10
26
20V
5V
1V
0.8V
0.2V
50mV
10mV
Thermocouple
20000
5000
10000
8000
20000
5000
10000
Temperature x 10
Name
Description
Input Overrange
ADC Error
12
Reserved
Others
EM-5650 Rev.10
27
Name
Description
03
Reserved
Reserved
Reserved
E2PROM Diagnostics
ADC Error
8 15
Reserved
EM-5650 Rev.10
28
I/O
I/O Type
Selection
Usable Range
Notes
DC input
0x00
0x01
0x02
0x03
0x04
0x05
0x06
-20 20 V
-5 5 V
-1 1 V
-800 800 mV
-200 200 mV
-50 50 mV
-10 10 mV
-22.7 22.7 V
-5.6 5.6 V
-1.4 1.4 V
-860 860 mV
-215 215 mV
-53 53 mV
-13.4 13.4 mV
ATT SW ON
ATT SW ON
ATT SW ON
T/C input
0x10
0x11
0x12
0x13
0x14
0x15
0x16
0x17
0x18
0x19
0x1A
0x1B
0x1C
K
E
J
T
B
R
S
C
N
U
L
P
RTD input
0x30
0x31
0x32
0x33
0x34
0x35
-200 500 C
-200 660 C
-200 850 C
-200 649 C
-50 280 C
-200 850 C
POT input
0x40
0x41
0x42
0x43
0 100 ohms
0 500 ohms
0 1k ohms
0 10k ohms
0 100 %
0 100%
0 100 %
0 100 %
R1M-D1
DO
0x60
R1M-A1
DI
0x70
R1M-GH2
R1M-J3
(PR)
(CA)
(CRC)
(IC)
(CC)
(RH)
(WRe 5-26)
(Platinel II)
0 1760 C
-270 1370 C
-270 1000 C
-210 1200 C
-270 400 C
100 1820 C
-50 1760 C
-50 1760 C
0 2320 C
-270 1300 C
-200 600 C
-200 900 C
0 1395 C
EM-5650 Rev.10
29
Name*
Notes
01 (0x01)
Reading DO
02 (0x02)
Reading DI
03 (0x03)
04 (0x04)
05 (0x05)
06 (0x06)
15 (0x0F)
16 (0x10)
Writing single DO
Writing multiple DO
Name
Coil (0X)
1 32
33 40
Y
Y
DO
Cold junction compensation SW
Input Status
(1X)
1 32
33 40
Y
Y
DI
ADC overrange
17 32
49 50
81 96
513
514 521
522 529
530 537
538 545
Y
Y
Y
Y
Y
Y
Y
Y
F
F
I
I
B16
I
I
B16
Holding Register 49 50
(4X)
145 152
514
Y
Y
Y
F
I
I
Input Register
(3X)
Sign
EM-5650 Rev.10
Exponent
Address n+1
Mantissa
30
Name
Description
Input Overrange
ADC Error
12
Reserved
Others
EM-5650 Rev.10
31
Name
Description
03
Reserved
Reserved
Reserved
E2PROM Diagnostics
ADC Error
8 15
Reserved
EM-5650 Rev.10
32
I/O
I/O Type
Selection
-10 10 V
R2M-2G3
DC input
0x00
R2M-2H3
T/C input
0x10
0x11
0x12
0x13
0x14
0x15
0x16
0x17
0x18
0x19
0x1A
0x1B
0x1C
(PR)
(CA)
(CRC)
(IC)
(CC)
(RH)
K
E
J
T
B
R
S
C (WRe 5-26)
N
U
L
P (Platinel II)
Usable Range
Notes
-10 10 V
0 1760 C
-270 1370 C
-270 1000 C
-210 1200 C
-270 400 C
100 1820 C
-50 1760 C
-50 1760 C
0 2320 C
-270 1300 C
-200 600 C
-200 900 C
0 1395 C
EM-5650 Rev.10
33
C-1 Introduction
Modbus TCP/IP protocol is an expansion of the widely used Modbus protocol into TCP/IP network, which enables Modbus
Request/Response transaction on the internet.
In Modbus TCP/IP using Client/Server model for communication, Modbus Master is replaced by Client, Slave by Server.
Multiple client/servers are supported, i.e. multiple masters/slaves.
One of the well-known ports, No. 502 is used.
Modbus
START
ADDRESS
FUNCTION
DATA
CRC or LRC
END
Modbus
TCP/IP
TRANSACTION
IDENTIFIER
PROTOCOL
IDENTIFIER
LENGTH
UNIT
IDENTIFIER
FUNCTION
DATA
Byte 0, 1
Byte 2, 3
Byte 4, 5
Byte 6
Byte 7
Byte 8
EM-5650 Rev.10
34
C-3 Example
Request
Response
:5
Request
: 00 00 00 00 00 06 09 03 00 04 00 01
Response
: 00 00 00 00 00 05 03 02 00 05
EM-5650 Rev.10
35
M-SYSTEM WARRANTY
1. What is covered.
M-System Co., Ltd. (M-System) warrants, only to the original
purchaser of new M-System products purchased directly from MSystem, or from M-Systems authorized distributors or resellers, for its
own use not for resale, that the M-System products shall be free from
defects in materials and workmanship and shall conform to the specifications set forth in the product catalogue applicable to the M-System
products for the Warranty Period (see Paragraph 5 below for the
Warranty Period of each product).
THE ABOVE WARRANTY IS THE ONLY WARRANTY APPLICABLE TO THE M-SYSTEM PRODUCTS AND IS IN LIEU OF ALL
OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES OF MERCHANTABILITY OR OF FITNESS FOR A PARTICULAR PURPOSE.
4. Warranty Procedure.
If the purchaser discovers a failure of the M-System products to
conform to the terms of this warranty within the Warranty Period, the
purchaser must promptly (and, in any event not more than 30 days after
the discovery of such failure) notify the relevant party as described
below either by telephone or in writing at the below address to obtain an
Authorized Return (AR) number and return the defective product to the
relevant party. The designated AR number should be marked on the
outside of the return package and on all correspondence related to the
defective product. The purchaser shall return, at purchasers expense,
defective products only upon receiving an AR number. In order to avoid
processing delays, the purchaser must include: copies of the original
purchase order and sales invoice; the purchasers name, address and
phone number; the model and serial numbers of the returned product;
and a detailed description of the alleged defect.
5. Warranty Period.
Signal Conditioner: 36 months from the date of purchase.
M-Rester:
12 months from the date of purchase.
Valve Actuator:
18 months from the date of shipment from
M-System or 12 months from the date of its
installation, whichever comes first.
Other Products:
36 months from the date of purchase.
3. Remedies.
If a defective product is returned to M-System in accordance with the
procedures described below, M-System will, at its sole option and
expense, either: (1) repair the defective product; (2) replace the
defective product; or (3) refund the purchase price for the defective
product paid by the purchaser. Except as otherwise provided by
applicable state law, these remedies constitute the purchasers sole and
exclusive remedies and M-Systems sole and exclusive obligation under
this warranty.