8
For example, when the master sends request message setting 10H to the function code by mistake, slave
returns 90H by setting the MSB to 1, because the former is an illegal function.
For negative acknowledgement, the exception codes below are set to the data of the response messages
and returned to the master in order to inform it of what kind of error has occurred.
Exception code Contents
1 (01H) Illegal function (Non-existent function)
2 (02H) Illegal data address (Non-existent data address)
3 (03H) Illegal data value (Value out of the setting range)
17 (11H) Shinko protocol error code 4 (Status which cannot be set, e.g. AT is performing)
18 (12H) Shinko protocol error code 5 (During setting mode by keypad operation)
Data
Data differs depending on the function code.
A request message from the master side is composed of data item, number of data and setting data.
A response message from the slave side is composed of a number of byte, data and exception codes
in negative acknowledgements.
The number of data to be dealt with in one message is “1”. Therefore the number of data is fixed as (0001H).
The number of response byte is (02H).
Effective range of data is –32768 to 32767 (8000H to 7FFFH).
Error check: 16 bit data to detect communication errors. Refer to “(2) Error check of RTU mode” below.
(2) Error check of RTU mode
After calculating CRC-16 (Cyclic Redundancy Check) from the slave address to the end of data, the
calculated 16-bit data is appended to the end of message in sequence from low order to high order.
How to calculate CRC
In the CRC system, the information is divided by the polynomial series. The remainder is added to the
end of the information and transmitted. The generation of polynomial series is as follows.
(Generation of polynomial series: X16 + X 15 + X 2+ 1)
1Initialize the CRC-16 data (assumed as X) (FFFFH).
2Calculate exclusive OR (XOR) with the 1st data and X. This is assumed as X.
3Shift X one bit to the right. This is assumed as X.
4When a carry is generated as a result of the shift, XOR is calculated by X of 3and the fixed
value (A001H). This is assumed as X. If a carry is not generated, go to step 5.
5Repeat steps 3and 4until shifting 8 times.
6XOR is calculated with the next data and X. This is assumed as X.
7Repeat steps 3to 5.
8Repeat steps 3to 5up to the last data.
9Set X as CRC-16 to the end of message in sequence from low order to high order.
(3) Message example of RTU mode
Numerals written below the command represent number of characters.
1Reading (Slave address 1, PV)
• A request message from the master
The number of data means the data item to be read, and it is fixed as 1 (0001H).
3.5 idle
characters
Slave
address
(01H)
Function
code
(03H)
Data item
(0080H)
Number of data
(0001H)
Error check
CRC-16
(85E2H)
3.5 idle
characters
1 1 2 2 2
• Response message from the slave in normal status [When PV=600 (0258H)]
The number of response byte means the number of byte of the data which has been read,
and it is fixed as 2 (02H).
3.5 idle
characters
Slave
address
(01H)
Function
code
(03H)
Number of
response byte
(02H)
Data
(0258H)
Error check
CRC-16
(B8DEH)
3.5 idle
characters
1 1 1 2 2
2Reading (Slave address 1, SV)
• A request message from the master
The number of data means the data item to be read, and it is fixed as 1 (0001H).
3.5 idle
characters
Slave
address
(01H)
Function
code
(03H)
Data item
(0001H)
Number of data
(0001H)
Error check
CRC-16
(D5CAH)
3.5 idle
characters
1 1 2 2 2
• Response message from the slave in normal status [When SV=600 (0258H)]
The number of response byte means the number of byte of the data which has been read, and it is fixed as 2 (02H).
3.5 idle
characters
Slave
address
(01H)
Function
code
(03H)
Number of
response byte
(02H)
Data
(0258H)
Error check
CRC-16
(B8DEH)
3.5 idle
characters
1 1 1 2 2