1、The introduction In todays society, along with the development of science and technology changes with each passing day, especially the development of computer technology by leaps and bounds, the computer technology with scientific research and production of many major leap forward, at the same time,
2、 the computer is becoming more and more widely applied to every aspect of peoples life and work areas. Single chip microcomputer with its small size, strong function, high speed, low price advantages, in the data processing and real-time control application has incomparable superiority, can be widel
3、y embedded in such as toys, household appliances, instrumentation, automotive electronics, robot systems, industrial control unit, office automation equipment, financial electronic systems, ships, personal information and communications terminal products. With (micro control technology in the high p
4、erformance control technology of software and hardware)s growing and development, MCU application will cause a great change of the traditional control technology. The application of single chip microcomputer breadth and depth, has become a national science and technology is an important sign of leve
5、l. In order to further deepen the understanding of single chip microcomputer and its interface, master the design method of hardware and software, to consolidate the university four years of learning, also give yourself a chance to practice, a few months, we devote this graduation design basic healt
6、h monitor - the human body. This system is applied to real-time monitor the bodys basic vital signs: heart rate, body temperature, blood pressure. Traditional measurement methods, especially the blood pressure measurement, which USES the measurement of blood pressure, complicated operation process n
7、eeds to be done there are professionals, cant completely meet the basic to the human body health and dynamic one to understand the requirements. Basic health monitor sets and human body measure heart rate, body temperature, blood pressure, as a whole, and handled by single chip microcomputer control
8、, the general population can be easy to use, without the need for a professional medical knowledge, believe that certain destinations for the masses. Is found that the problem of thinking, problem solving, we basically completed the graduation design task. But due to time and limited experience comb
9、ined with the lack of actual inspection, our design must have many shortcomings, hope the teacher can give correct and further help. In the design and Zhang Xiyang my classmates a group, to complete the task, he is mainly responsible for hardware design, I mainly responsible for the preparation of t
10、he software part. So this paper introduces the hardware part focuses on the software part will be the basis of writing. The total scheme 1. 1.1 project demonstration and the working principle of the system This system by setting up three works: keyboard heartbeats, body temperature, blood pressure t
11、esting. Heartbeat detection using sensor will heartbeat signals into a single chip microcomputer can accept, once every beat produces a pulse, make SCM generate an interrupt, every time, in addition to interrupt a count, every minute of the day on a heart rate sampling and statistics. Body temperatu
12、re detection of the digital temperature sensor chip DS18B20 temperature measurement. Measurement data decoding, through CD4511 input digital tube display. Measurement data if the transfinite alarm. Blood pressure detection BP01 type pressure sensor is used to change the pressure signal into electric
13、al signal through the op-amp by ADC0809 is converted into digital quantity into single chip. If blood pressure transfinite alarm. The scheme can effectively, real-time monitoring parameters measurement of heart rate, body temperature, blood pressure these requirements, can achieve the indicators of
14、system design, the design scheme is feasible. 1.2 overall scheme 2 the hardware design 2.1 master control chip MCS - 51 The main function MCS - 51 single chip microcomputer is the von neumann proposed by the classic computer architecture framework, that is, a computer is by arithmetic unit, controll
15、er, memory, input devices and output devices, a total of five basic parts. MCS - 51 single chip microcomputer in a chip used CPU, RAM, ROM, timer/counter and multifunction I/O port, etc. MCS - 51 single chip microcomputer system structure diagram is shown in figure 1. Figure MCS - 51 single chip mic
16、rocomputer system structure diagram By the graph, you can see that single chip microcomputer internal mainly includes the following several parts: (1) 8-bit CPU (2) an on-chip oscillators, oscillation frequency range of 1.2 12 MHZ f, can have the clock output (3) 128 bytes of data in memory (4) 4 k
17、bytes of memory on chip program (5) program memory address in the range of 64 k bytes 6 pieces of external data memory addressing in the range of 64 k bytes All landowners four 8-bit parallel I/O interface: P0, P1, P2, P3 Today two 16 bit timer/counter Pet-name ruby interrupt system with five interr
18、upt source The MCS - 51 single chip microcomputer internal structure MCS - 51 single chip microcomputer chip internal structure diagram as shown in figure 2. Figure 2 MCS - 51 single chip microcomputer chip internal structure (1) the CPU The central processing unit (CPU) is the core component of the
19、 single chip microcomputer, is the width of 8 bits of data processor, can deal with 8 bit binary data or code, the CPU is responsible for the control, command and scheduling of the entire unit system coordination work, to complete the operation and control of input and output functions such as opera
20、tions. CPU is the core component of single chip microcomputer, is composed of unit and the controller circuit. Arithmetic unit circuit Arithmetic unit circuit including ALU (arithmetic logic unit) and ACC (accumulator), B registers, status register, register 1 and register 2 parts, such as the funct
21、ion of the unit is for arithmetic and logical operations. Operation circuit with ALU as the core unit, can do more than half a byte, a single-byte and byte data arithmetic operations, including addition, subtraction, multiplication, division, decimal adjustment arithmetic operations such as and, or,
22、 xor, complementary and circulation, such as logic operation, the state by state register save operation results. The controller circuit Controller circuit including the program counter (PC), PC + 1 registers, instruction register, instruction decoder, data pointer DPTR, stack pointer SP, buffer, an
23、d timing and control circuit, etc. Control circuit to complete the command and control work, coordinate with single-chip computer parts work normally. (2) the timer/counter MCS - 51 single chip microcomputer chip has two 16 bit timer/counter and the timer 0 and timer 1. They can be used for timing c
24、ontrol, time delay and count and test of external events, etc. (this design is through the timer/counter of encoder input pulse count). (3) storage MCS - 51 series microcontroller program memory, including data storage and storage of its main characteristic is the program memory and data memory addr
25、essing space were independent of each other, physical structure is not the same. Except for the MCS - 51 series (8031), there are four physically independent storage space: the internal and external program memory and internal and external data memory. For 8051 the chip of the communist party of Chi
26、na has 8051 RAM unit, including 128 units are occupied by the special register, after only the first 128 units for the use of the user. (4) parallel I/O port MCS - 51 single chip microcomputer with a total of four eight I/O port (P0, P1, P2 and P3), each I/O lines can be used as input or output inde
27、pendently. P0 port for tristate bidirectional port, with eight TTL gate circuit, P1, P2 and P3 is two-way mouth mouth, load capacity of 4 TTL gate circuit. (5) the interrupt control system MCS - 51 single chip microcomputer interrupt function is stronger, in order to meet the needs of the control ap
28、plication. 8051 a total of five interrupt source, namely the external interrupt of 2, 2, timer/counter interrupt a serial interrupt. All interrupts are divided into superior and inferior two interrupt priority level. Pin signal Figure 3 for the MCS - 51 series microcontroller pins and logical symbol
29、s, DIP package them as the standard of 40 feet. Functional description of the pin is as follows: Figure 3 8051 MCU pin 1) power supply pin Vcc and Vss Vcc: power supply, + 5 v. Vss: ground terminal. 1. The input/output pin (I/O interface) (2) P0 interface (P0.0 P0.7); 8-bit bidirectional I/O interfa
30、ce, 39 32 feet. If the system has the external storage, P0 interface as a data bus and low 8 address each pin function brief description is as follows: Bus, through time-sharing operation to achieve the purpose of reuse. When the CPU to external storage operation, P0 interface used for the address b
31、us, first under the action of the ALE signal will address latch, and then make transfer P0 interface as the data bus Use, P0 interface can drive eight LSTTL load. (3) P1 interface (P1.0 P1.7); 8-bit bidirectional I/O interface, for 1 8 feet. Quasi bidirectional interface is refers to the internal pu
32、ll-up resistor, the interface can drive four LSTTL (low power take off base transistor logic shaw) load. P1 interface is common used as general I/O interface line. (4) control signal pin line A. PSEN (29 feet); External program memory read gating signal. During a visit to the external program memory
33、, PSEN gating signal as an external program memory storage (low level) effectively. When access to the external program memory. PSEN signal is invalid (high level) B. the ALE/PROG (30 feet); Address latch allow/programming signals. In access to external storage, this pin is address latch signals, an
34、d about 8751 internal EPROM programming, programming the signal as pulse input. 8051 single chip microcomputer addressable 64 KB, 16 address thread, including low 8 address line and the data sharing P0 interface, in a low 8-bit address signal, when using the ALE effective, used to control the latche
35、s latch P0 the low 8 - bit address of the interface; Send the data, the ALE is invalid, P0 interface output data, normal operation, and because of the ALE can be issued according to 1/6 of the main vibration frequency fixed frequency, so sometimes can take advantage of. C. RST/Vpd (9 feet) : reset s
36、ignal/standby power input. When the oscillator is working, if the pin to keep two cycles of high level, can make the microcontroller reset. This pin also can be used as the input end of the standby power, when the microcontroller during power loss, by the Vpd to slice data provide the power and to p
37、rotect the contents. XTAL1 and XTAL2 clock circuit (5) pin XTAL1: external crystals and fine-tuning capacitor, at the end of the inverter in piece it is oscillator amplifier input, if the use of external TTL clock, the pin must be grounded. XTAL2: external crystals and fine-tuning capacitor, on the
38、other side of the inverter in a piece of it is oscillator amplifier output, if the use of external TTL clock, this pin for external clock input. The second function of 6. P3 mouth P3.0 serial input P3.1 serial input O request input P3.2 external interrupt P3.3 external interrupt request input 1 Exte
39、rnal P3.4 timer/counter 0 signal input terminal P3.5 timer/counter 1 external counting signal input terminal P3.6 external data memory write strobe output signal P3.7 external data memory read gate output signal 2. 2 ADC0809 is introduced This system use ADC0809 and pressure sensor of BP01 blood pre
40、ssure detection section. ADC0809 is 8 bits A/D converter, 8 road multiway switch and microprocessor compatible control logic CMOS components. It is successive approximation A/D converter, can direct interface with single-chip microcomputer. ADC0809 internal logical structure Figure 4 ADC0809 interna
41、l structure By above knowable, 5.1 ADC0809 analog switch by an 8 road, an address latch and decoder, an A/D converter and A tri-state output latch. Multiway switch optional eight analog channels, allowing 8-way analog input, time-sharing share A/D converter. Tri-state output is used to latch lock A/
42、D convert the digital quantity, when the OE end for high electricity at ordinary times, can from three states the output latch removed after conversion of data. Pin structure Figure 5 figure ADC0809 pin IN0 - IN7:8 analog input channels ADC0809 for analog input requirements: signal single polarity a
43、nd voltage range is 0 to 5 v, if the signal is too small, must be large; Input analog in the process of transformation should remain the same, if analog changes too fast, need to increase the sampling keeping circuit before input. Address input and control line: 4 ALE to address latch allow input li
44、ne, the high level effectively. When the ALE line for high electricity at ordinary times, address latch and decoder will be A, B, C three address line address signal is latched, after decoding the selected channel analog transformed into the converter. A, B and C for address input line, used for gat
45、ing IN0 - IN7 analog input all the way. Channel selection table shown in the following table. C B A selected channel 0 0 0 IN0 0 0 1 IN1 1 0 0 IN2 0 1 1 IN3 1 0 0 IN4 1 0 1 IN5 1 1 0 IN6 1 1 1 IN7 ST for conversion start signal. When jumping along the ST, all internal registers reset; Under the edge
46、, to begin A/D conversion; During the period of transformation, ST should maintain a low level. EOC as the end signal conversion. When the EOC for high electricity at ordinary times, show that transformation over; Otherwise, it shows that the ongoing A/D conversion. OE as the output enable signal, i
47、s used to control the three output latch to microcontroller output data conversion. OE = 1, the output data by converting; OE = 0, the output data in high impedance state. D7 - D0 for digital output line. For clock CLK input signal lines. Because of ADC0809 internal clock circuit, the clock signal m
48、ust be provided by the outside world, usually use frequency is 500 KHZ. VREF (+), VREF (-) as the reference voltage input. ADC0809 use . ADC0809 internal with the output latch. . Initialization, ST and OE signal for low level. . Which send to convert channel of addresses to A, B, C on port. (this de
49、sign using only the first channel IN0). . At least 100 mu in ST side give a s wide is the pulse signal. . Whether conversion finished, we according to the EOC signal. . When the EOC is a high electricity at ordinary times, then gave OE for high level, and converting data output to the single chip microcomputer.