1 Introduction
With the rapid development of my country's economy, the increasing acceleration of urbanization, and the ever-increasing pace of people's lives, more and more people are beginning to feel that their health is getting worse, and many people do not realize it until the disease breaks out. It is reported that the vast majority of people in my country are in a sub-healthy state. With the development of modern electronic technology and the widespread application of 16/32-bit CPUs, the CPU system of traditional physiological signal monitors is gradually developing from 8-bit CPUs to higher-bit processors. With the powerful functions of monitors, the requirements for data processing speed are getting higher and higher, which restricts the development of 8-bit CPUs. 16/32-bit CPUs can work normally at a clock frequency much higher than that of 8-bit CPUs, with a large one-time data throughput, but the price of processors is falling. 16/32-bit CPUs have begun to be widely used in physiological signal monitors.
The monitoring system uses the LPC2292 embedded microprocessor in the ARM7 series chip, which is mainly used to measure the physiological parameters of the human body, such as electrocardiogram, blood pressure, blood oxygen saturation, body temperature, etc. Because the system needs to collect and process a large amount of data information, it is difficult or even impossible to process this data information with single-task software on the CPU. Therefore, the μC/OS-Ⅱ operating system that can handle multiple tasks at the same time is selected in the design. It provides a safe and reliable operating system platform and shortens the development cycle.
2 System Hardware Design
The minimum system of ARM 7 series chip LPC2292 is shown in Figure 1:
The overall structure diagram of the system is shown in Figure 2:
As shown in Figure 2, the entire system is based on the ARM 7 series chip LPC2292 as the core, and some peripheral circuits are expanded on its periphery, thereby realizing the safety inspection of human physiological parameters: ECG, blood pressure, blood oxygen saturation, and body temperature. The system collects human physiological parameters through the ECG module, blood pressure module, blood oxygen saturation module, and body temperature module, and the conditioning circuit filters and amplifies these signals. The A/D converter built into the LPC2292 converts the transmitted analog signal into a digital signal, and finally the various parameters of the human body are displayed on the LCD.
2.1 ARM system module
The ARM system is the control center of the system, which mainly completes the calculation, control, management and other tasks, and is the core module of the system. The system uses the ARM 7 series chip LPC2292, which is based on a 16/32-bit CPU that supports real-time simulation and tracing, and has a 256 kb embedded high-speed FLASH memory. The 128-bit wide memory interface and unique acceleration structure enable 2-bit code to run at the maximum clock rate. Applications that have strict control over code size can use 16-bit Thumb mode to reduce the code size by more than 30%, while the performance loss is very small. Due to the 144-pin package, extremely low power consumption, multiple 32-bit timers, 8-way 10-bit ADC, 2-way PWM channels and up to 9 external interrupts of LPC2292, they are particularly suitable for medical systems, automobiles, industrial control applications and fault-tolerant maintenance buses.
2.2 LCD Display Module
The LCD display module mainly completes the functions of data display, output data and display data synchronization. Since there is no LCD controller function module in LPC2292, if the selected LCD screen does not have an LCD controller inside, then in order for the CPU to control the LCD, a LCD drive control circuit must be designed. Therefore, the LCD screen HLM6323 with its own controller is selected in this system. It is a 5-inch pseudo-color LCD screen with a pixel matrix of 320×240. Each dot requires RGB three-color data, and each color requires 1 byte of data to represent. The design requires continuous viewing of images. According to the standard, 25 frames of images per second are required, so at least 25×8×320×240=15,360,000 bits of data need to be transmitted per second. If serial transmission is selected, a serial transmission speed of 4.6 Mb/s is required. Unfortunately, no serial standard transmission is faster than this speed. Therefore, parallel data transmission must be selected.
2.3 Alarm module
When the measured physiological parameters, such as ECG, blood pressure, blood oxygen saturation, and body temperature, exceed the preset normal values, an alarm is generated to remind the patient to seek treatment quickly or medical staff to take emergency measures.
2.4 FLASH data storage and USB interface
In order to ensure the preservation and extraction of real-time data, this module is designed. The memory chip of the NAND08GW3D2 series is selected in this system. Since the pins of devices with different storage densities are consistent, the system can be upgraded to a high-capacity storage device without changing the circuit. A USB device interface is expanded through the USB device interface chip ISP1161A1. Through this USB interface, the data recorded by the monitoring system can be uploaded to the PC, and the PC can also download the program to the memory of the LPC2292 processor through this interface.
2.5 System Power
Power supply design is a key part in system design. For the whole system, a stable power supply with a certain power and reasonable power management are essential. This system has the following power supplies: +1.8 V digital and analog power supply voltage of CPU core, +3.3 V digital and analog power supply voltage of CPU I/O port, isolated power supply of bus, LCD driver power supply, LCD backlight inverter power supply, +5 V power supply voltage of other peripheral devices, etc.
3 Software Design
The software design of this system mainly includes two b
asic parts: the development of ARM application programs and the transplantation of μC/OS-Ⅱ operating system. The ARM application programs mainly include LCD display program, FLASH storage program, USB communication program, keyboard scanning program, A/D program and alarm program. μC/OS-Ⅱ operating system coordinates LPC2292 to manage and schedule the program tasks. The software flow chart of the whole system is shown in Figure 3.
3.1 Design Concept of LCD Driver Software
The function of LCD driver software is to complete the final output display of data. Its main software processes include data transmission and reception, reading of buttons on LCD, LCD scanning, etc. Data transmission and reception is to complete the data transmission between CPU and LCD display. CPU transmits data to LCD through driver chip, and LCD returns response data to CPU, etc. In order to enhance the readability of human-machine interface, several buttons are set on LCD. When there is a button response, a corresponding response should be sent to CPU, and the display interface of LCD and other system parameters can be set through buttons. LCD scanning is to ensure that there is no obvious interruption and no screen distortion in the display, and accurate error response can be made when screen distortion occurs. The button design does not use hardware interrupt for each button, because in this system, the task priority of LCD display driver is the highest in the application program. The buttons use a hardware external interrupt uniformly, and then the software interrupt is arranged for the buttons by software to determine the software priority; another reason is that there are too many buttons, and there are not enough hardware interrupts to set as button interrupts. If it is set as interrupt extension, in addition to hardware expansion, software expansion is also required, which will waste a lot of resources.
In this design, the LCD driver needs to write two files, one is a C language file, and the other is a C language header file. The C language file is a communication interface protocol file that needs to exchange data with other modules. The header file is to design some basic LCD parameters, which basically remain unchanged during system operation.
3.2 Design Concept of USB Communication Software
The USB communication software designed in this system is implemented through interrupt response. The purpose of this is that when there is no USB device or the USB device is not needed, the CPU can perform other tasks, saving CPU and operating system resources. This is beneficial to protecting the CPU.
3.3 Design Concept of FLASH Read and Write Operation Software
The entire program file includes several parts, such as chip erasing, chip writing and reading, and data verification. Erasing is to enable the memory to be reused without replacing the chip; chip writing and reading are the core of the entire file, responsible for writing data to the memory and reading data at the appropriate time; verification is to ensure the correctness of the data, and an alarm is required in case of errors.
In this design, the memory has three memory address entries, and all data needs to pass through these three address entries. Therefore, it must be ensured that these three address entries do not cross with other addresses at any time.
3.4 Porting of μC/OS-Ⅱ Operating System
μC/OS-Ⅱ real-time operating system is a portable, curable, customizable and preemptive multi-tasking real-time kernel (RTOS), suitable for various microprocessors and microcontrollers. Its performance is comparable to various commercial kernels, and in some aspects it performs better. All codes are written in ANSI C language, so it has good portability.
μC/OS-Ⅱ is not like other real-time operating systems. It provides users with a standard API function. Program developers use the API function provided by the operating system to develop applications. To develop applications on the μC/OS-Ⅱ kernel, program developers need to build their own real-time operating system based on the real-time kernel. First, port μC/OS-Ⅱ to your own hardware target board, write the corresponding driver and user graphical interface, etc. On top of these interface functions, add the user's own application to form embedded software.
The porting conditions of μC/OS-Ⅱ are: the processor C compiler can generate reentrant code; the processor supports interrupts and can generate timed interrupts; interrupts can be turned on and off using C language; the processor supports a certain amount of data storage hardware stack; the processor has instructions to read the stack pointer and other CPU registers and save them to the stack or memory. Philips' LPC2292 chip and
ADS1.2 C compiler can meet the above five conditions, so this design can fully port the operating system to improve the system's functions.
The architecture of μC/OS-Ⅱ software is shown in Figure 4:
Although most of the source code of μC/OS-Ⅱ is written in C language, some codes related to the processor must be implemented in assembly language. The reading and writing of registers can only be achieved through the storage and load instructions of assembly language.
Transplanting μC/OS-Ⅱ to a new architecture requires modifying the following three files:
(1) C language header file OS-CPU.H;
(2) C language source file OS-CPU.C;
(3) Assembly source file program OS-CPU-A.ASM.
4 Conclusion
The human physiological parameter monitoring system is implemented on a hardware platform based on an ARM7 microprocessor, using the currently popular C/OS-Ⅱ real-time multi-tasking operating system. It can detect the user's ECG, blood pressure, blood oxygen saturation and body temperature in real time, and can perform data analysis on them. When an abnormality occurs, it can automatically alarm so that the user can receive timely treatment. The system has high scalability and can be directly expanded on the system as needed to make it a remote human physiological parameter monitor with GPS, GPRS, and CDMA functions.