VisualHMI virtual screen debugging: VSPD virtual serial port + Modbus Slave/Poll joint debugging practice

freeFree Technical Resource

This content is free to read, suitable for basic learning and search traffic.

The virtual screen is a flagship feature of VisualHMI: without connecting to a real machine, you can run the UI on a computer, and then use virtual serial ports to debug with real PLC/Modbus simulation software. This article will thoroughly explain three debugging methods, especially the one most commonly used for Modbus development.

1. Install a virtual serial port driver (VSPD) first.

The virtual screen and VisualHMI software communicate through a pair of virtual serial ports. Use VSPD (Virtual Serial Port Driver) to create a pair of associated serial ports (such as COM8 ↔ COM9), with the virtual screen and software each occupying one end.

The virtual serial portdoes not care about baud rate/data bits/stop bits/parity, as long as they are paired, they can communicate. The numbering should not conflict with physical serial ports, and try to keep it within 10, otherwise they may conflict.

2. Mutual debugging between VisualHMI and virtual screen (DCBUS / XGUS)

This method is suitable for DCBUS and XGUS native protocols. Steps:

  1. Run the virtual screen, select virtual serial port COM8, and open the serial port
  2. VisualHMI software selects virtual serial port COM9, click connect
  3. Open the command assistant, select DCBUS as the protocol, configure the frame header0xAA55, enable CRC, and set the station number to 0
  4. Write variable: address 1000, data 0003; system register0x0100switch screen write 0001 → virtual screen switch to screen 1
The system register for XGUSII mode screen switching is0084(not DCBUS 0100); the XGUS frame header is0x5AA5. The frame header/screen switching registers for the two protocols are different, please fill in according to your actual project protocol.

3. Virtual screen + third-party PLC simulator (Modbus is the most commonly used)

For Modbus projects, this is your daily 80% debugging posture:

  • screen ashost: useModbus Slave(simulated slave) to connect to the other end of the virtual serial port, the screen reads 4x0000 hold register, change the value in Slave, and the screen changes in real time
  • screen asSlave: UseModbus Poll(simulated master) to poll the screen and verify whether the frames returned by the screen are correct.
Verification process for the screen acting as the master station, station number 1, read-write 4x0000: Set 4x0000 = a certain value in Modbus Slave → Attach the virtual screen → Bind the numeric control to 4x0000 → You can see the 'PLC' data displayed on the screen without using a physical cable. It's ten times faster than connecting to a real PLC.

4. Virtual screen + real PLC device

Connect the PLC serial port to the computer (RS232 uses USB to RS232 converter, RS485 uses USB to RS485 converter, TTL uses USB to TTL converter), select the correspondingphysical serial portand baud rate for the virtual screen, and open the serial port to directly interact with PLC data. Without the need to repeatedly download screen programs, debugging efficiency is significantly improved.

How to choose among the three scenarios: only adjust UI/protocol → virtual screen + virtual serial port; adjust Modbus logic → virtual screen + Modbus Slave/Poll; real machine joint debugging → virtual screen + physical serial port connected to PLC. The first two scenarios do not involve hardware, allowing you to first get the logic running smoothly.

Compiled from VisualHMI development documentation of Guangzhou Dacai Technology (hmi-doc.gz-dc.com) Quick Start "Virtual Screen Debugging", copyright belongs to Dacai Technology.

Put this resource to use in a real project?

Go to the Tool Center for message parsing, CRC verification and device debugging, or submit your requirements for selection and integration advice.

Engineer Membership

Turn this article into actionable debugging resources

After activation, you can use advanced message parsing, resource pack downloads, code examples, engineering cases and priority technical support, suitable for real project delivery.

Unlimited Advanced Tools
Resource & Code Packs
Complete Engineering Case Library
Priority Technical Support

Leave a Reply

Your email address will not be published. Required fields are marked *.