1 Introduction
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 detectors. Medical detection instruments all use microprocessors to enhance their functions. The extensive application of microprocessor chips can enhance the intelligence of instruments, improve their stability and data processing accuracy, 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 fetched at the same time. Its FLASH and powerful peripheral interface capabilities make it one of the most popular microcontrollers at present.
This paper adopts the high-performance microprocessor chip Atmega163, and uses the idea of structured and modular program design to sample 8 channels of 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. The structure of this AVR microcontroller 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 in 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.
Atmega163 microcontroller provides a 10-bit analog-to-digital converter with good performance. 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 PC's sending signal line, 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 RS-232 level. [page]
Electrical safety is an issue that must be considered for 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) Using this isolation measure will cause problems in signal linearity, common mode rejection, and frequency response, which usually makes the circuit less stable, more expensive, and more complex. Using digital signal isolation technology can overcome the above defects.
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 medical instruments, preventing the risk of electric shock, reducing patient 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 modular and structured programming methods 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 in 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 bits of data, the high bit of the low byte stores the lowest two bits of 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 upper PC, the upper computer can promptly and accurately determine which channel the data comes from, so as to facilitate the corresponding processing of each data. Finally, the converted data is stored in the internal RAM in order.
3.3 Data transmission
Using the R0 indirect addressing method, the data in the 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 to realize the acquisition, conversion and error-free transmission of multi-channel signals. 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.
Previous article:Design of intelligent solar charger based on Atmega16 microcontroller
Next article:Design of speech recognition system based on ATMEGAl28 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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- [TI recommended course] #Live replay: TI mmWave millimeter wave radar application in automobiles#
- Data acquisition technology based on SDI-12 bus (communication protocol)
- 04. WS2812B driver implementation of SPI
- In-depth disassembly | The magical use of Qorvo chips in handheld vacuum cleaners
- Please ask a MicroPython question
- Noise suppression solution example in automotive power circuits
- How can wireless monitoring systems minimize latency?
- Power amplifier circuit composed of operational amplifier and NMOS
- Why are the lines drawn on the schematic connected randomly when imported into the PCB?
- What are the criteria for selecting voice chips on the market?