Design and implementation of a multi-channel real-time data acquisition and monitoring system

Design and implementation of a multi-channel real-time data acquisition and monitoring system

This article describes the design and implementation of an ARM-based multi-channel real-time data acquisition and monitoring system; the system is composed of a lower computer system and upper computer software. The hardware of the lower computer is mainly based on the ARM industrial control development platform, data acquisition board and analog output board , Adopt μC/OSII real-time multi-task operating system to realize multi-channel data collection, effective data storage and analog output, and transmit the collected data to the upper computer in real time; the upper computer software successfully collects, monitors and monitors the analog data The changing graphics Display, the whole system has good real-time performance.

Abstract: This article describes the design and implementation of an ARM-based multi-channel real-time data acquisition and monitoring system; the system is composed of a lower computer system and upper computer software. The lower computer hardware is mainly based on the ARM industrial control development platform, data acquisition board and analogue The output board adopts μC/OSII real-time multitasking operating system to realize multi-channel data collection, effective data storage and analog output, and transfer the collected data to the upper computer in real time; the upper computer software successfully carries out the acquisition and monitoring of analog data And graphical Display of data changes, the whole system has good real-time performance.

introduction

With the continuous development of industrial automation and informatization. Data collection has become a bridge between the computer and the external physical world. The data acquisition system is widely used in the monitoring of equipment working conditions in industrial production, the closed-loop control system in the control field, and the semi-physical simulation system in the simulation field.

The traditional data acquisition device is usually composed of a single chip microcomputer and an acquisition card. Its shortcomings such as fewer acquisition channels, single-task software structure and poor real-time performance can no longer meet people’s needs. ARM (Advanced RISC Machines) is a microprocessor with a data width of 32 bits that can be embedded in an operating system based on the RSIC architecture. Because of its small size, low price, high reliability, low power consumption and other characteristics, it has been widely used in industrial automation, national defense, transportation and other fields.

This paper designs and implements an ARM-based multi-channel real-time data acquisition and monitoring system, which can ensure the reliability and real-time performance of the data in the acquisition process, and monitor and display the data through computer software. The entire system realizes data acquisition and analog output. And data storage function.

1 The working principle of the system

As shown in Figure 1, the data acquisition monitoring system includes an upper computer and a lower computer system. The lower computer is composed of ARM industrial control development platform, data acquisition board, analog output board, LCD liquid crystal display and SD memory card. It uses μC/OSⅡ real-time multi-task operating system to schedule and manage tasks, and realize the data acquisition board to the outside world Analog multi-channel acquisition function, the data is stored in the SD card, and transmitted to the upper computer via USB or Ethernet; under the control of the upper computer, the lower computer receives the analog output command to complete the analog output function; LCD liquid crystal display The screen is used to display the working status information of the lower computer.

Design and implementation of a multi-channel real-time data acquisition and monitoring system
Figure 1 The composition diagram of the data acquisition and monitoring system

The upper computer communicates with the lower computer through USB or Ethernet, receives the collected data of the lower computer for real-time monitoring, graphically displays the data change curve, and can set the analog output to control the analog output function of the lower computer.

2 Lower computer hardware composition

According to the working principle of the system, the Smart 2400ARM7 industrial control development board of Zhou Ligong Company is adopted, its ARM is LPC2478, the development board is embedded with μC/OSⅡ real-time multi-tasking operating system, and it integrates 10/1OOM Ethernet PHY chip, Ethernet interface, USB interface , 98KB SRAM, SD card slot, STN and TFT LCD interface, 512KB Flash and MiniI SA bus. Expansion boards with different functions can be directly mounted through MiniI SA bus. The composition of the development board is shown in Figure 2.

Design and implementation of a multi-channel real-time data acquisition and monitoring system
Figure 2 Schematic diagram of development board composition

Figure 2 Schematic diagram of the development board composition Use Zhou Ligong’s MiniISA-8208BT data acquisition board and MiniISA8204CT analog output board, which are based on the MiniISA bus structure and communicate with the industrial control development platform through the bus. MiniISA8208BT is a 12-bit A/D conversion device, including 8 differential or 16 single-ended isolated analog signal inputs; MiniISA8204CT is a 4-channel 12-bit analog output board, and the performance indicators of these two expansion boards meet the needs of the system .

3 software design

The software system is divided into lower computer software and upper computer monitoring software to be designed separately.

3.1 Software design of lower computer

The lower computer adopts μC/OSⅡ real-time multitasking operating system. μC/OSⅡ is a real-time multitasking operating system with open source code, portable, curable, trimmable, and preemptive. It manages tasks completely based on priority and always makes The task with the highest priority in the ready state runs. Time slice round-robin scheduling is not supported, so the system function must be reasonably decomposed into several tasks of different priority according to the importance of the task and the degree of real-time requirements. The rationality of the task and priority division will directly affect the quality of the software design.

When dividing system functions into tasks, first make all tasks meet real-time requirements. Even in the worst case, all functions that require real-time performance in the system can be implemented normally; and the number of tasks should be reasonable to simplify the software system To reduce the demand for resources. According to the working principle of the data acquisition and monitoring system and the principle of task division, the tasks of the lower computer system are divided into USB communication tasks, Ethernet communication tasks, SD card data file writing tasks, data acquisition tasks, LCD display tasks, and analog output Task. In addition, urgency and quick execution tasks are given a higher priority, and the human-machine interface shows that the task has low real-time requirements and is given a lower priority. The priority division is as follows.

