![Toky DW9L 3 Series Operation Manual Download Page 18](http://html1.mh-extra.com/html/toky/dw9l-3-series/dw9l-3-series_operation-manual_1125124018.webp)
16
7.1 MODBUS-RTU protocol
VII. Communication Protocol Description
7.2 Communication frame format description
7.1.1 Meter meets MODBUS-RTU communication protocol,adopts RS485 half-duplex communication to check 16-bit CRC. The meter does not return
the check error.
7.1.2 Data Format
The following chart shows the meaning of exception error codes:
7.1.3 Communication frame format
7.1.4 Communication exception handling
Start Bit
error code
Name
Description
0X01
0X02
0X03
0X04
Function code error
Variable address error
The limit of the data value
Incorrect or out of frame length
The meter received an unsupported function number
The data value sent by the host exceeds the data range corresponding to the instrument or the data
structure is incomplete
The function code and the communication frame length are inconsistent or request exceeds the limit
Frame Content
Bytes
Instructions
Slave Station Add
1
1
2
Valid slave address range is 1-247
The length of data that needs to be read or written
The location where the data area is stored when the slave executes a valid command. Different variables occupy different
number of registers, some address variables occupy two registers, 4 bytes of data, some variables occupy a register, 2
bytes of data, please use according to the actual situation
Function Code
Data Add
2
Data length
Slave station returns data or master data to be written
Variable
Data
The MODBUS-RTU mode uses 16-bit CRC. The sending device shall calculate CRC16 on each data in the parcel, and the
final result shall be stored in the test domain. The receiving device shall also calculate CRC16 on each data (other than the
check field) in the parcel and compare the result field check fields. Only the same package can be accepted.
If the master sends an illegal packet or if the master requests an invalid data register, an abnormal data response will be generated. This abnormal data response
consists of the slave address, function code, fault code, and check field. When the high-order bit position of the function code domain is 1, it indicates that the data
frame at this time is an abnormal response.
According to MODBUS communication requirements, abnormal response function code = request function code + 0x80; when abnormal response occurs,
the highest position of function number is 1. For example, if the host request function number is 0x04, the function number returned from the slave corresponds to
0x84.
7.1.5 Communication frame delay
7.2.1 Function Code“03”:Read multiple register input
Eg: The host reads the UA (A phase voltage), and it is measured that the A phase voltage is 220.0V. The UA's address code is 0x4000
because UA is a fixed-point number (4 bytes) and occupies 2 data registers. The corresponding hexadecimal data of 220.0V is:
0x0000898 (2200)
。
Host sent message format: (default high word first)
There should be an appropriate delay between the requests from the master station for the two frames. When the baud rate is 9600. In order
to ensure a correct response, it is recommended that a 300mS delay be reserved between the two frames. When the baud rate decreases,
the communication delay should increase appropriately.
2
CRC Check Code
Read one or more current register values
Writes the specified value to an internal register
0X03
0X06
0X10
Writes the specified value to multiple internal registers
Data Bit
Checking Bit
Stop Bit
1
8
None, Even, Odd checking(Programmable)
1
①
All RS485 loop communication should follow master and slave mode.In this way, information and data are transferred between a single master station and up
to 32 slave stations (monitoring devices);
②
The master station will initialize and control all the information transmitted on the RS485 communication loop;
③
In any case, communication cannot be started from a slave station
④
Communication on all RS485 loops takes place in a "packaged" manner. A data packet is a communication frame. A packet can contain up to 128 bytes.
⑤
The master station sends called request and the slave sends called response.
;
⑥
In any case, the slave can only respond to one request from the master station;
Hosting Sending
Slave address
Function Code
Start Add
Data Length
CRC Code
Bytes
1
1
2
2
2
Information Send
01
03
0x4000
0x0002
0xD1CB
Remark
Send to slave at address 01
Read register
Start Add
Read 2 registers (4 bytes in total)
The host calculates the CRC code
The host specified data location is over the range of the meter or an illegal register operation has been
received