Traditional testing instruments are mostly completed by hardware circuits, which not only have single functions, but also have long development cycles and are difficult to maintain. With the rapid development of microelectronics technology and information technology, medical testing instruments are developing in the direction of modularization, multi-function, intelligence and miniaturization. The rapid development of modern digital components has provided strong support for medical testing instruments. Medical testing instruments have all adopted microprocessors to enhance their functions without exception. The extensive application of microprocessor chips can enhance the intelligence of instruments, improve their stability and the accuracy of data processing, integrate the collection, processing and communication of medical signals, and have a series of advantages such as self-diagnosis and self-checking.
The AT90 series AVR microcontroller newly launched by ATMEL is a very eye-catching microprocessor. This chip is based on the new RISC (Reduced Instruction Set Computer) structure and adopts a pipeline structure in design. When executing the previous instruction, the next instruction is taken out at the same time. Its FLASH and powerful peripheral interface capabilities make it one of the most popular microcontrollers at present.
The high-performance microprocessor chip Atmega163 used in this paper uses the idea of structured and modular program design to sample 8 human physiological signals in real time, compress and optimize the data, and transmit serial data with the host PC at a rate of 115 200 bps.
2 Hardware composition
2.1 Microprocessor and its characteristics
Atmega163 is a high-end series product launched by ATMEL. It is a low-power CMOS 8-bit microcontroller based on AVRRISC. When the external crystal oscillator is 8MHz, the execution time of an instruction is only 125ns. This AVR microcontroller structure is conducive to programming in C language, so that the target product can be developed efficiently. In order to optimize the target code size, the AVR microcontroller uses a large fast access register file and fast single-cycle instructions. By executing an instruction in one clock cycle, Atmega163 can achieve a performance close to 1MIPS/MHz. It links 32 working registers and a rich instruction set together, so that all working registers are directly connected to the ALU (Arithmetic Logic Unit, the arithmetic logic unit in the computer CPU), allowing a single instruction executed within one clock cycle to access two independent registers at the same time. Atmega163 has 16K bytes of Flash memory, 512 bytes of online programmable E2PROM, 1024 bytes of SRAM, and a full-duplex UART serial communication interface on the periphery. In addition, it has two pre-dividable 8-bit timers/counters with comparison mode, and one pre-dividable 16-bit timer/counter with comparison and capture functions.
The Atmega163 microcontroller provides a good 10-bit analog-to-digital converter. As shown in Figure 1, port A is an 8-channel analog signal input terminal. If the AD function is disabled, port A is an 8-bit bidirectional I/O port. 8-channel human physiological signals such as electrocardiogram, heart sound, carotid artery, pulse, body temperature, etc. are connected to the 8 pins of port A after amplification, filtering, and denoising. When the microprocessor collects data, it selects the channel number by controlling the ADMUX register, and the read data is further processed by the CPU.
2.2 Serial communication interface circuit based on RS-232
As shown in Figure 2, J1 connected to the host PC uses 5 signal lines of RS-232, among which TX is the sending signal line of the PC, RX is the receiving signal line, and CGND is the ground line. RTS and DTR do not generate signals, but only generate high and low levels during initialization. RTS is set to +12V and DTR is set to -12V. The function of transistor Q1 is to invert the signal and output the RS-232 level.
Electrical safety is an issue that must be considered in medical measuring instruments. Traditional medical measuring instruments generally use isolation amplifiers to isolate analog signals. The shortcomings of this isolation technology are: (1) Different isolation technologies must be used for different analog signals; (2) The use of this isolation measure will cause problems in signal linearity, common mode rejection, and frequency response, which usually makes the circuit stability worse, the cost is higher, and the circuit becomes more complicated. The above-mentioned defects can be overcome by using digital signal isolation technology.
The photoelectric isolator 6N137 is a device that combines a light-emitting diode and a photosensitive tube and packages them together (see the box in Figure 2). Since the two parts are electrically isolated, the photoelectric isolation device can satisfactorily solve the problem of signal isolation and level matching. Through this isolation circuit, the power supply of the PC system and the power supply of the measuring instrument can be completely isolated, thereby ensuring the safety of the medical instrument, preventing the risk of electric shock, reducing the patient's leakage current, and also reducing the interference of the computer on the detection circuit.
3 Software Design
The software flow chart is shown in Figure 3. The software part adopts a modular and structured programming method and is written in assembly language. The functions of the relevant modules are as follows.
3.1 Initialization
Set the initial value of SP, clear the internal RAM area used by the program to 0, assign an initial value (8) to the data acquisition channel counter, and set the baud rate (115 200).
3.2 Data acquisition and A/D conversion
Sample each signal according to a predetermined sampling order. Since A/D conversion requires a certain amount of time, the delay waiting time should be slightly longer than the conversion completion time. After the previous conversion is completed, the next conversion should be started immediately. Since the analog signal becomes a 10-bit digital signal after A/D conversion, we use 2 bytes to store the data. The high byte stores the high 8-bit data, and the high bit of the low byte stores the lowest two-bit data, and the last 6 bits are filled with 0. At the same time, the sampling channel number is added to the lowest 3 bytes, so that when communicating with the host PC, the host computer can promptly and accurately determine which channel the data comes from, so as to facilitate the corresponding processing of each channel of data. Finally, the converted data is stored in the internal RAM in order.
Using R0 indirect addressing, the data in RAM is taken out and sent to the PC byte by byte at a baud rate of 115 200 bps. After sending 8 channels with a total of 16 bytes, the next round of sampling is carried out.
3.4 Host PC receiving data program
The host computer communication program consists of two parts: initialization subroutine and interrupt data receiving subroutine.
4 Conclusion
The serial communication interface circuit made of the hardware circuit and software provided above can work reliably and stably, realize the acquisition, conversion and error-free data transmission of multiple signals, and at the same time, it can meet the safety requirements of medical instruments and provide assistance for clinical human physiological signal measurement and pathological diagnosis.
2 Wu Xiaoming, Li Bin, Cui Wensheng, et al. Research on software system for multi-channel physiological parameter detection and analysis. Journal of Jinan University, 2000, 21 (1)
3 Sun Hongjun, Sun Xiuyun, Zhou Xuetie. Design of high-speed three-wire serial communication program using C language. Application of Electronic Technology, 1997 (6)
4 Yang Fusheng. On the discipline development strategy of biomedical signal processing research - Today and tomorrow of biomedical engineering. 1st edition. Tianjin: Tianjin Science and Technology Translation and Publishing Company, 1998: 465-483
Previous article:Application of 2704 controller in industrial control
Next article:Multi-channel temperature and humidity measurement and control system based on ADμC812 single chip microcomputer
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- EEWORLD University: How to use GaN to design reliable, high-density power solutions
- [Sipeed LicheeRV 86 Panel Review] Four Debian Python+Tk Calculators
- The relationship between LoraWAN, LPWAN and Lora
- Looking for PD Sink controller solution
- How to edit old posts?
- Failed to add serial port devices uart3-uart5 to the kernel
- EEWORLD University - Basic Knowledge of Welding
- micropython update: 2020.4
- [Fudan Micro FM33LG0 Series Development Board Review] Fudan Microchip uses J-Scope waveform software to accelerate product development
- How to make a circle of vias regularly?