krupal final
Post on 06-Apr-2018
220 Views
Preview:
TRANSCRIPT
-
8/2/2019 Krupal Final
1/41
MICROCONTROLLER BASED HEART RATE METER
BACHELOR OF TECHNOLOGY
IN
ELECTRONICS AND COMMUNICATION
ENGINEERING
M.KRUPAL KUMAR (08AG1A0437)
P.HARSHAVARDHAN (08AG1A0451)
N.SHASHIKANTH (08AG1A0439)
DEPARTMENT OF ELECTRONICS AND
COMMUNICATIONS
ACE ENGINEERING COLLEGE
Ankushapur(V), Ghatkesar(M), R.R.Dist - 501 301
2011-12
1
-
8/2/2019 Krupal Final
2/41
MICROCONTROLLER BASED HEART RATE METER
A Mini Project Report
Submitted in the partial Fulfillment of the
Requirements
For the Award of the Degree of
BACHELOR OF TECHNOLOGY
IN
ELECTRONICS AND COMMUNICATION
ENGINEERING
SUBMITTED
BY
M.KRUPAL KUMAR (08AG1A0437)
P.HARSHAVARDHAN (08AG1A0451)
N.SHASHIKANTH (08AG1A0439)
DEPARTMENT OF ELECRTRONICS AND COMMUNICATIONS
ACE ENGINEERING COLLEGE
Ankushapur(V), Ghatkesar(M), R.R.Dist - 501 301
2
-
8/2/2019 Krupal Final
3/41
ACE ENGINEERING COLLEGE
Ankushapur[v], Ghatkesar [M], R.R dist-501301
(Approved by AICTE, Newdelhi and affiliated to JNTUH)
CERTIFICATE
This is to certify that the mini project entitled MICROCONTROLLER BASED
HEART RATE METER done by M.Krupalkumar (08AG1A0437), P.Harshavardhan
(08AG1A0451), N.Shashikanth (08AG1A0439) of Department of Electronics and
Communications Engineering, is a record of bonafide work carried out by them. This
mini project is done as a partial fulfillment of obtaining Bachelor of Technology De-
gree to be awarded by Jawaharlal Nehru Technological University, Hyderabad, during
the academic year 2011-12
C.Satyanarayana S.Surya Narayana
Associate Professor, Professor and Head,
Department of ECE Department of ECE
3
-
8/2/2019 Krupal Final
4/41
ACKNOWLEDGEMENT
It is a pleasure to thank the many people who made this project possible.
We would like to express the deepest appreciation to our internal guide ,C.Satyanarayana, Department of Electronics & Communications, Who has the
attitude and the substance of genius . He continually and convincingly conveyed
a spirit of adventure in regard to the project and an excitement in regard to
teaching. Without his guidance and persistent help this project would not have
been possible.
We are indebted to the Head of the Department of Electronics and Com-
munications Engineering, S.Suryanarayana for giving us an opportunity to work
on this project. Being the Socratic force that he has always been brought us clos-
er to the reality we had initially perceived, eventually enabling us to grasp the
rich complexity of the engineering world.
We would like to thank the principal, Dr.V.Buchaiah of ACE engineering
college for the steadfast support throughout of our course of Engineering and for
providing a stimulating and fun environment in which to learn and grow.
We are especially grateful to the faculty members of department of Electron-
ics and Communications for their kind assistance.
We are forever grateful to our parents whose foresight and values paved the
way for a privileged education .
4
-
8/2/2019 Krupal Final
5/41
ABSTRACT
Heart rate can be measured either by the ECG waveform or by the
blood flow into the finger (pulse method). The pulse method is simple and convenient.
When blood flows during the systolic stroke of the heart into the body parts, the finger
gets its blood via the radial artery on the arm. The blood flow into the finger can be
sensed photo-electrically. To count the heart beats, here we use a small light source on
one side of the finger (thumb) and observe the change in light intensity on the other
side. The setup uses a IR transmitter for light illumination of flesh on the thumb behind
the nail and the IR receiver as detector of change in the intensity due to the flow of
blood .The photo-current is converted into voltage and amplified by operational ampli-
fier IC LM358
5
-
8/2/2019 Krupal Final
6/41
INDEX PAGE NO.
CERTIFICATE 3
AKNOWLEDGMENT 4
ABSTRACT 5
1. INTRODUCTION 8
2. GENERAL HEART MONITERING SYSTEM 9
3. DESIGN OF MICROCONTROLLER BASED HEART RATE
METER 10
4. HARDWARE DEVELOPMENT 12
5. HARDWARE REQUIREMENTS 14
6. COMPONENTS DESCRIPTION 16
6.1 LM358 QUAD OPERATIONAL AMPLIFIER 16
6.2 7805, 5V REGULATOR 17
6.3 2 X 16 LIQUID CRYSTAL DISPLAY 18
6.4 CRYSTAL OSCILLATOR 19
6.5 BC548 NPN TRANSISTOR 21
6.6 DIODES 22
6.6.1 1N4007 RECTIFIER DIODE, 6.6.2 LED 23
6.7RESISTORS AND CAPACITORS 24
6.8AT89S52 MICROCONTROLLER 36
6
-
8/2/2019 Krupal Final
7/41
6.9 PROGRAM 30
7. CONCLUSION 37
8. FUTURE SCOPE 38
INDEX PAGE NO.
LIST OF FIGURES
1. FIG.2 GENERAL HEART MONITRING SYSTEM 9
2. FIG.3 DESIGN OF MC BASED HEART RATE METER 10
3. FIG.3.1 BLOCK DIAGRAM 11
4. FIG.4 CIRCUIT DIAGRAM 12
5. FIG.4.1 FINGER CLIP MODELS 13
6. FIG.6.1.1 LM385 QUAD OPAMP 16
7. FIG. 6.1.2 PIN CONFIGURATION OF 7805 17
8. FIG. 6.2.1 7805,5V VOLTAGE REGULATOR 17
9. FIG.6.3.1 LCD 19
10. FIG.6.4.1,6.4.2 CRYSTAL OSCILLATOR 20
11. FIG.6.5.1,6.5.2 BC 547 NPN TRANSISTOR 2112. FIG.6.6.1 RECTIFIER DIODE 23
13. FIG.6.6.2 LED 23
14. FIG.6.7.1 RESISTORS 24
15. FIG.6.7.2 CAPACITOR 25
16. FIG.6.8.1 PIN DIAGRAM OF AT89S52 27
17. FIG.6.8.2 BLOCK DIAGRAM OF AT89S52 28
18. LCD DISPLAY 38
LIST OF TABLES
1. TABLE1 HARDWARE REQUIREMENTS 14-15
7
-
8/2/2019 Krupal Final
8/41
CHAPTER 1
INTRODUCTION
Manya time we measure the heart rate by using the ECG waveform.
This leads to considerable wastage of money Though some circuits are already avail-
able for the purpose, most of them are
1. Expensive,
2. Require a thorough knowledge of microcontroller programming,
3. Too complicated to assemble by amateurs and hobbyists.
Some others are too basic in their operation and prone to malfunction.
This Project MICROCONTROLLER BASED HEART RATE METER is
a reliable circuit that takes over the task of controlling the appliances.
Microcontroller based heart rate meter is presented here the pulse method is simple and
convenient. When blood flows during the systolic stroke of the heart into the body
parts, the finger gets its blood via the radial artery on the arm. The blood flow into the
finger can be sensed photo-electrically.
Microcontroller IC AT89S52 is at the heart of the circuit. It is a 40-pin, 8-bit microcon-
troller with 8 KB of Flash programmable and erasable read-only memory (EPROM).
The design of a low-cost microcontroller based device for measuring the heart pulse
rate has been described. The device has the advantage that it can be used by non-pro-
fessional people at home to measure the heart rate easily and safely.
The circuit presented here is relatively simple, inexpensive and can be assem-
bled by anyone having some knowledge of Electronics.
8
-
8/2/2019 Krupal Final
9/41
-
8/2/2019 Krupal Final
10/41
Fig.2
CHAPTER 3
DESIGN OF MICROCONTROLLER BASED HEART RATE METER
INTRODUCTION:
The design of microcontroller based heart rate meter comprises of IR sen-
sors, Microcontroller, Op-amp, voltage regulator, power-supply, finger Pulse
module
10
-
8/2/2019 Krupal Final
11/41
-
8/2/2019 Krupal Final
12/41
high transitions of the wave. This time in micro seconds is converted in steps of 4 ms
for comparison with the values already stored in the look-up table. This
number is used to find (from the look-up table) the heart rate in beats per minute. The
number so obtained is converted into a 3-digit number in binary-coded decimal (BCD)
form.
BLOCK DIAGRAM :
Fig.3.1
CHAPTER 4
HARDWARE DEVELOPMENT
12
-
8/2/2019 Krupal Final
13/41
CIRCUIT-DIAGRAM
fig.4
WORKING PRINCIPLE:
Basically, the device consists of an infrared transmitter LED and an infrared
sensor photo-transistor.
The transmitter-sensor pair is clipped on one of the fingers
The LED emits infrared light to the finger of the subject.
The photo-transistor detects this light beam and measures the change of blood
volume through the finger artery.
This signal, which is in the form of pulses is then amplified and filtered suit-
ably and is fed to a low-cost microcontroller for analysis and display.
13
-
8/2/2019 Krupal Final
14/41
The microcontroller counts the number of pulses over a fixed time interval and
thus obtains the heart rate of the subject.
These sensor clips consist of only a pair of IR photo transistor and receiver
LEDs enclosed in a specially designed plastic clip housing and cable with stereo
jack plug.
FINGER CLIP MODELS:
fig.4.1
The IR transmitter and receiver are encapsulated in this clipping device
fig.4.2
14
-
8/2/2019 Krupal Final
15/41
CHAPTER 5
HARDWARE REQUIREMENTS
15
-
8/2/2019 Krupal Final
16/41
16
S.NO NAME OF THE COMPONENT RANGE QUANTITY
1 LM358 QUAD OPERATIONAL AMPLIFIER - 1
2 7805, VOLTAGE REGULATOR 5V 1
3 AT89S52 MICROCONTROLLER - 1
4 CRYSTAL OSCILLATOR - 1
5 BC548 NPN TRANSISTOR - 1
6 2 X16 LCD - 1
7 IN4007 RECTIFIER DIODE - 3
8 ZENER DIODE 6.8V
3.3V
1
1
9 LED - 1
10 RESISTORS(ohms)
LIGHT DEPENDENT RESISTORS
0.1k
1k
10k
22k
100k
-
1
2
1
1
1
1
11 CAPACITORS(micro farads) 1 f,63V
33pf
100f
470f,25V
1
2
1
1
12 230V AC PRIMARY TO 12V-0-12V,500mA SEC-
ONDARY TRANSFORMER
- 1
13 FINGER PULSE MODULE - 1
14 VARIABLE RESISORS 0-10k 1
-
8/2/2019 Krupal Final
17/41
Table.1
CHAPTER 6
COMPONENTS DESCRIPTION
6.1 LM358 QUAD OPERATIONAL AMPLIFIER
Description:
The LM358 series consists of two independent high gain,internally frequency
compensated Operational amplifiers which were designed Specially to operate
from a single power supply over a wide range of voltages.
17
-
8/2/2019 Krupal Final
18/41
Fig.6.1.1
Applications include transducer amplifiers, dc amplification blocks, and all the
conventional operational amplifier circuits that now can be implemented more
easily in single-supply-voltage systems
Features:
Wide bandwidth(unity gain): 1 MHz
Low input offset voltage : 2 mV
Large dc voltage gain : 100 dB
Differential input voltage range equal to the power supply voltage.
Power drain suitable for battery operation.
Large output voltage swing: 0VDC to VCC-1.5VDC.
PIN CONNECTIONS(TOP VIEW):
Fig .6.1.2
18
-
8/2/2019 Krupal Final
19/41
6.2 7805, 5V REGULATOR
Description:
The 7800 series of three-terminal positive regulator are available in the
TO-220/D-PAK package and with several fixed output voltages, making them useful in
a wide range of applications. Each type employs internal current limiting, thermal shut
down and safe operating area protection, making it essentially indestructible.
Fig 6.2.1
If adequate heat sinking is provided, they can deliver over 1A output cur-
rent. Although designed primarily as fixed voltage regulators, these devices can be
used with external components to obtain adjustable voltages and currents.
Features:
Output Current up to 1A
Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V
Thermal Overload Protection
Short Circuit Protection
Output Transistor Safe Operating Area Protection
6.3 2X16 LIQUID CRYSTAL DISPLAY
Description:
19
-
8/2/2019 Krupal Final
20/41
Liquid Crystal Display also called as LCD is very helpful in providing user interface as
well as for debugging purpose. The most common type of LCD controller is HITACHI
44780 which provides a simple interface between the controller & an LCD. These
LCD's arevery simple to interface with the controller as well as are cost effective
Pin Symbol Function
1 Vss Ground
2 Vdd Supply Voltage
3 Vo Contrast Setting4 RS Register Select
5 R/W Read/Write Select
6 En Chip Enable Signal
7-14 DB0-DB7 Data Lines
15 A/Vee Gnd for the backlight
16 K Vcc for backlight
Table.2
Fig 6.3.1
The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines. The
number on data lines depends on the mode of operation.
If operated in 8-bit mode then 8 data lines + 3 control lines i.e. total 11 lines are
required. And if operated in 4-bit mode then 4 data lines + 3 control lines i.e. 7lines are required.
20
-
8/2/2019 Krupal Final
21/41
How do we decide which mode to use..? Its simple if you have sufficient data
lines you can go for 8 bit mode & if there is a time constrain i.e. display should
be faster then we have to use 8-bit mode because basically 4-bit mode takes
twice as more time as compared to 8-bit mode.
The 10k Potentiometer controls the contrast of the LCD panel
6.4 CRYSTAL OSCILLATOR
Description:
Fig 6.4.1
Figure 1. shows the crystal equivalent circuit. R is the effective series resistance, L
and C are the motional inductance and capacitance of the crystal. CP is the shunt
capacitance due to the crystal electrodes.
When the crystal is operating in parallel resonant mode it looks inductive.
The frequency of operation in this mode is defined by the load on the crystal.
The crystal manufacturer should specify the load capacitance CL for parallel resonant
crystals. In this mode the frequency of oscillation is given by the equation
21
-
8/2/2019 Krupal Final
22/41
Crystal oscillator circuit:
Fig6.4.2
Features:
Wide range of operating supply voltage: 1.50V to5.5V
Regulated voltage drive oscillator circuit for reduced power consumption and
crystal drive current
Optimized low crystal drive current oscillation for miniature crystal units
6.5 BC547 NPN TRANSISTOR
Description:
The design of a transistor allows it to function as an amplifier or
a switch. This is accomplished by using a small amount of electricity to control
a gate on a much larger supply of electricity, much like turning a valve to con-
trol a supply of water .
22
-
8/2/2019 Krupal Final
23/41
Fig 6.5.1
Transistors are composed of three parts a base , a collector , and an
emitter . The base is the gate controller device for the larger electrical supply .
The collector is the larger electrical supply , and the emitter is the outlet for that
supply . By sending varying levels of current from the base , the amount of cur-
rent flowing through the gate from the collector may be regulated. In this way ,
a very small amount of current may be used to control a large amount of cur-
rent , as in an amplifier . The same process is used to create the binary code for
the digital processors but in this case a voltage threshold of five volts is needed
to open the collector gate . In this way , the transistor is being used as a switch
with a binary function: five volts ON , less than five volts OFF .
Features:
Low current (max. 100mA)
Low voltage (max. 65 V).
23
-
8/2/2019 Krupal Final
24/41
Fig 6.5.2
6.6 DIODES
In electronics , a diode is a two - terminal electronic component that
conducts electric current in only one direction. The term usually refers to a
semiconductor diode , the most common type today . This is a crystalline block
of material connected to two electrical terminals . A vacuum tube diode ( now lit-
tle used except in some high power technologies ) is a vacuum tube with two
electrodes ; a plate and a cathode .
The most common function of a diode is to allow an electric current to
pass in one direction ( called the diode'sforwarddirection ) while blocking cur-
rent in the opposite direction ( the reverse direction ) . Thus , the diode can be
thought of as an electronic version of a check valve . This unidirectional behavior
is called rectification, and is used to convert alternating current to direct current ,
and to extract modulation from radio signals in radio receivers .
6.6.1 1N4007 RECTIFIER DIODE
24
http://en.wikipedia.org/wiki/Electronicshttp://en.wikipedia.org/wiki/Terminal_(electronics)http://en.wikipedia.org/wiki/Electronic_componenthttp://en.wikipedia.org/wiki/Electric_currenthttp://en.wikipedia.org/wiki/Vacuum_tubehttp://en.wikipedia.org/wiki/Electrodehttp://en.wikipedia.org/wiki/Plate_electrodehttp://en.wikipedia.org/wiki/Cathodehttp://en.wikipedia.org/wiki/Check_valvehttp://en.wikipedia.org/wiki/Rectification_(electricity)http://en.wikipedia.org/wiki/Alternating_currenthttp://en.wikipedia.org/wiki/Direct_currenthttp://en.wikipedia.org/wiki/Modulationhttp://en.wikipedia.org/wiki/Electronicshttp://en.wikipedia.org/wiki/Terminal_(electronics)http://en.wikipedia.org/wiki/Electronic_componenthttp://en.wikipedia.org/wiki/Electric_currenthttp://en.wikipedia.org/wiki/Vacuum_tubehttp://en.wikipedia.org/wiki/Electrodehttp://en.wikipedia.org/wiki/Plate_electrodehttp://en.wikipedia.org/wiki/Cathodehttp://en.wikipedia.org/wiki/Check_valvehttp://en.wikipedia.org/wiki/Rectification_(electricity)http://en.wikipedia.org/wiki/Alternating_currenthttp://en.wikipedia.org/wiki/Direct_currenthttp://en.wikipedia.org/wiki/Modulation -
8/2/2019 Krupal Final
25/41
Fig6.6.1
Features:
Low forward voltage drop
Low leakage current
High forward surge capability
6.6.2 LIGHT EMITTING DIODE (LED)
A light-emitting diode (LED), figure is a semiconductor diode that emits
light when an electrical current is applied in the forward direction of the device, as in
the simple LED circuit. The effect is a form of electroluminescence where incoherent
and narrow-spectrum light is emitted from p-n junction.
Fig.6.6.2
LEDs are widely used as indicator lights on electronic devices and in-
creasingly in higher power applications such as flashlights and area lighting. An LED is
25
-
8/2/2019 Krupal Final
26/41
usually a small area (less than 1 mm) light source, often with optics added to the chip to
shape its radiation pattern and assist in reflection. The color of the emitted light depends
on the composition and condition of the semi conducting material used; and can be in-
frared, visible, or ultraviolet. Besides lighting, interesting applications include using
UV-LEDs for sterilization of water and disinfection of devices, and as a grow light to
enhance photosynthesis in plants.
6.7 RESISTORS AND CAPACITORS
RESISTOR:
A resistor is a two-terminal electronic component as shown in figure de-
signed to oppose an electric current by producing a voltage drop between its termi-
nals in proportion to the current, that is, in accordance with Ohms law: V=IR. The re-
sistance R is equal to the voltage drop Vacross the resistor divided by the currentI
through the resistor.
Fig 6.7.1
The ohm (symbol: ) is the SI unit of electrical resistance, named after
George Ohm. The most commonly used multiples and submultiples in electrical and
electronic usage are the milliohm, ohm, kilo-ohm, and mega-ohm.
CAPACITOR:
26
-
8/2/2019 Krupal Final
27/41
A capacitor is an electrical/electronic device, as shown in figure that can
store energy in the electric field between a pair of conductors (called plates). The
process of storing energy in the capacitor is known as charging, and involves elec-
tric charges of equal magnitudes, but opposite polarity, building up on each plate.
A capacitor consists of two conductive electrodes, or plates, separated by a
dielectric, which prevents charge from moving directly between the plates. Charge may
however be moved indirectly by external influences, such as a battery connecting the
terminals. After removing the external influences, the charge on the plates persists.
The separated charges attract each other, and an electric field is present between the
plates.
Fig 6.7.2
Capacitors are often used in electric and electronic circuits as ener-
gy-storage devices. They can also be used to differentiate between high-fre-
quency and low-frequency signals. This property makes them useful in electronic fil-
ters. Charge separation in a parallel-plate capacitor causes an internal electric field. A
polarized dielectric spacer (orange) reduces the electric field and increase the capaci-
tance.
A property called the capacitance C, which is a measure of the charge
stored on each plate for a given voltage such that
q(t)=Cv(t)
For an ideal parallel plate capacitor.In SI unit, a capacitor has a capacitance of one
farad when one coulomb of charge storage corresponds to one volt between its plates.
27
-
8/2/2019 Krupal Final
28/41
Since the farad is a very large unit, capacitance is usually expressed in microfarads
(F), nanofarads (nF), or picofarads (pF).
6.8 MICROCONTROLLER AT89S52
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller
with 8Kbytes of in-system programmable Flash memory.
The device is manufactured using Atmels high-density nonvolatile memory
technology and is compatible with the industry-standard 80C51 instruction set
and pin out.
The on-chip Flash allows the program memory to be reprogrammed in-system
or by a conventional nonvolatile memory programmer.
By combining a versatile 8-bit CPU with in-system programmable Flash on
a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which pro-
vides a highly-flexible and cost-effective solution to many embedded control
applications.
The AT89S52 provides the following standard features: 8K bytes of Flash, 256
bytes
of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit
timer/counters, a six-vector two-level interrupt architecture, a full duplex serial
port, on-chip oscillator, and clock circuitry.
In addition, the AT89S52 is designed with static logic for operation down to
zero frequency and supports two software selectable power saving modes.
The Idle Mode stops the CPU while allowing the RAM, timer/counters, serialport, and interrupt system to continue functioning. The Power-down mode saves
the RAM contents but freezes the oscillator, disabling all other chip functions
until the next interrupt or hardware reset.
PIN DIAGRAM OF AT89S52 :
28
-
8/2/2019 Krupal Final
29/41
29
-
8/2/2019 Krupal Final
30/41
Fig 6.8.1
BLOCK DIAGRAM OF AT89S52 :
30
-
8/2/2019 Krupal Final
31/41
Fig 6.8.2
Port 0: Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink
eight TTL inputs. When 1sare written to port 0 pins, the pins can be used as high impedance
inputs.
Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pullups.The Port 1 output buffers can
sink/source four TTL inputs.When 1s are written to Port 1 pins, they are pulled high by
the internal pullups and can be used as inputs. As inputs,Port 1 pins that are externally being
pulled low will sourcecurrent (IIL) because of the internal pullups.
Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pullups..The Port 2 output bufferscan sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by
the internal pullups and can be used as inputs. As inputs ,Port 2 pins that are externally being
pulled low will source current (IIL) because of the internal pullups.
Port 3: Port 3 is an 8-bit bidirectional I/O port with internal pullups.The Port 3 output buffers can
sink/source four TTL inputs.When 1s are written to Port 3 pins, they are pulled high by
the internal pullups and can be used as inputs. As inputs,Port 3 pins that are externally being
pulled low will sourcecurrent (IIL) because of the pullups.
Table.3
Timer 2 Interrupt :
Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event
counter. The type of operation is selected by bit C/T2 in the SFR T2CON
31
-
8/2/2019 Krupal Final
32/41
Timer 2 has three operating modes: capture, auto-reload (up or down counting), and
baud rate generator. The modes are selected by bits in T2CON
It consists of two 8-bit registers, TH2 and TL2. In the Timer function, the TL2 register is
incremented every machine cycle. Since a machine cycle consists of 12 oscil-
lator periods , the count rate is 1/12 of the oscillator frequency.
6.9 PROGRAM :
;> TITLE : HEART RATE MONITERING SYSTEM
;> TARGET : AT89S52
;> STARTED : 02-08-2011
------------------------------------------------------------------------------------------------------
;>
;> INCLUDES :
$MOD51
;>
;------------------------------------------------------------------------------------------------------------
;>
;> HARD WARE DETAILS :
;>
;> DISPLAY ENEBLE - P2.5
DEN BIT P2.5
;> DISPLAY READ/WRITE - P2.6
DRW BIT P2.6
;> DISPLAY REG SELECT - P2.7
DRS BIT P2.7
;>;------------------------------------------------------------------------------------------------------------
;>
;> FLAGS:
BUSY_CHEK BIT 00H
PL_FLG BIT 01H
MIN_FLG BIT 02H
;>
;------------------------------------------------------------------------------------------------------------
;>
;> VARIABLES:
ADC_VAL DATA 30H
TMPR_VAL DATA 31H
32
-
8/2/2019 Krupal Final
33/41
TMPR_VAH DATA 32H
PULSE DATA 33H
TCNT1 DATA 34H
TCNT2 DATA 35H
TPLS DATA 36H
PCNT DATA 37HPULSE1 DATA 38H
;>
;------------------------------------------------------------------------------------------------------------
;>
;> DEFINITIONS :
COM EQU 0fch ; command ;display headers
DAT EQU 0fdh ; data
EOL EQU 0feh ; end of line
;>
;------------------------------------------------------------------------------------------------------------
;>
;> VECTOR ADDRESESS:
ORG 0000H
ljmp RESET
ORG 0003H
lcall EXT_I0
reti
ORG 000BH
push ACC
push PSW
mov TH0, #0DBH
mov TL0, #0FFH
inc TCNT1
mov A, TCNT1
cjne A, #100D, SKIP_SEC
mov TCNT1, #00h
cpl P3.5
inc TCNT2
mov A, TCNT2
cjne A, #60D, SKIP_SEC
mov TCNT2, #00h
cpl P3.3
setb MIN_FLG
mov PULSE, TPLS
mov TPLS, #00h
SKIP_SEC:
pop PSW
pop ACCRETI
33
-
8/2/2019 Krupal Final
34/41
;>
;------------------------------------------------------------------------------------------------------------
;>
RESET:
mov P3, #0FFH ; move all ports HIGH
mov P2, #0FFHmov P1, #0FFH
mov P0, #0FFH
mov sp, #065H ; init stack pointer
mov dptr, #INITIALISE
lcall MESSAGE
mov dptr, #NAME
lcall MESSAGE
lcall DLY
mov dptr, #COLLEGE
lcall MESSAGE
lcall DLY
mov dptr, #NAME1
lcall MESSAGE
lcall DLY
mov dptr, #NAME2
lcall MESSAGE
lcall DLY
mov dptr, #GUIDE
lcall MESSAGE
lcall DLY
mov dptr, #HOD
lcall MESSAGE
lcall DLY
mov dptr, #CLRSCR
lcall MESSAGE
mov TCON, #05H
mov TMOD, #21H
mov IE, #83H
setb TR0
mov TH0, #0DBH
mov TL0, #0FFH
mov TPLS, #00h
mov PULSE, TPLS
clr MIN_FLG
mov TCNT1, #00h
mov TCNT2, #00h
mov PCNT, #00h
clr PL_FLG
;>
;------------------------------------------------------------------------------------------------------------
;>MAIN:
34
-
8/2/2019 Krupal Final
35/41
jnb MIN_FLG, DONT_RST_VAL
clr MIN_FLG
mov R7, #01H
lcall DISP_COM
lcall DLY1
DONT_RST_VAL:jb P3.7, RESET_PULSE
mov PULSE, #00H
mov TPLS, #00H
RESET_PULSE:
lcall DISP_PLS
ljmp MAIN
;>
;------------------------------------------------------------------------------------------------------------
;>
EXT_I0:
push ACC
push PSW
cpl P3.4
inc TPLS
mov A, TPLS
clr C
da A
mov TPLS, A
DONT_CNT_PLS:
pop PSW
pop ACC
ret ; return to message
;>
;------------------------------------------------------------------------------------------------------------
;>
MESSAGE: ; sub for sending charactors to display
push acc
MESSAGE1:
lcall READY ; Check weather display is ready
clr a ; Clr accumulator
movc a, @a+dptr ; Load accumulator with the contents of dptr
inc dptr ;
cjne a, #EOL, COMD ; If the data is not end of line goto comd
pop acc
ret ; if the data is end of line stop sending
COMD: ;
cjne a, #COM, DDATA ; if the data is not command goto dataclr DRS
35
-
8/2/2019 Krupal Final
36/41
clr BUSY_CHEK
sjmp MESSAGE1 ; goto message again
DDATA: ;
cjne a, #DAT, SENDIT ; if the data is not data to be send goto comdsetb DRS
setb BUSY_CHEK
sjmp MESSAGE1 ; goto message again
SENDIT: ;
mov P0, a ; place the data at port 1
clr DRW
nop
setb DEN ; send enable strobe
clr DEN ;
sjmp MESSAGE1 ; goto message again
;>
;------------------------------------------------------------------------------------------------------------
;>
READY: ; sub to check display busy
clr DEN ; disable display buffer
mov P0, #0FFH ; set port1 in read mode
clr DRS
setb DRW
WAIT: ;
clr DEN ; send enable strobe
setb DEN ;
jb P0.7, WAIT ; if display is not send ready signal be in loop
clr DEN ; disable display buffer
jnb BUSY_CHEK, NO_DRS_SET
setb DRS
NO_DRS_SET:
ret ; return to message
;>
;------------------------------------------------------------------------------------------------------------
;>
DISP_LET:
lcall READY ; Check whether display is ready
setb DRS
setb BUSY_CHEK
mov P0, R7 ; place the data at port 1
clr DRW
nop
setb DEN ; send enable strobe
clr DEN ;
ret ; return to message
;>;------------------------------------------------------------------------------------------------------------
36
-
8/2/2019 Krupal Final
37/41
;>
DISP_COM:
lcall READY ; Check whether display is ready
clr DRS
clr BUSY_CHEK
mov P0, R7 ; place the data at port 1clr DRW
nop
setb DEN ; send enable strobe
clr DEN ;
ret ; return to message
;>
;------------------------------------------------------------------------------------------------------------
;>
DISP_PLS:
mov DPTR, #PLSEH
lcall MESSAGE
mov A, PULSE
anl A, #0F0h
swap A
add A, #30H
mov R7, A
lcall DISP_LET
mov A, PULSE
anl A, #0Fh
add A, #30H
mov R7, A
lcall DISP_LET
RET ; END SUB
;>
;------------------------------------------------------------------------------------------------------------
;>
DLY:
mov r4, #0fh
GONE: mov r5, #00h
OUT: mov r6, #00h
IN: djnz r6, IN
djnz r5, OUT
djnz r4, GONE
ret
DLY1:
mov r4, #01h
GONE1: mov r5, #02hOUT1: mov r6, #00h
37
-
8/2/2019 Krupal Final
38/41
IN1: djnz r6, IN1
djnz r5, OUT1
djnz r4, GONE1
ret
DLY2:
mov r4, #03hGONE2: mov r5, #00h
OUT2: mov r6, #00h
IN2: djnz r6, IN2
djnz r5, OUT2
djnz r4, GONE2
ret
DLY3:
mov r0, #25h
OUT3: mov r3, #00h
IN3: djnz r3, IN3
djnz r0, OUT3
ret
;>
;------------------------------------------------------------------------------------------------------------
;>
;> ROM TABLE AREA
;>
INITIALISE:
db COM, 30h, 30h, 30h, 30h, 3ch, 06h, 0ch, 01h, EOL
NAME:
db COM, 80h, DAT, ' HEART RATE ', COM, 0C0H, DAT,'MONITRING SYSTEM', EOL
COLLEGE:
db COM, 80h, DAT, 'ACE ENGG.COLLEGE', COM, 0C0H, DAT,' HYDERABAD ', EOL
NAME1:
db COM, 80h, DAT, 'SUBMITTED BY.. ', COM, 0C0H, DAT,'N.SHASHI KANTH ', EOL
NAME2:
db COM, 80h, DAT, 'M.KRUPAL KUMAR ', COM, 0C0H, DAT,'P.HARSHA VARDHAN', EOL
GUIDE:
db COM, 80h, DAT, 'GUIDED BY.. Mr.', COM, 0C0H, DAT,'C.SATYANARAYANA ', EOL
HOD:
db COM, 80h, DAT, 'OUR HOD.. Mr.', COM, 0C0H, DAT,'SURYA NARAYANA ', EOL
PLSEH:
db COM, 80h, DAT, 'PULSE = ', EOL
CLRSCR:
db COM, 01h, EOL
;>
;------------------------------------------------------------------------------------------------------------
;>
END
38
-
8/2/2019 Krupal Final
39/41
CHAPTER 7
CONCLUSION
Since it has more advantages in many aspects compared with the disadvantages
it can be used widely
Examining of heart beat is very easy as if doesnt require much knowledge re-
garding circuitary.
Advantages:
If the clip is not adjusted properly then the accuracy comes down..
LCD displays are costly
Dis-advantages:
If the clip is not adjusted properly then the accuracy comes down..
LCD displays are costly
Applications:
39
-
8/2/2019 Krupal Final
40/41
While this sounds so simple, it is an important aspect for any patient who
is suffering from heart disease, or someone recovering from an illness.
Now a days these digital heart rate meters have become very popular and
used in hospitals also
CHAPTER 8
FUTURE SCOPE
A graphical LCD can be used to display a graph of the change of heart rate over
time
Fig.8
By modifying this circuit and using two relays we can achieve a task of opening
and closing the door.
This circuit can be modified to sense the water level in a cistern and control the
water supply accordingly.
Sound can be added to the device so that a sound is output each time a pulse is
received
40
-
8/2/2019 Krupal Final
41/41
REFERENCES
1. www.wikipedia.com
2. www.efymag.com
3. www.datasheetscatalog.com
4.www.heartratemoniter.co.uk
http://www.wikipedia.com/http://www.efymag.com/http://www.datasheetscatalog.com/http://www.wikipedia.com/http://www.efymag.com/http://www.datasheetscatalog.com/
top related