① TASK1 task, priority 1, USB communication task;
② TASK2 task, priority 2, Ethernet communication task;
③TASK3 task, priority 3, SD card writing data file task;
④ TASK4 task, priority 4, data collection task;
⑤ TASK5 task, priority 5, analog output task;
⑥ TASK6 task, priority 6, LCD screen display task.

In the software system of the lower computer, the communication between tasks is mainly done through the message mailbox. The message mailbox is used to pass a pointer between tasks or between interrupts and tasks, so that tasks can send and receive any type of data through the pointer. Define 3 message mailboxes. Message mailbox 1 is used for data collection tasks to transfer data to communication sending tasks; message mailbox 2 is used for communication between communication receiving tasks and analog output tasks; message mailbox 3 is used for data collection tasks to SD card Write data file task to send data. As shown in the following program statement, to use the message mailbox, you must first define the message mailbox pointer, then create the message mailbox, and finally wait for other tasks to send the mailbox or send the mailbox to other tasks.

OS_EVENT*mbox;//Define the message mailbox pointer
mbox=OSMboxCreate(NULL);//Create message mailbox
OSMboxPend(mbox,0,&err);//Waiting for message mailbox data
OSMboxPost (mbox, Buf);//Send the message mailbox, the data is the data in the buffer Buf

When the application is running, it first calls OSInit() to initialize μC/OSⅡ, then creates tasks in turn by calling OSTaskCreate(), and then executes OSStart() to start the multitasking environment, thereby performing multitasking management and scheduling. The program module and flow of the lower computer are shown in Figure 3.

Design and implementation of a multi-channel real-time data acquisition and monitoring system
Figure 3 Lower computer program module and flow chart

Figure 3 Lower computer program module and flow chart. In the data acquisition task, after the board is initialized, use the timer to periodically start the acquisition function, read the data of each acquisition port in query mode, and perform arithmetic average filter processing for continuous reading The arithmetic average operation of the 5 sampling values ​​is carried out, and then the data is transferred to the communication task and the SD card writing data file task through the message mailbox.

Use ADS1.2 to develop lower computer applications and use LPC2400 series special project templates. Because the Smart2400 development board is embedded with μC/OSⅡ operating system, there is no need to transplant the operating system during the development process, just load the μC/OSⅡ source file to In the project, the source files, driver files, header files, etc. used in the program are modified and loaded accordingly. After the compilation and linking is successful, they can be burned into Flash through the emulator.

3.2 Host computer software design

The upper computer data acquisition and monitoring software is developed using VC++6.0. When both USB and Ethernet are connected, use USB for communication. Mainly realize the following functions:

①Communicate with lower computer via USB and Ethernet;
②Create a data receiving thread, receive the data collected by the lower computer through the communication interface, display it on the monitoring interface in real time, and draw the data change curve at the same time;
③Set the corresponding analog output value through the upper computer software, and control the lower computer to perform analog output work;
④Display the connection status of the communication interface and the working status information of the lower computer. The software flow of the upper computer is shown as in Fig. 4.

Design and implementation of a multi-channel real-time data acquisition and monitoring system
Figure 4 Upper computer software flow chart

4 Experimental verification

In order to verify the data acquisition and monitoring system, connect the 4 output channels of the analog output board to the acquisition channels 1, 2, 3, and 4 of the data acquisition board, and use the host computer software to control the analog output board to output analog Voltage. The initial value is 1.5V, linearly reduced to 1.0V after a delay time, and finally kept at 1.0V. The delay time is set by the data acquisition monitoring software and set to 100s. The IP address of the lower computer is set to 192 168 1.2, and the IP address of the upper computer is set to 192 168 1.3, so that the two are located in the same local area network. When the data acquisition and monitoring system is working, the software operation of the upper computer is shown in Figure 5.

Design and implementation of a multi-channel real-time data acquisition and monitoring system
Figure 5 Data acquisition monitoring software running interface

After the host computer software “set” button is pressed, the analog output board of the lower computer starts to output 4-channel analog voltage, and the output value is linearly reduced from 1.5V to 1.0V after 100s. The data acquisition board collects the analog voltage and transmits the data to the host computer And save to SD card. The upper computer software monitors the collected data in real time and draws the data change curve. Through experimental verification, this system has successfully realized the data collection and monitoring function, completed the data collection, monitoring, storage and analog output. The system has good real-time performance and stability during the operation of the system.

5 Conclusion

This article designs and implements an ARM-based multi-channel real-time data acquisition and monitoring system. The lower computer adopts μC/OSⅡ real-time multi-tasking operating system, which realizes the data collection, storage and analog output, and has the display function of man-machine interface; the upper computer software successfully completes the real-time monitoring and display of the collected data and the output of the analog quantity control. The entire system has the characteristics of high accuracy, stable operation, good real-time performance, and strong anti-interference ability, and can be effectively applied to general system monitoring and weapon systems.

The Links:   AD9767ASTZ LQ104S1LG33 LCD-STOCK

micohuang