Traditional serial port connection methods usually require physical lines to directly connect the host and the target device, which limits the distance of the serial port connection. The virtual serial port server can extend the serial port connection to an infinite distance as long as there is a network connection. It converts the serial port signal into a network data packet and transmits it through the network, allowing users to remotely access the target device anywhere, realizing a serial port connection without distance restrictions. The virtual serial port server solves the problem of the limited number of physical lines. The virtual serial port server creates a virtual mapping serial port through software. One host can connect to multiple target devices without adding additional physical serial ports, which greatly saves costs and space.
The working principle of a virtual serial port server is to convert serial port signals into network data packets and transmit them on the network. A virtual serial port on a host corresponds to a virtual serial port server software, which is responsible for forwarding the serial port signal to the physical serial port on the target device and forwarding the serial port data returned by the target device back to the host. This method makes the communication between the host and the device no longer limited by distance, and can realize applications such as remote control, debugging and monitoring.
The network topology is shown in the following figure:

The serial port server simulated in this paper has two LAN ports, which can be modified to different network segments for access. After connecting with the RJ45 network port through the network topology shown in the figure above, open the IE browser, enter the IP address, and enter the web version configuration window. In this page, you can set the parameters corresponding to the serial port server port1~port8. In this example, the slave device communication adopts MODBUS RS485 two-wire wiring. The RS485 and RJ45 connection can be connected by referring to the figure below.

In the page settings, Application is set to DEVICE CONTROL, MODE is set to REALCOM mode, and MODBUS RTU can be used to access it in real serial port mode.

This page sets the serial port parameters of the slave device:

Creation of virtual serial port: Download NPORT WINDOW DRIVER MANAGER software from the official website of Mosa. This software can generate a virtual serial port in the host computer of the master station. This virtual serial port is mapped to PORT1~PORT8.

The following figure shows the virtual serial port generated after mapping:

In the device manager, you can see the serial port number we generated. Only after generating this serial port number can we proceed with the next simulation.

Open our simulation tool, here I use MODBUS SLAVE EMULATOR software. After connecting through the network topology diagram, here my USB CONVERT RS485 is COM5, the function code is 03, starting from 0, read 10 data.

Use MODBUS MASTER EMULATOR software to read the slave device of PORT1 through the virtual serial port COM17. See the figure below. The data has been read.

The corresponding serial port status can also be viewed through the web page, through which the serial port device status can be further viewed to see whether there is BUFFER data.


Of course, you can also view the data through Moxa's own serial port debugging assistant.


Data can also be written to the slave device through the master.

The above method is to retrieve com data through realcom mode. Of course, you can also use TCP SERVER mode to read the slave device by using IP address plus port number. In this case, you don't need NPORT WINDOW DRIVER MANAGER software to map the serial port.

