With the further development of Ethernet and its application in the field of industrial control, more and more products will provide Ethernet interface. However, devices that only provide serial communication will still exist for a certain period of time. Therefore, to integrate serial devices through Ethernet, it is a good choice to use serial to Ethernet-serial devices to connect servers.
What serial to Ethernet solves is the conversion from RS232/485/422 serial port to network port, so how does the user software communicate with the converter after the conversion to network port. There are four software solutions provided by the serial port converter: 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/IPserial to Ethernet (the serial port device should have a software running on the computer and communicating with the device). Virtual serial ports such as COM4 and COM5 can be virtualized by using the serial to Ethernet software program, and then COM4 and COM5 are bound to the specified serial to Ethernet through the software.After that, the user software opens COM4 and COM5, which is the same as opening COM1 and other hardware serial ports. 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: It is to use the development environment of Windows/Linux and other operating systems to develop network programs 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, to connect to serial to Ethernet in server mode is to call the Connect function, and the parameters are the IP and port of serial to Ethernet.
Use DLL library: DLL is a dynamic link library that uses Socket programming encapsulation for basic serial to Ethernet operations. The user can use the DLL library to realize the search, parameter setting and communication functions of serial to Ethernet. Compared with Socket programming, DLL library is more powerful and more convenient to call.But for users who are familiar with network programming, they still want to use Socket programming to design programs, and they don't want their software to have 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 to Ethernet can communicate with the user's serial device in Modbus RTU mode.The serial to Ethernet can be used as a Modbus gateway to enable standard Modbus TCP software to access standard Modubus RTU devices.
The serial to Ethernet is a device used to transparently transmit TCP network data packets or UDP data with one RS232 and one 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 been strictly tested. 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 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,You can directly connect the relevant Ethernet devices 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, communication based on RS232 serial port or RS485 bus cannot form a redundant link. Once a problem occurs, the whole system may collapse, especially the RS485 bus. If there is a problem (such as short circuit) 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 is flexible and convenient in hot plug operation and configuration, the Ethernet is adopted as a communication means without limitation on distance and number, the communication distance of an RS485 bus is 1200 meters, and the communication distance can be prolonged 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 with network connections. Similarly, the maximum rate of long-distance communication of RS485 bus is 110Kbps, and now Fast Ethernet (100m) has been basically popularized.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.