With the further development of Ethernet and its application in the field of industrial control, more and more products will provide Ethernet interface. Devices that only provide serial communication will still exist for some time. Therefore, in order to integrate serial devices through Ethernet, it is a good choice to use a serial to Ethernet converter-serial device networking server.
Serial port to Ethernet server realizes the transparent transmission function from RS232/485/422 serial port to Ethernet port, so how does the user software communicate with the converter after it is converted into Ethernet port? There are four kinds of software solutions provided by the serial port to network switch: virtual serial port, Socket programming, DLL library and Modbus TCP.
Virtual serial port: The user does not need to modify the original software after using the TCP/IP of Serial port to Ethernet server (the serial port device should have a running software on the computer to realize the communication between the serial port device and the terminal device). The PUSR Serial port to Ethernet server software can be used to simulate the virtual serial ports such as COM4 and COM5, and then the COM4 and COM5 ports are bound with the established Serial port to Ethernet server through the software. After that, the user software opens COM4 and COM5, just like opening the original COM1 hardware serial port. The use of virtual serial port can be considered for users who have serial port software, but for users who have not yet designed software, it is recommended to use Socket programming, because Socket programming is more efficient than virtual serial port, and there is no need to install drivers.
Socket programming: Develop network programs through the development environment on Windows/Linux and other operating systems, and directly communicate with the TCP/IP converter. The protocol is transparent transmission, that is, the serial port receives what the network sends, and vice versa. Users can choose Socket programming provided by VC, VB, Delphi, C # and other development environments. For example, connecting to Serial port to Ethernet server in server mode is to call Connect function. The parameters are the IP and port of the Serial port to Ethernet server.
Use DLL library: DLL is a dynamic link library that uses Socket programming encapsulation to perform basic operations on Serial port to Ethernet server. The user can use DLL library to realize the search, parameter setting and communication functions of Serial port to Ethernet server. Compared with Socket programming, DLL library is more powerful and more convenient to call. But for users who are familiar with network programming, users still want to use Socket programming to design programs, and do not want their software to bring a lot of DLLs.
Modbus TCP: The user software uses the standard Modbus TCP protocol, and the serial port to TCP/IP can directly convert the Modbus TCP data stream of the network port into the Modbus RTU data stream. The serial port of Serial port to Ethernet server can communicate with the serial port equipment of the user in Modbus RTU mode. Serial port to Ethernet server can be used as a Modbus gateway to enable standard Modbus TCP software to access standard Modubus RTU devices.
Serial port to Ethernet server is a device used to transparently transmit TCP network data packets or UDP data with 1 RS232 and 1 RS485 interface data. Low power consumption, high speed with ARM processor. The TCP/IP protocol stack integrated in the module can easily complete the network function of the embedded device. Integrated 10/100M adaptive Ethernet interface. The highest baud rate of serial communication is 1024Kbps, and the products with TCP Server, TCP Client, UDP, Httpd Client and other working modes have passed strict tests. It has been successfully applied in banks, highways, large company networks, busy networks with cameras and complex network environments formed by optical fiber to Ethernet.
What is the difference between Ethernet and serial communication?
1. Configuration of Ethernet equipment is more flexible and convenient
Communication between a plurality of RS232 serial port device and a computer is generally realize by connecting a USB to serial port hub through a multi-serial port card or a USB serial port on a PCI slot of that computer to realize expansion of the RS232 serial ports, and the PCI slot or the USB interface of each compute is limited in quantity, So that the number of RS232 serial devices communicating with the computer is limited accordingly. Although the RS485 bus has simple wiring, many load devices and a communication distance of 1200 meters, its wiring must adopt a hand-in-hand Daisy chain topology. Adding devices to the RS485 bus requires laying the lines in the past or adding 485 repeaters or 485 hubs to solve the wiring problem, while Ethernet is different. As long as there is a network information port, the relevant Ethernet devices can be directly connected to the Ethernet, and the number of access devices is basically unlimited.
2. support hot plug work
The related equipment can be configured when the system is working without stopping the system. For example, when a computer needs to add a multi-serial port card to expand the number of RS232 serial ports, the multi-serial port card can be added only after the computer is shut down and the case is opened; in the same way, when a corresponding 485 device is added on an RS485 bus, the corresponding device can be added only after the line is interrupted; and a corresponding Ethernet device is added on an Ethernet, It only needs to connect the network cable on the nearby information port, and then it can work normally through the configuration of the relevant software on the computer.
3. Simple and easy to use, convenient and simple maintenance in the later period
Whether RS232 devices or RS485 bus communications are generally only with a single computer to communicate, it is difficult to form a dual-server redundant hot backup system, but it is very easy to configure a dual-server redundant hot backup system on Ethernet. In the same way, the communication based on RS232 serial port or RS485 bus cannot form a redundant link, and once a problem occurs, the whole system may collapse, especially the RS485 bus. If a problem (such as a short circuit) occurs on the RS485 bus, it is easy to cause the whole system to fail to use. Moreover, it is very difficult to find the fault point on the RS485 bus, and it needs to be checked one by one. Similar problems can be avoided by using industrial Ethernet as a means of communication. The industrial Ethernet switch is used to lay a ring of redundant links in the industrial network. Once a link has a problem, it can recover within 20 ms and prompt maintenance in time.
4. high scalability and high scalability, very suitable for flexible wiring
The Ethernet equipment works by hot plug and the configuration is flexible and convenient, the Ethernet is adopted as a communication mode, the limitation on the distance and the quantity can be avoided, the communication distance of an RS485 bus is 1200 meters, and the effect of prolonging the communication distance can be achieved by adding a 485 repeater or converting the RS485 bus into an optical signal through an optical fiber modem and transmitting the optical signal through an optical fiber, However, the transmission distance is always limited, and Ethernet can be connected to the Internet, through which data can be exchanged anywhere in the world where there is a network connection. Similarly, the maximum rate of RS485 bus long-distance communication is 110Kbps, and now Fast Ethernet (100m) has been basically popularized, and Gigabit Ethernet is gradually entering the field of industrial control, so the communication capacity of Ethernet and the number of devices communicating on Ethernet are basically unlimited.
With the deepening of industrial control automation and office system automation, the goal of "integration of management and control" in the field of industrial control is put forward, that is to say, industrial control system and office automation system can be closely integrated, and information exchange can achieve seamless docking. Because that current office system exchange data based on the Ethernet and all software run based on the Ethernet, the software can directly communicate with the Ethernet equipment without any modification, and can quickly integrate the relevant data of the Ethernet equipment in the industrial control network into the office automation system.