This article will go through the protocols supported by VisualHMI one by one, with a focus onModbus RTU master-slave modeAndframe format- as this is the part most relevant to readers of modbus.cn and the most common pitfall during debugging. The configuration items for other PLC protocols (FX2N/Delta/Xinye/Yonghong) are similar, and are listed at the end of the article.
I. DCBUS protocol (Dacai configuration protocol)
DCBUS is a commonly used configuration protocol for screen and proprietary motherboard docking, with the following frame structure:
| Field | Length | Description |
|---|---|---|
| Frame header | 2 bytes | Default 0xAA55, customizable |
| Station number | 1 byte | Default 0, 255 for broadcast |
| Length | 1 byte | Total bytes of function code + data + check |
| Function code | 1 byte | 0xF1 for write / 0xF2 for read |
| Address | 2 bytes | User area 0x0100~0xFFFF, System area <0x1000 |
| Data | n byte | Register value |
| Check | 2 bytes | CRC16 or reserved 0xCCCC |
CRC16 algorithm (C reference provided by Dacai, Modbus lookup table method):
uint16 MB_calc_crc16(uint8 *buffer, uint32 n){
uint16 crc = 0xffff;
for(i = 0; i < n; i++){
crc = crc ^ buffer[i];
for(j = 0; j > 1;
if(carry_flag == 1) crc = crc ^ 0xa001;
}
}
return crc;
}Write variable (0xF1) example, write 100 to 0x1000, station number 0, no CRC:
AA55 00 07 F1 1000 0064 CCCC
↑帧头 ↑站 ↑长度 ↑写 ↑地址 ↑值 ↑预留When station number is set to 1 and CRC is enabled:AA55 01 07 F1 1000 0064 7289, screen responseAA55 01 03 F1 E174.
Read variable (0xF2) example, read 0x1000 (assuming value 100):
主板请求: AA55 00 06 F2 1000 01 CCCC
屏返回: AA55 00 08 F2 1000 01 0064 CCCCII. XGUS Protocol
The default XGUS frame header is 0x5AA5, with a structure of: header (2) + length (1) + function code (1) + address (2) + data (n) + CRC16. There are two modes for switching screens:
模式1: 5AA5 03 80 03 XX // XX=画面ID
模式2: 5AA5 07 82 0084 5A01 XXXX // XXXX=画面IDIII. Modbus RTU (Key)
The screen supports standard Modbus-RTU, and can be set asmaster (Master)orslave (Slave).
3.1 Master mode ModbusMaster
The screen acts as a master to poll the attached slaves (instruments, frequency converters, PLCs). Key configuration items:
| Configuration item | Meaning |
|---|---|
| Maximum reads | Maximum bytes read per single instruction |
| Number of read intervals | Address intervals smaller than this value can be merged into one read instruction |
| Number of write retries | Maximum retries after write failure |
| Timeout | Milliseconds for waiting for slave response |
| Interval time | How long to delay after receiving a response before sending the next one |
| Write register command | Automatic (0x06 single write/0x10 multiple writes) or all use 0x10 |
| Offline optimized reading | After checking, the offline slave will no longer send requests |
| Number of slaves | Default: 1. For RS485 multi-slave interfaces, a maximum of 10 can be configured. For more, use LUA |
| Preset byte order | Default: big-endian. Floating-point/long integer types can be re-specified |
Supported function codes:0x01 0x02 0x03 0x04 0x05 0x06 0x0F 0x10.
3.2 Slave mode ModbusSlave
The screen acts as a Modbus slave, waiting for the host computer (PLC, gateway, your debugging software) to read. Configuration items:
| Configuration item | Meaning |
|---|---|
| Slave station number | Modbus address of this screen |
| Character interval | If it exceeds this ms, it is considered a frame break |
| Delay response | Respond after a delay after receiving the request |
Also supports the full set of function codes from 0x01 to 0x10. In slave mode, "screen write address/screen read address" can achieve screen and PLC screen linkage.
IV. PLC Protocols (FX2N/FX3U/Delta/Sinic-Tek/Yonghong)
These configuration items are highly consistent, with the following core differences listed:
| Protocol | Register addressing characteristics |
|---|---|
| FX2N | Short standard mode instructions (such as 02 30 31 30 30 30 30 32 03 35 36), long extended mode instructions with a large address range |
| FX3U | Similar to FX2N, with standard/extended modes |
| DELTA DVP | ASCII mode: STX + address + instruction + data + LRC check + CR LF |
| Sinic-Tek XC/XD | Standard Sinic-Tek PLC protocol |
| Yonghong FB | Standard Yonghong Protocol |
All PLC protocols have an "Synchronize Screen with PLC" option: screen changes are written to a specified PLC address, or the screen switches when a certain PLC address changes value (0xFFFF for automatic).
This document is compiled from the protocol description section of the VisualHMI development documentation of Guangzhou Dacai Technology (hmi-doc.gz-dc.com). The frame format and register configuration are faithfully preserved as per the original text. The copyright belongs to Dacai Technology. Emphasis and formatting are realigned here.
Leave a Reply