Share this

Research on Communication Technology between Industrial Control Computers and Multi-protocol Serial Port Testing Equipment

2026-04-06 05:24:25 · · #1
Abstract: This paper introduces the use of the VB ActiveX control MSComm to implement serial communication between an industrial control computer and multiple monitoring devices with different communication protocols. It mainly discusses common serial communication protocol formats and their structural composition, and, combined with a specific hardware design example, presents a complete architecture and optimized management scheme for a multi-protocol serial communication system. Furthermore, it analyzes two serial communication methods and provides corresponding software design examples. The entire system has a simple structure, high reliability, and good operating performance. Keywords: RS232; monitoring system; serial communication; MSComm control Abstract: This paper deals with the serial communication that uses the VB ActiveX MSComm to realize the data communication between an industrial control computer and multi-communication protocol monitoring devices along with the common communication protocol format and composite structure. The whole communicational system architecture and optimal management mechanism are presented with an instance of concrete hardware design. This paper also analyzes two modes of serial communication and gives a corresponding example of the software design. The practical application shows that the system has many features, such as simple structure, high reliability and good effectiveness. Key words: RS232; monitoring system; serial communication; MSComm control 0 Introduction With the improvement of intelligence and automation in modern production processes, more and more integrated process systems need to develop their own data acquisition and monitoring platforms [1]. When developing such real-time measurement and control applications using Windows programming technology, the key and frequent problem is communication with peripheral monitoring equipment [2, 3]. Since serial communication transmits information bit by bit on a single transmission line, avoiding inconsistencies in the characteristics of multiple lines, many intelligent instruments or data acquisition modules now come with RS232/485 serial communication interfaces. Through corresponding communication protocols and serial communication programs, test and acquired data can be transmitted to a host industrial control computer to meet various subsequent data processing requirements. Simultaneously, the entire monitoring system sends instructions to the monitoring equipment via the serial port based on the system's operating status, adjusting equipment operating parameters to ensure smooth production. This article discusses how to optimize and control serial communication for multiple devices in a large-scale data acquisition and monitoring system. 1. System Hardware and Signal Line Connections In a large-scale physical simulation monitoring system, four devices are controlled via serial ports [4,5]. As shown in Figure 1, each device is remotely acquired and controlled via the industrial control computer's RS232 (<12m) serial port. The interface between the industrial control computer and the terminal in the system only requires 3 signal lines, namely the transmit data line (TXD), the receive data line (RXD), and the signal ground line (SG), which can directly receive and send data to the terminal without needing to judge or set the status of the signal lines. 2. Multiple Communication Protocols and Communication Formats A communication protocol is an agreement between two communicating parties. The agreement includes unified provisions on data format, synchronization method, transmission speed, transmission steps, error detection and correction methods, and control character definitions, which must be jointly observed by both communicating parties. It belongs to the data link layer in the ISO'S OSI 7-layer reference model. When multiple serial port detection devices need to communicate with the host computer [6], a correct understanding of the communication protocol is the key and difficult point of serial port communication. In fact, due to the fact that each manufacturer customizes its own format, the control, parameter setting, parameter reading, and status reading instructions are very different, and no unified protocol standard has been formed. Table 1 uses the Dasnet communication format of the ISCO plunger pump and the Normal communication format of the Pioneer temperature controller of the constant temperature chamber as two typical examples to illustrate the serial port protocol, which serves as a starting point for readers to quickly and correctly understand the serial port protocol. 2.1 Dasnet Command Code Description (1) Start from the terminal device address (destination address) receiving the command. The address is a number (0-9). When multiple devices are connected, the address numbers cannot overlap. (2) Response mode identifier, specifically three meanings: E-error, B-busy, C-receive. (3) Command source address: the initial address of the command sending device, generally 0. (4) Length: indicates the length of the command to be sent, represented in ASCII code. (5) Command: consists of a single read command or write command (with or without parameters). (6) Checksum: is a two-digit hexadecimal number. It is the single-byte checksum of the sum of all characters from the start position to the end of the command and then the complement (the sum modulo 256 equals 0). (7) Carriage return CR character (0DH): indicates the end of the entire command. For example, the text mode of sending the command: R304STOPD1 [CR] is: R304STOPD1 [CR] and the binary mode is: The methods for calculating the check code are: modulo hexadecimal, modulo decimal, non-modulo hexadecimal, and non-modulo decimal. Now, let's take the modulo hexadecimal method as an example to illustrate the calculation of the check code: (1) 22FH=52H+33H+30H+34H+53H+54H+4FH+50H; (2) 2F=22FH÷100H; (3) D1H=100H-2FH; (4) Represent D1H with two hexadecimal ASCII codes and add them to the end of the command; (5) Add "CR" (0DH) to the end to indicate the end of the entire command. 2.2 Normal Full File Sending and Returning Full File Communication Format Code Description (1) Start character is “@” (40H), indicating the beginning of the file; (2) Address: The address number set by the controller is 00~31. When there are multiple controllers, the set address numbers cannot overlap; (3) File: The file consists of a single read command or write command (with or without parameters); (4) The file ends with the ASCII character colon “:” (3AH); (5) BCC check code: The double-byte check code of the result obtained by XOR operation of all characters from the start character “@” to the end character “:” (including the end character); (6) Carriage return CR character (0DH) indicates the end of the full file. For example: Binary XOR 30H XOR 31H XOR 44H XOR 31H XOR 3AH=4EH Its text format is: @01D1∶4E CR Its binary format is 40H30H31H44H31H3AH34H45H0DH 2.3 Characteristics of Multi-Serial Communication Protocols Through the comparison of the above two communication formats, it can be seen that they generally have the following organizational structure and characteristics: (1) Start and end flag characters All information transmission must start with a flag character and end with the same character. This flag character is [CR], called the flag field (F). The start flag and the end flag constitute a complete information unit, called a frame. All information is transmitted in the form of frames, and the flag character provides the boundary of each frame. The receiving end can use this information to detect the beginning and end of the frame, thereby establishing frame synchronization. (2) Address field and control field After the flag field, there can be an address field A (Address) and a control field C (Control). The address field is used to specify the address of the secondary station with which it communicates. The control field can specify several commands. Its width can be 8 bits or 16 bits. (3) The information field follows the control field. The information field I (Information), also called the data field, contains the data to be transmitted. Not every frame must have an information field, that is, the data field can be omitted. When it is omitted, the frame is mainly a control command. (4) The frame check information follows the information field. The frame check field is called the FC (Frame Check) field or the Frame Check Sequence FCS (Frame Check Squence). The check code can be a cross-sectional parity check or a 16-bit cyclic redundancy check (CRC). Correctly understanding the calculation of the check code is the difficulty and key to actual serial communication. 3 Management System Architecture The serial communication system based on multiple protocols plays an extremely important role in the development of large-scale systems. It has a complete system architecture and has formed a complete set of optimized management schemes in practice, with a very clear hierarchy. Functionally, it has a wide coverage, from hardware device drivers to all development stages required for developing the entire system. The specific structure is shown in Figure 2. Device hardware layer: mainly includes physical measurement devices based on RS232 serial interface, which is the underlying hardware foundation for completing the automation of the entire system. Resource management layer: is the bridge between the software design platform and the device, mainly composed of interface drivers, interface software, and controls. The communication controls provided by VB provide standard event handling functions and procedures, and provide serial communication port parameter settings through property methods, which can easily solve serial communication and realize remote computer control of instruments and equipment. This part also includes Windows serial port drivers and extended serial port drivers, which complete the Windows underlying encapsulation and interface linking [7]. Development application layer: is an integrated software development and program execution platform, which realizes the initialization and various configurations of the serial port detection instrument module, realizes remote monitoring of the device, and saves data for convenient later experimental data processing. Multi-protocol serial port management sits between the application development layer and the resource management layer, encompassing various serial port management mechanisms, primarily including port allocation, communication protocol and format settings, data verification processing mechanisms, communication error handling mechanisms, emergency fault handling mechanisms (major hardware faults, etc.), testing and debugging mechanisms, priority mechanisms, optimization and coordination mechanisms, and import/export data storage mechanisms. These protocols collectively ensure the safe and effective operation of the multi-protocol serial communication system. 4. Serial Communication Programming 4.1 Programming Environment Although Windows provides a complete set of open, general-purpose, enhanced W32API (Application Programming Interface) functions, which integrates support for serial ports and other communication devices with basic input drivers, its advantages include richer functionality, wider application scope, and suitability for writing more complex low-level communication programs. However, using API functions to write serial communication programs is complex and requires a large amount of communication knowledge. Another approach is to use its communication control MSComm [2]. This control "hides" most of the low-level operation process and many cumbersome procedures of serial communication, providing standard event handling functions and procedures. It also provides the setting of serial communication port parameters through property methods. Therefore, only a small amount of code is needed to implement the main application functions and interface design to complete the software development process [8]. The MSComm control provides two methods for controlling the serial port: event-driven and polling. The polling method involves designing the user program to periodically or irregularly query whether certain properties of the MSComm control have changed (generally, querying whether the number of characters waiting to be received by the computer in the InBufferCount receive buffer meets the requirements). This method is used when the program is small and real-time performance is not high. In this program, the management of the constant temperature chamber and the constant flow and constant pressure injection pump is done using this method. The event-driven method, also known as the interrupt method, generates the OnComm event when data arrives at the port, the port status changes, or a communication error occurs. The user program can capture the event and check the value of the CommEvent property to query the event and error and perform corresponding processing. Using this method, the program responds promptly and has high reliability. In the program, the back pressure valve and the saturation tester use this method to communicate. 4.2 Program Code When multiple devices communicate simultaneously during the serial port communication process of the measurement and control system, especially when multiple tasks need to be processed simultaneously, they conflict with each other and are easily affected by external interference. To prevent communication errors, anti-interference processing needs to be performed in the integrated processing software. The article uses two methods for error correction and detection: (1) Start the error timer to scan for errors in the data transmission. If there are errors, restart the communication thread; (2) Verify the received data. If the communication time limit is exceeded or the received data is erroneous, retransmit it. The operation proves that the application of the above two methods greatly improves the reliability of communication and reduces the error rate. The following is a fragment of its communication program. / Open serial port, start communication module / Close serial port, end communication module 5 Conclusion A serial communication system for multiple protocol devices and industrial control computers was established using the MSComm communication control of VB6.0. The system was then applied to a large-scale three-dimensional physical simulation device. From the actual operation, due to the advanced multi-serial port optimization management mechanism adopted in the communication system, the computer data acquisition and monitoring system based on this method is a cost-effective system solution for laboratory or field control with relatively short transmission distances. Moreover, the system has the characteristics of simple structure, high reliability, accurate measurement, and flexible control. It has high reference value for the construction of such serial communication monitoring systems based on communication protocol devices in the future. References [1] Zheng Biao, Wang Bingwen. Application of serial communication in industrial control [J]. Automation Instrumentation, 2002, 23(4): 58-59. [2] Wang Mingjian, Wang Mingwu. Design of serial communication for computer monitoring system of gas station [J]. Automation and Instrumentation, 1999, 14(3): 57-59. [3] Ke Wen, Hua Jing. Implementation of serial communication between microcomputer and multiple machining centers [J]. Industrial Instrumentation and Automation Device, 2003, (3): 17-19. [4] Li Yingshun, Lun Shuxian. Implementation of serial communication between PC and testing instrument [J]. Journal of Shenyang Aerospace University, 2003, 20(2): 26-28. [5] Ke Bole, Chi Jiang, Tang Tianhao. Implementation of multi-serial communication based on MOXA multi-serial card [J]. Industrial Control Computer, 2004, 17(1): 46-47. [6] Que Jiang, Sun Lingsheng, Zhang Ming. Serial communication between industrial control software and lower-level machine using VB6.0 [J]. Electric Power Automation Equipment, 2002, 22(9): 34-36. [7] Mo Weidong, Bai Peng. Advanced Programming Techniques of Visual Basic 6.0 - Control Chapter [M]. Xi'an: Xi'an Jiaotong University Press, 1999. [8] Liu Bingwen. Mastering Visual Basic 6.0 Chinese Version [M]. Beijing: Electronic Industry Press, 1999.
Read next

CATDOLL 102CM Ling Anime Doll

Height: 102cm Weight: 15.5kg Shoulder Width: 26cm Bust/Waist/Hip: 51/46/66cm Oral Depth: 3-5cm Vaginal Depth: 3-13cm An...

Articles 2026-02-22
CATDOLL 136CM Seina

CATDOLL 136CM Seina

Articles
2026-02-22