DC5xD MODBUS - Communication Protocol - V1.0-20210710
DC5xD MODBUS - Communication Protocol - V1.0-20210710
DC5xD MODBUS - Communication Protocol - V1.0-20210710
Software Version
No. Version Date Note
1 V1.0 2021-06-30 Original release.
Notes:
1. All rights reserved. No part of this duplication may be reproduced in any material
form (including photocopying or storing in any medium by electronic means or others)
without the written permission of the copyright holder.
2. MEBAY Technology reserves the rights to change the contents of this document
without prior notice.
DC5xD CONTROLLER COMMUNICATION PROTOCOL
Catalogue
Summary................................................................................................................................... 3
Communication rules............................................................................................................... 3
Address code.................................................................................................................... 3
Function code................................................................................................................... 4
Data area........................................................................................................................... 4
CRC code.......................................................................................................................... 5
Error handling................................................................................................................... 7
2
DC5xD CONTROLLER COMMUNICATION PROTOCOL
Summary
This communication protocol describes in detail the read and write command
format of this machine's serial port communication and the definition of internal
information data for third-party development and use.
The MODBUS communication protocol allows the effective transmission of
information and data between the controller and a third-party programmable
sequence device (PLC), RTU, SCADA system, DCS, or a third-party MODBUS
compatible monitoring system. A set of monitoring system can be established by
adding a set of central communication master control display software based on PC
(or industrial computer).
Communication rules
When a communication command is sent to the instrument, the device that matches
the corresponding address code receives the communication command, removes the
address code, reads the information, and if there is no error, executes the
corresponding task, and then returns the execution result to the sender. The returned
information includes the address code, the function code to execute the action, the
data after the action is executed, and the error check code (CRC). If there is an error,
no information will be sent.
Address code
The address code is the first data frame (8 bits) in the information frame transmitted
in each communication. The address range of the device is 1-255. This byte indicates
3
DC5xD CONTROLLER COMMUNICATION PROTOCOL
that the slave of the address code set by the user will receive the information sent by
the master, and each slave has a unique address code, and the response is sent
back with its own The address code starts. The address code sent by the host
indicates the address of the slave machine to be sent to, and the address code sent
by the slave machine indicates the address of the slave machine sent back.
Function code
The function code is the second data transmitted in each communication. The
MODBUS communication protocol defines the function code as 1-255 (01H-0FFH).
This machine uses part of the function codes. Send as a host request, tell the slave
what action to perform through the function code. As the slave machine response,
the function code sent by the slave machine is the same as the function code sent by
the master, and it indicates that the slave machine has responded to the operation of
the master. If the highest bit of the function code sent by the slave is 1 (function
code>127), it indicates that the slave has no response or an error.
The following table lists the specific meanings and operations of the function codes.
Function definition operational
code
03H Read register Read one or more register data
10H Write register Write keyboard register data
Data area
The data area varies with the function code.
1. The format of the data area corresponding to the function code 03H:
Host sends:
Data sequence 1 2
Data meaning Initial address Number of read registers
Number of bytes 2 2
Slave response
Data sequence 1 2
Data meaning Number of bytes sent N register data
4
DC5xD CONTROLLER COMMUNICATION PROTOCOL
back
Number of bytes 1 N
Slave response
Data sequence 1 2
Data meaning Register address Register value
Number of bytes 2 2
CRC code
The master or slave can use the check code to judge whether the received
information is wrong. Sometimes, due to electronic noise or some other interference,
the information will change slightly during the transmission. The error check code
ensures that the host or slave does not work on the information that is wrong during
the transmission. This increases the safety and efficiency of the system. The error
check code adopts the CRC-16 check method.
Two-byte error check code, high byte first, low byte last (can be set to low byte first
and high byte last through the controller).
Note: The format of the information frame is the same: address code, function code,
data area and error check code.
Redundant cyclic code (CRC) contains 2 bytes, namely 16-bit binary. The CRC code
is calculated by the sender and placed at the end of the sent message. The device at
the receiving end recalculates whether the CRC code of the received message is the
same as the received one. If the two are different, it indicates an error.
The calculation method of the CRC code is to first preset the 16-bit registers to all 1.
Then gradually process every 8 bits of data information. When calculating the CRC
code, only 8 data bits are used, and the start bit and stop bit do not participate in the
CRC code calculation.
When calculating the CRC code, the 8-bit data is different from the register data. The
result obtained is shifted by one bit to the lower bit, and the highest bit is filled with 0.
Check the lowest bit again, if the lowest bit is 1, XOR the contents of the register with
the preset number, if the lowest bit is 0, no XOR operation will be performed.
This process has been repeated many times. After the 8th shift, the next 8 bits are
different from the contents of the current register. This process is repeated 8 times as
last time. When all the data information is processed, the content of the final register
is the CRC code value.
5
DC5xD CONTROLLER COMMUNICATION PROTOCOL
2. XOR an 8-bit data with the lower 8 bits of the CRC register, and put the result in
the CRC register;
3. Shift the content of the CRC register to the right by one bit, fill the highest bit with 0,
and check the shifted out bit;
4. If the lowest bit is 0: repeat step 3 (shift again), If the lowest bit is 1: The CRC
register is XORed with the hexadecimal number A001;
5. Repeat steps 3 and 4 until the right shift is 8 times, so that the entire 8-bit data has
been processed;
6. Repeat steps 2 to 5 for the next data processing;
7. The final CRC register value is the CRC code. When transmitting, the lower 8 bits
are sent first, and the upper 8 bits are sent last.
Note: The calculation of the CRC code starts from the <slave address>, except for all
the bytes of the <CRC code>.
6
DC5xD CONTROLLER COMMUNICATION PROTOCOL
Error handling
If the information received from the host is wrong, it will be ignored by the device.
7
DC5xD CONTROLLER COMMUNICATION PROTOCOL
8
DC5xD CONTROLLER COMMUNICATION PROTOCOL
9
DC5xD CONTROLLER COMMUNICATION PROTOCOL
11
DC5xD CONTROLLER COMMUNICATION PROTOCOL
12
DC5xD CONTROLLER COMMUNICATION PROTOCOL
36 Reserve
37 Reserve
38 Reserve
39 Maintenance expire
40 Reserve
41 Reserve
42 Reserve
43 Reserve
44 Low water level switch
45 Shades open abnormal
46 Emergency stop
47 Crank failure
48 Stop failure/ with RPM
49 Stop failure/ with Hz
50 Stop failure/ with oil pressure
51 Stop failure/ oil pressure switch
52 Reserve
Warning code table
Address Item Explain Length
1047H None Valid for 1 1Bit
Reserve Valid for 1 1Bit
Reserve Valid for 1 1Bit
Low oil pressure sensor Valid for 1 1Bit
Low oil pressure switch Valid for 1 1Bit
High water temperature sensor Valid for 1 1Bit
High water temperature switch Valid for 1 1Bit
Reserve Valid for 1 1Bit
Reserve Valid for 1 1Bit
Reserve Valid for 1 1Bit
Reserve Valid for 1 1Bit
Reserve Valid for 1 1Bit
Reserve Valid for 1 1Bit
Low fuel level sensor Valid for 1 1Bit
Low fuel level switch Valid for 1 1Bit
Reserve Valid for 1 1Bit
Reserve Valid for 1 1Bit
1046H Instant alarm switch Valid for 1 1Bit
Reserve Valid for 1 1Bit
RPM Signal lost Valid for 1 1Bit
Oil pressure sensor open Valid for 1 1Bit
Water temperature sensor open Valid for 1 1Bit
Reserve Valid for 1 1Bit
Reserve Valid for 1 1Bit
Reserve Valid for 1 1Bit
Fuel level sensor open Valid for 1 1Bit
Reserve Valid for 1 1Bit
Reserve Valid for 1 1Bit
Reserve Valid for 1 1Bit
13
DC5xD CONTROLLER COMMUNICATION PROTOCOL
14