A network communication design for a distributed testing system
2026-04-06 07:59:13··#1
Abstract This paper designs a network control method for a test system based on data communication. Distributed control of the test system is achieved using a common microcomputer serial port. A general-purpose serial interface adapter is designed, a system communication protocol is formulated, and all interrupt-driven communication software is completed. Practical application shows that this method has good adaptability. Keywords Test system, serial interface, interrupt-driven network 1 Introduction In test systems, it is often necessary to centrally control multiple instruments and equipment and perform unified analysis and processing of their data. The increasing intelligence and automation of test systems places higher demands on data exchange between test devices. Here, distributed control becomes a very effective method [1]. In a distributed test system, data exchange mainly takes place between the main processor and each intelligent control unit. According to the characteristics of the test system, its communication system should have good reliability, versatility, scalability, and simple connection methods, and should be able to adapt to the needs of long-distance transmission. The above characteristics should be fully considered in the formulation of the system communication method and its protocol to adapt to the needs of different test applications. 2 Physical Layer Protocol and Interface Design To meet the needs of multiple control nodes and long-distance communication, this paper adopts the RS-485 half-duplex serial communication protocol as the communication standard for this test control network. Due to the adoption of balanced drive and differential reception, the influence of common-mode interference is effectively reduced, thus significantly improving its transmission distance and load capacity compared to RS-232C [2]. Since current PCs are equipped with RS-232C interfaces, an RS-485 interface was designed. It can be placed in a common adapter and directly plugged into the PC's serial port to convert the PC's RS-232C output to RS-485 output. Its structure is shown in Figure 1. Compared with other methods, this method has advantages such as simple interface, strong versatility, small size, and low cost. Furthermore, an intelligent control unit can be added to this interface to meet the needs of communication with conventional instruments and equipment. 3 Data Transmission Protocol and Software Design In the distributed testing system, each testing device mainly communicates with the main processor. Based on this characteristic, this paper decides to adopt a more explicit master-slave communication as the system communication method [3] to maintain the uniformity of system functions and simultaneously meet the communication needs between other nodes. 3.1 Information Frame Format Data and command transmission in the system adopts a packet method, and the data frame format is shown in Figure 2. The highest bit of the address byte is specified as 0 to indicate the start of the frame; a variable-length data field is used, with a data length range of 1 to 255 bytes; two bytes are used for data verification; the tail flag is specified as 0FFH to indicate the end of the frame. The byte transmission format is specified as 11 bits, namely 8 data bits, 1 address/data flag bit, 1 start bit, and 1 stop bit. To facilitate multi-machine communication, the transmitted bytes are divided into address class code and data class code. The 9th bit of the address class code is set to 1, allowing all lower-level machines in the listener state to receive the data; the 9th bit of the data class code is set to 0, allowing only the specified lower-level machine to receive the data. In communication, commands and data sent by the host can be divided into address commands for specific slave devices and communication commands for all slave devices. Therefore, we define address 7FH as the communication address, and commands sent to this address can be received by all slave devices. To ensure reliable data transmission, a response method is used for communication. After receiving data from the host, the slave device immediately sends back status information. If no response information is received within a specified time, a timeout alarm is triggered. This system uses four bytes to represent the system's communication and operating status. Two bytes represent the communication status, and two bytes represent the controller's current operating status, which can be adjusted according to specific applications. Here, CRC is used for data verification. When a data transmission error is detected, the host uses an automatic feedback retransmission method to correct it. 3.2 Interrupt-Based Communication Software Design To ensure sufficient time for the main processor to perform data processing and other tasks, the communication process should be minimized. Therefore, in the software design, the main processes are all interrupt-driven. When sending information, data is simply written to the buffer, and the subsequent process is taken over by interrupts; similarly, the receiving process is also entirely managed by interrupts, allowing the host to perform other processing without any waiting. To adapt to different communication tasks, especially the needs of large-volume communication, both the receiving and sending parts adopt a ring buffer structure. To fully utilize hardware resources, the main processes are written in assembly language, using a combination of embedded assembly and assembly calls to write C language communication functions to achieve interface with high-level programs. In addition, each main communication process constitutes an independent communication function, which can be used in any communication network using this protocol. Figure 3 shows the serial port interrupt handling flow. Here, data sending and receiving are performed byte-by-byte to avoid consuming host working time. Using the above communication protocol and software, based on a bus network, we conveniently realized data communication between PCs and between PCs and intelligent instruments, and experiments have proven their good adaptability. 4 Application of Network Communication in Detection Systems In comprehensive testing systems, it is often necessary to centrally control multiple sensors and actuators. Furthermore, the host is mainly used for data processing and analysis calculations, and the control process should not affect the above processes. Generally, a system should be able to control as many nodes as possible and have a certain degree of scalability to accommodate the addition of new test equipment. Currently, a centralized hardware approach is commonly used to meet these control requirements. This involves a centralized controller composed of hardware circuits controlling the actions of sensors and other actuators. While this approach offers advantages such as centralized functionality and high speed, it also suffers from drawbacks such as complex logic, poor flexibility, and difficulty in troubleshooting. As mentioned above, such systems can be considered distributed systems composed of multiple sensor test units and actuators. Using the network communication design concept described above, we can distribute system control functions to various test units and actuators, thus forming a distributed test and control system based on half-duplex communication, with the main processor acting as the master controller. Using the communication protocol and software described above, and after agreeing on a specific set of command codes for this control system, the host can control each actuator. Because a completely interrupt-driven design is adopted, the system communication process does not affect the host's processing. The relationship between the main processing process and some communication modules is shown in Figure 4. Practical applications show that the performance of the control system can be greatly improved compared to the original method. 5. Conclusion This paper aims to study a widely adaptable data communication method and establish a corresponding communication protocol, thus laying the foundation for future work on the automatic control of testing processes and instruments. Practice has proven that, compared with traditional centralized hardware control, the RS-485-based data communication network and protocol introduced in this paper have advantages such as high reliability, high flexibility, good adaptability, and convenient fault diagnosis, making it particularly suitable for controlling intelligent testing units. In fact, with only slight modifications to the serial interface shown in Figure 1, it can be used in many testing instruments equipped with external communication interfaces, especially RS-232C interfaces, thereby achieving remote centralized control of the equipment. To test the reliability of the communication system, it was placed in a strong interference environment. Experiments showed that reliable data transmission can be fully guaranteed at a baud rate of 67.5 Kbps and a transmission distance of 100 m. References [1] Zhang Xin. Computer Distributed Control System. Water Resources and Electric Power Press, 1992. [2] Engineering Department Electronic Industries Association. EIA Standard RS-485. April, 1983. [3] Yang Yonggao and Wang Yu. Microcomputer Local Network Principles and Practical Technology. Southwest Jiaotong University Press, 1993.