Академический Документы
Профессиональный Документы
Культура Документы
CHAPTER-1
INTRODUCTION
1.1 INTRODUCTION:
Health monitoring systems become a hot topic and important research field today.
Research on the monitoring were developed for many applications such as military, homecare
unit, hospital, In this paper, we developed the wearable and real-time monitoring system using
zigbee technology for heart beat and body temperature This application consists of ZIGBEE
based network, sensors Body Temperature, Heart Beat, It is mainly used to monitor Body
Temperature, Heart Beat of patients. all sensors are connected to microcontroller. Data is
digitized with microcontroller and send to a computer by using Zigbee transreceiver where Mat
Lab based window represent it graphically shows the patients current status at receiver. Patient
monitoring refers to the continuous observation of repeating events of physiologic function to
guide therapy or to monitor the effectiveness of interventions and is used primarily in the
intensive care unit and operating room. At least in India there is no system which continuously
monitors the patient when patient is on move. And this motivated us to work in this area.
scheme is fast and reliable. We also demonstrate that our devices can seamlessly integrate with
the next generation technology of wireless wide area network, worldwide interoperability for
microwave access, to achieve real-time patient monitoring.
Embedded systems are electronic devices that incorporate microprocessor with in their
implementation. The main purpose of the microprocessor is to simplify the system design and
provide flexibility. This system may not have a disk driver and so the software is often stored in a
ROM chip. Embedded systems often have several things to do at once. They must respond to
external events (eg: someone pushes an elevator button). An Embedded system is any computer
system hidden inside a product other than a computer. Embedded systems are found in wide
range of applications like expensive industrial control applications. As the technology brought
down the cost of dedicated processors. They began to appear in moderately expansive
applications such as automobiles, communications and office equipment, televisions. Today’s
embedded system is so inexpensive that they are used in almost every electronic product in our
life. Many embedded systems have to run 24 hours a day you can’t just “reboot” when something
goes wrong. For this reason a good coding practices and thorough testing take on a new level of
realm of embedded processors. Performance goals will force us to learn and apply new
techniques such as multitasking and scheduling. The need to communicate directly with sensors
actuators, keypads, displays etc will require programmers to have a better understanding of how
alternative methods for performing input and output provide opportunities to trade speed,
complexity and cost.
written in ‘C’ are very portable from one compiler and/or target processor to another. C
compilers are available for a number of different target processors, and they generate very
efficient code. Despite the popularity of C++ and Java for desktop application programming,
they are rarely used in embedded systems because of the large run-time overhead required to
support some of their features. For example, even a relatively simple C++ program will produce
about twice as much code as the same program written in C, and the situation is much worse for
large program that makes extensive use of the run-time library.
CHAPTER-2
TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 5
RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING
BLOCK DIAGRAM
2.1 BLOCK DIAGRAM
2.2 DESCRIPTION:
In this project we are monitoring the heartbeat and temperature of the patient minute to
minute. In this we are using 2 micro controllers and temperature sensors, heart beat sensors. In
this we are using two ZIGBEE modules. This are placed at transmit side and receiver side. We
are using LCD ,buzzer, crystalloscillator , RPS.
For monitoring the temperature of the patient, Heartbeat is sensed by using a high
intensity type LED and photo-diode. The change in volume caused by the pressure pulse is
detected by illuminating the fingertip’s skin with the light from an LED using a photodiode
sensor. With each heart beat, a surge of blood is forced through the vascular system, expanding
the capillaries in the finger, and changing the amount of light returning to the photo detector.
Very small changes in reflectivity or in transmittance caused by the varying blood content of
human tissue are almost invisible. Valid pulse measurement therefore requires extensive
preprocessing of the raw signal. A super bright LED is suggested in the circuit as it can also
perform well as light sensor. Photodiode, whose resistance changes in response to amount of
light shining on it. For finding the temperature of the patient we are placing the sensor clip to the
finger of the patient by these we can sense the temperature of the patient.
If the temperature or heartbeat is high or low the ZIGBEE modules will send an
information by the sensors it will give an alarm to doctor and it will give an information about
the address of the patient by the APR9600, he can check on the LCD, he will alert and monitor
the patient.
CHAPTER-3
HARDWARE DISCRIPTION
3.1 HARDWARE DISCRIPTION:
HARDWARE:
In above system hardware used is ZIGBEE, MICROCONTROLLER, HEART -BEAT
SENSOR, TEMPERATURE SENSOR AND LCD, RPS, APR 9600, BUZZER, CRYSTAL,
SPEAKER.
A. ZIGBEE
ZIGBEE (IEEE 802.15.4) is a low-cost, low-power, wireless mesh networking
proprietary standard. The low cost allows the technology to be widely deployed in wireless
control and monitoring applications, the low power-usage allows longer life with smaller
batteries, and the mesh networking provides high reliability and larger range. Range of ZIGBEE
is from 30 meters-1km ZIGBEE devices are actively limited to a through rate of 250Kbps.
ZIGBEE is present with the blind people and in the bus which is the used instead of
RFID. The ZIGBEE with the blind recognizes the bus which is few meter distance away from
blind and gives intimation to the blind who is carrying it. The intimation is given through the
headphones. The ZIGBEE in bus receives the signal from blind people and stops in bus station.
If the blind gets the required bus, he gets into bus or else he waits for the bus which he desires to
get into to reach his destination. The advantage over of ZIGBEE over RFID is that it is less cost
than RFID tag and RFID reader. Secondly, it has two-way communication that is to send and
receive signal at higher speed without interfering other signals like radio waves.
IEEE 802.15.4
IEEE 802.15.4 is a standard which specifies the physical layer and media access control
for low-rate wireless personal area networks. It is maintained by the IEEE 802.15 working
group. Its license free frequency bands are:
I. 2.4 GHz (16 channels with baud rate of 250 kbps)
II. 902 MHz – 928 MHz (10 channels with baud rate of 40 kbps)
III. 868 MHz- 870 MHz (1 channel with baud rate of 10 kbps)
B. ATMEL
ATmega16 microcontroller
The Atmel combines a rich instruction set with 32 general purpose working registers. All
the 32 registers are directly connected to the Arithmetic Logic Unit (ALU), also consists 8-bit
Microcontroller, Advanced RISC Architecture,131 Powerful Instructions – Most Single-clock
Cycle Execution, Up to 16 MIPS Throughput at 16 MHz,16 Kbytes of In-System Self-
programmable Flash program memory,512 Bytes EEPROM,8-channel, 10- bit ADC ,
Programmable Serial USART, Operating Voltages 4.5V - 5.5V for ATmega16.
density nonvolatile memory technology and is compatible with the industry-standard 80C51
micro controller. 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 one monolithic chip; the Atmel AT89S52 is a powerful micro
controller, which provides 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, 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, serial port,
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.
TCON REGISTER :
TMOD REGISTER:
Heartbeat is sensed by using a high intensity type LED and photo-diode it is shown in
figure 4. The change in volume caused by the pressure pulse is detected by illuminating the
fingertip’s skin with the light from an LED using a photodiode sensor. With each heart beat, a
surge of blood is forced through the vascular system, expanding the capillaries in the finger, and
changing the amount of light returning to the photo detector. Very small changes in reflectivity or
in transmittance caused by the varying blood content of human tissue are almost invisible. Valid
pulse measurement therefore requires extensive preprocessing of the raw signal. A super bright
LED is suggested in the circuit as it can also perform well as light sensor. Photodiode, whose
resistance changes in response to amount of light shining on it.
D. Temperature Sensor
LM35 is a precision IC Temperature sensors, whose output voltage is linearly proportional to the
Celsius (Centigrade) temperature. The output voltage varies by 10mV in response to every oC
rise/fall in ambient temperature, i.e., its scale factor is 0.01V/ oC.
E. LCD
INTRODUCTION:
The LCD is used to visualize the output of the application. It is used to check the output of
different modules interfaced with the microcontroller. Thus LCD plays a vital role to see the
output and to debug the system module wise in case of system failure in order to rectify the
problem.
A liquid crystal display (LCD) is a thin, flat display device made up of any number of color
or monochrome pixels arrayed in front of a light source or reflector. Each pixel consists of a
column of liquid crystal molecules suspended between two transparent electrodes, and two
polarizing filters, the axes of polarity of which are perpendicular to each other. Without the
liquid crystals between them, light passing through one would be blocked by the other. The
liquid crystal twists the polarization of light entering one filter to allow it to pass through the
other.
A program must interact with the outside world using input and output devices that
communicate directly with a human being. One of the most common devices attached to an
controller is an LCD display. Some of the most common LCDs connected to the contollers are
16X1, 16x2 and 20x2 displays. This means 16 characters per line by 1 line 16 characters per line
by 2 lines and 20 characters per line by 2 lines, respectively.
Many microcontroller devices use 'smart LCD' displays to output visual information.
LCD displays designed around LCD NT-C1611 module, are inexpensive, easy to use, and it is
even possible to produce a readout using the 5X7 dots plus cursor of the display. They have a
standard ASCII set of characters and mathematical symbols. For an 8-bit data bus, the display
requires a +5V supply plus 10 I/O lines (RS RW D7 D6 D5 D4 D3 D2 D1 D0). For a 4-bit data
bus it only requires the supply lines plus 6 extra lines(RS RW D7 D6 D5 D4). When the LCD
display is not enabled, data lines are tri-state and they do not interfere with the operation of the
microcontroller.
FEATURES:
(1) Interface with either 4-bit or 8-bit microprocessor.
(2) Display data RAM
(3) 80x8 bits (80 characters).
(4) Character generator ROM
(5) 160 different 5 7 dot-matrix character patterns.
(6) Character generator RAM
(7) 8 different user programmed 5 7 dot-matrix patterns.
(8) Display data RAM and character generator RAM may be Accessed by the
microprocessor.
(9) Numerous instructions
(10) Clear Display, Cursor Home, Display ON/OFF, Cursor ON/OFF, Blink Character,
Cursor Shift, Display Shift.
(11) Built-in reset circuit is triggered at power ON.
(12) Built-in oscillator.
Data can be placed at any location on the LCD. For 16×1 LCD, the address locations
are:
PIN DESCRIPTION:
Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins (two pins
are extra in both for back-light LED connections).
CONTROL LINES:
EN:
Line is called "Enable." This control line is used to tell the LCD that you are sending it data.
To send data to the LCD, your program should make sure this line is low (0) and then set the
other two control lines and/or put data on the data bus. When the other lines are completely
ready, bring EN high (1) and wait for the minimum amount of time required by the LCD
datasheet (this varies from LCD to LCD), and end by bringing it low (0) again.
RS:
Line is the "Register Select" line. When RS is low (0), the data is to be treated as a
command or special instruction (such as clear screen, position cursor, etc.). When RS is high (1),
the data being sent is text data which sould be displayed on the screen. For example, to display
the letter "T" on the screen you would set RS high.
RW:
Line is the "Read/Write" control line. When RW is low (0), the information on the data bus
is being written to the LCD. When RW is high (1), the program is effectively querying (or
reading) the LCD. Only one instruction ("Get LCD status") is a read command. All others are
write commands, so RW will almost always be low. Finally, the data bus consists of 4 or 8 lines
(depending on the mode of operation selected by the user). In the case of an 8-bit data bus, the
lines are referred to as DB0, DB1, DB2, DB3, DB4, DB5, DB6, and DB7.
ENTERING TEXT:
First, a little tip: it is manually a lot easier to enter characters and commands in hexadecimal
rather than binary (although, of course, you will need to translate commands from binary couple
of sub-miniature hexadecimal rotary switches is a simple matter, although a little bit into hex so
that you know which bits you are setting). Replacing the d.i.l. switch pack with a of re-wiring is
necessary.
The switches must be the type where On = 0, so that when they are turned to the zero
position, all four outputs are shorted to the common pin, and in position “F”, all four outputs are
open circuit. All the available characters that are built into the module are shown in Table 3.
Studying the table, you will see that codes associated with the characters are quoted in binary and
hexadecimal, most significant bits (“left-hand” four bits) across the top, and least significant bits
(“right-hand” four bits) down the left.
Most of the characters conform to the ASCII standard, although the Japanese and Greek
characters (and a few other things) are obvious exceptions. Since these intelligent modules were
designed in the “Land of the Rising Sun,” it seems only fair that their Katakana phonetic symbols
should also be incorporated. The more extensive Kanji character set, which the Japanese share
with the Chinese, consisting of several thousand different characters, is not included!
Using the switches, of whatever type, and referring to Table 3, enter a few characters onto
the display, both letters and numbers. The RS switch (S10) must be “up” (logic 1) when sending
the characters, and switch E (S9) must be pressed for each of them. Thus the operational order is:
set RS high, enter character, trigger E, leave RS high, enter another character, trigger E, and so on.
The first 16 codes in Table 3, 00000000 to 00001111, ($00 to $0F) refer to the CGRAM. This
is the Character Generator RAM (random access memory), which can be used to hold user-
defined graphics characters. This is where these modules really start to show their potential,
offering such capabilities as bar graphs, flashing symbols, even animated characters. Before the
user-defined characters are set up, these codes will just bring up strange looking symbols.
Codes 00010000 to 00011111 ($10 to $1F) are not used and just display blank characters.
ASCII codes “proper” start at 00100000 ($20) and end with 01111111 ($7F). Codes 10000000 to
10011111 ($80 to $9F) are not used, and 10100000 to 11011111 ($A0 to $DF) are the Japanese
characters.
F.BUZZER:
G. Power Supply
Power supply is a reference to a source of electrical power. A device or system that
supplies electrical or other types of energy to an output load or group of loads is called a power
supply unit or PSU. The term is most commonly applied to electrical energy supplies, less often
to mechanical ones, and rarely to others
This power supply section is required to convert AC signal to DC signal and also to
reduce the amplitude of the signal. The available voltage signal from the mains is 230V/50Hz
which is an AC voltage, but the required is DC voltage(no frequency) with the amplitude of +5V
and +12V for various applications.
In this section we have Transformer, Bridge rectifier, are connected serially and voltage
regulators for +5V and +12V (7805 and 7812) via a capacitor (1000µF) in parallel are connected
parallel as shown in the circuit diagram below. Each voltage regulator output is again is
connected to the capacitors of values (100µF, 10µF, 1 µF, 0.1 µF) are connected parallel through
which the corresponding output(+5V or +12V) are taken into consideration.
CIRCUIT EXPLANATION:
1) Transformer
TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 24
RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING
A transformer is a device that transfers electrical energy from one circuit to another
through inductively coupled electrical conductors. A changing current in the first circuit (the
primary) creates a changing magnetic field; in turn, this magnetic field induces a changing
voltage in the second circuit (the secondary). By adding a load to the secondary circuit, one can
make current flow in the transformer, thus transferring energy from one circuit to the other.
The secondary induced voltage VS, of an ideal transformer, is scaled from the primary VP by
a factor equal to the ratio of the number of turns of wire in their respective windings:
Basic principle:
The transformer is based on two principles: firstly, that an electric current can produce a
magnetic field (electromagnetism) and secondly that a changing magnetic field within a coil of
wire induces a voltage across the ends of the coil (electromagnetic induction). By changing the
current in the primary coil, it changes the strength of its magnetic field; since the changing
magnetic field extends into the secondary coil, a voltage is induced across the secondary.
A simplified transformer design is shown below. A current passing through the primary
coil creates a magnetic field. The primary and secondary coils are wrapped around a core of very
high magnetic permeability, such as iron; this ensures that most of the magnetic field lines
produced by the primary current are within the iron and pass through the secondary coil as well
as the primary coil.
Induction Law:
The voltage induced across the secondary coil may be calculated from Faraday's law of
induction, which states that:
Where VS is the instantaneous voltage, NS is the number of turns in the secondary coil and
Φ equals the magnetic flux through one turn of the coil. If the turns of the coil are oriented
perpendicular to the magnetic field lines, the flux is the product of the magnetic field strength B
and the area A through which it cuts. The area is constant, being equal to the cross-sectional area
of the transformer core, whereas the magnetic field varies with time according to the excitation
of the primary. Since the same magnetic flux passes through both the primary and secondary
coils in an ideal transformer, the instantaneous voltage across the primary winding equals
Taking the ratio of the two equations for VS and VP gives the basic equation for stepping up
or stepping down the voltage
If the secondary coil is attached to a load that allows current to flow, electrical power is
transmitted from the primary circuit to the secondary circuit. Ideally, the transformer is perfectly
efficient; all the incoming energy is transformed from the primary circuit to the magnetic field
and into the secondary circuit. If this condition is met, the incoming electric power must equal
the outgoing power.
If the voltage is increased (stepped up) (VS > VP), then the current is decreased (stepped
down) (IS < IP) by the same factor. Transformers are efficient so this formula is a reasonable
approximation.
If the voltage is increased (stepped up) (VS > VP), then the current is decreased (stepped
down) (IS < IP) by the same factor. Transformers are efficient so this formula is a reasonable
approximation.
The impedance in one circuit is transformed by the square of the turns ratio. For example, if
an impedance ZS is attached across the terminals of the secondary coil, it appears to the primary
circuit to have an impedance of
This relationship is reciprocal, so that the impedance ZP of the primary circuit appears to the
secondary to be
Detailed operation:
The simplified description above neglects several practical factors, in particular the
primary current required to establish a magnetic field in the core, and the contribution to the field
due to current in the secondary circuit. Models of an ideal transformer typically assume a core of
negligible reluctance with two windings of zero resistance. When a voltage is applied to the
primary winding, a small current flows, driving flux around the magnetic circuit of the core. The
current required to create the flux is termed the magnetizing current; since the ideal core has
been assumed to have near-zero reluctance, the magnetizing current is negligible, although still
required to create the magnetic field.
TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 28
RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING
The changing magnetic field induces an electromotive force (EMF) across each winding.
Since the ideal windings have no impedance, they have no associated voltage drop, and so the
voltages VP and VS measured at the terminals of the transformer, are equal to the corresponding
EMFs. The primary EMF, acting as it does in opposition to the primary voltage, is sometimes
termed the "back EMF". This is due to Lenz's law which states that the induction of EMF would
always be such that it will oppose development of any such change in magnetic field.
2) BRIDGE RECTIFIER:
Basic Operation:
When the input connected at the left corner of the diamond is positive with respect to the
one connected at the right hand corner, current flows to the right along the upper colored path to
the output, and returns to the input supply via the lower one. When the right hand corner is
positive relative to the left hand corner, current flows along the upper colored path and returns to
the supply via the lower colored path.
In each case, the upper right output remains positive with respect to the lower right one.
Since this is true whether the input is AC or DC, this circuit not only produces DC power when
supplied with AC power: it also can provide what is sometimes called "reverse polarity
protection". That is, it permits normal functioning when batteries are installed backwards or DC
input-power supply wiring "has its wires crossed" (and protects the circuitry it powers against
damage that might occur without this circuit in place).
Prior to availability of integrated electronics, such a bridge rectifier was always constructed
from discrete components. Since about 1950, a single four-terminal component containing the
four diodes connected in the bridge configuration became a standard commercial component and
is now available with various voltage and current ratings.
For many applications, especially with single phase AC where the full-wave bridge serves
to convert an AC input into a DC output, the addition of a capacitor may be important because
the bridge alone supplies an output voltage of fixed polarity but pulsating magnitude (see
diagram above).
The function of this capacitor, known as a reservoir capacitor (aka smoothing capacitor) is
to lessen the variation in (or 'smooth') the rectified AC output voltage waveform from the bridge.
One explanation of 'smoothing' is that the capacitor provides a low impedance path to the AC
component of the output, reducing the AC voltage across, and AC current through, the resistive
load. In less technical terms, any drop in the output voltage and current of the bridge tends to be
cancelled by loss of charge in the capacitor. This charge flows out as additional current through
the load. Thus the change of load current and voltage is reduced relative to what would occur
without the capacitor. Increases of voltage correspondingly store excess charge in the capacitor,
thus moderating the change in output voltage / current. Also see rectifier output smoothing.
The simplified circuit shown has a well deserved reputation for being dangerous, because,
in some applications, the capacitor can retain a lethal charge after the AC power source is
removed. If supplying a dangerous voltage, a practical circuit should include a reliable way to
safely discharge the capacitor. If the normal load can not be guaranteed to perform this function,
perhaps because it can be disconnected, the circuit should include a bleeder resistor connected as
close as practical across the capacitor. This resistor should consume a current large enough to
discharge the capacitor in a reasonable time, but small enough to avoid unnecessary power
waste. Because a bleeder sets a minimum current drain, the regulation of the circuit, defined as
percentage voltage change from minimum to maximum load, is improved.
However in many cases the improvement is of insignificant magnitude. The capacitor and
the load resistance have a typical time constant τ = RC where C and R are the capacitance and
load resistance respectively. As long as the load resistor is large enough so that this time constant
is much longer than the time of one ripple cycle, the above configuration will produce a
smoothed DC voltage across the load. In some designs, a series resistor at the load side of the
capacitor is added. The smoothing can then be improved by adding additional stages of
capacitor–resistor pairs, often done only for sub-supplies to critical high-gain circuits that tend to
be sensitive to supply voltage noise.
The idealized waveforms shown above are seen for both voltage and current when the load
on the bridge is resistive. When the load includes a smoothing capacitor, both the voltage and the
current waveforms will be greatly changed. While the voltage is smoothed, as described above,
current will flow through the bridge only during the time when the input voltage is greater than
the capacitor voltage. For example, if the load draws an average current of n Amps, and the
diodes conduct for 10% of the time, the average diode current during conduction must be 10n
Amps. This non-sinusoidal current leads to harmonic distortion and a poor power factor in the
AC supply.
In a practical circuit, when a capacitor is directly connected to the output of a bridge, the
bridge diodes must be sized to withstand the current surge that occurs when the power is turned
on at the peak of the AC voltage and the capacitor is fully discharged. Sometimes a small series
resistor is included before the capacitor to limit this current, though in most applications the
power supply transformer's resistance is already sufficient.
Output can also be smoothed using a choke and second capacitor. The choke tends to keep
the current (rather than the voltage) more constant. Due to the relatively high cost of an effective
choke compared to a resistor and capacitor this is not employed in modern equipment. Some
early console radios created the speaker's constant field with the current from the high voltage
("B +") power supply, which was then routed to the consuming circuits, (permanent magnets
were considered too weak for good performance) to create the speaker's constant magnetic field.
The speaker field coil thus performed 2 jobs in one: it acted as a choke, filtering the power
supply, and it produced the magnetic field to operate the speaker.
3) VOLTAGE REGULATOR :
PIN CONFIGURATION:
Port 1
Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. 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 pull-ups and can be used as inputs. In addition, P1.0 and P1.1 can be configured to be the
timer/counter 2 external count input
(P1.0/T2) and the timer/counter 2 trigger input P1.1/T2EX), respectively, as shown in the
following table. Port 1 also receives the low-order address bytes during Flash programming and
verification.
pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of
various special features of the AT89S52, as shown in the following table.
Port 3 also receives some control signals for Flash programming
And verification.
RST
Reset input. A high on this pin for two machine cycles while the oscillator is running resets
the device.
ALE/PROG
Address Latch Enable (ALE) is an output pulse for latching the low byte of the address
during accesses to external memory. This pin is also the program pulse input (PROG) during
Flash programming. In normal operation, ALE is emitted at a constant rate of1/6 the oscillator
frequency and may be used for external timing or clocking purposes. Note, however, that one
ALE pulse is skipped during each access to external data Memory. If desired, ALE operation can
be disabled by setting bit 0 of SFR location
8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the
pin is weakly pulled high. Setting the ALE-disable bit has no effect if the micro controller is in
external execution mode.
PSEN
Program Store Enable (PSEN) is the read strobe to external program memory. When the
AT89S52 is executing code from external program memory, PSEN is activated twice each
machine cycle, except that two PSEN activations are skipped during each access to external data
memory.
EA/VPP
External Access Enable. EA must be strapped to GND in order to enable the device to fetch
code from external program memory locations starting at 0000H up to FFFFH.Note, however,
that if lock bit 1 is programmed, EA will be internally latched on reset. A should be strapped to
VCC for internal program executions. This pin also receives the 12-voltProgramming enables
voltage (VPP) during Flash programming.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier.
Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that
can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or
ceramic resonator may be used. To drive the device from an External clock source, XTAL2
should be left unconnected while XTAL1 is driven, as shown in Figure 2.
Indexed Addressing
a. External Direct MOVX A, @DPTR
b. Code In direct MOVC A, @A+DPTR
Immediate Addressing:
Immediate addressing is so named because the value to be stored in memory immediately
follows the operation code in memory. That is to say, the instruction itself dictates what value
will be stored in memory. For example, the instruction:
MOV A, #20H:
This instruction uses immediate Addressing because the accumulator will be loaded
with the value that immediately follows in this case 20(hexadecimal). Immediate addressing
is very fast since the value to be loaded is included in the instruction. However, since the
value to be loaded is fixed at compile-time it is not very flexible.
Direct Addressing:
Direct addressing is so named because the value to be stored in memory is obtained by
directly retrieving it from another memory location.
For example:
MOV A, 30h
This instruction will read the data out of internal RAM address 30(hexadecimal) and store it
in the Accumulator. Direct addressing is generally fast since, although the value to be loaded
isn’t included in the instruction, it is quickly accessible since it is stored in the 8051’s internal
RAM. It is also much more flexible than Immediate Addressing since the value to be loaded is
whatever is found at the given address which may variable.
Also it is important to note that when using direct addressing any instruction that refers
to an address between 00h and 7Fh is referring to the SFR control registers that control the 8051
micro controller itself.
Indirect Addressing:
Indirect addressing is a very powerful addressing mode, which in many cases provides
an exceptional level of flexibility. Indirect addressing is also the only way to access the extra 128
bytes of internal RAM found on the 8052. Indirect addressing appears as follows:
MOV A, @R0:
This instruction causes the 8051 to analyze Special Function Register (SFR) Memory:
Special Function Registers (SFRs) are areas of memory that control specific functionality of
the 8051 processor. For example, four SFRs permit access to the 8051’s 32 input/output lines.
Another SFR allows the user to set the serial baud rate, control and access timers, and configure
the 8051’s interrupt system.
Timer 2 Registers:
Control and status bits are contained in registers T2CON and T2MOD for
Timer 2 . The register pair (RCAP2H , RCAP2L) are the Capture / Reload registers
for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode .
Interrupt Registers:
The individual interrupt enable bits are in the IE registe . Two priorities can be
set for each of the six interrupt sources in the IP register.
Timer 2
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 . 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 . Timer 2 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 oscillator
periods, the count rate is 1/12 of the oscillator frequency.In the Counter function ,
the register is incremented in response to a 1-to-0 transition at its corresponding
external input pin , T2 .When the samples show a high in one cycle and a low in
the next cycle, the count is incremented . Since two machine cycles (24 Oscillator
periods ) are required to recognize 1-to-0 transition , the maximum count rate is 1 /
24 of the oscillator frequency . To ensure that a given level is sampled at least
once before it changes , the level should be held for atleast one full machine cycle
.
Capture Mode
In the capture mode , two options are selected by bit EXEN2 in T2CON . If
EXEN2 = 0, Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2
in T2CON . This bit can then be used to generate an interrupt . If EXEN2 = 1 , Timer
2 performs the same operation , but a 1-to-0 transition at external input T2EX also
causes the current value in TH2 and TL2 to be captured into RCAP2H and
RCAP2L , respectively
Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK
in T2CON . Note that the baud rates for transmit and receive can be different if
Timer 2 is used for the receiver or transmitter and Timer 1 is used for the other
function .The baud rates in Modes 1 and 3 aredetermined by Timer 2’s overflow rate
according to the following equation .
The timer operation is different for Timer 2 when it is used as a baud rate
generator .Normally ,as a timer , it increments every machine cycle (at 1/12 the oscillator
frequency).As a baud rate generator , however, it increments every state time ( at 1/2 the
oscillator frequency ) .
Timer 0:
Timer 0 functions as either a timer or event counter in four modes of operation .
Timer 0 is controlled by the four lower bits of the TMOD register and bits 0, 1, 4 and 5
of the TCON register.
Mode 0 ( 13-bit Timer):
Mode 0 configures timer 0 as a 13-bit timer which is set up as an 8-bit
timer (TH0 register) with a modulo 32 prescaler implemented with the lower five bits
TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 43
RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING
of the TL0 register . The upper three bits of TL0 register are indeterminate and should
be ignored . Presale overflow increments the TH0 register.
Mode 1 ( 16-bit Timer )
Mode 1 is the same as Mode 0, except that the Timer register is being run
with all 16 bits . Mode 1 configures timer 0 as a 16-bit timer with the TH0 and
TL0 registers connected in cascade . The selected input increments the TL0 register .
Mode 2 (8-bit Timer with Auto-Reload)
Mode 2 configures timer 0 as an 8-bit timer ( TL0 register ) that automatically
reloads from the TH0 register . TL0 overflow sets TF0 flag in the TCON register
and reloads TL0 with the contents of TH0 , which is preset by software .
Mode 3 ( Two 8-bit Timers )
Mode 3 configures timer 0 so that registers TL0 and TH0 operate as separate 8-
bit timers. This mode is provided for applications requiring an additional 8-bit timer or
counter .
Timer 1
Timer 1 is identical to timer 0 , except for mode 3 , which is a hold-count
mode .
Mode 3 ( Halt )
Placing Timer 1 in mode 3 causes it to halt and hold its count . This can be
used to halt Timer 1 when TR1 run control bit is not available i.e. , when Timer 0 is
in mode 3 .
Baud Rates :
The baud rate in Mode 0 is fixed. The baud rate in Mode 2 depends on the
value of bit SMOD in Special Functio Register PCON. If SMOD = 0 (which is
its value on reset), the baud rate is 1/64 the oscillator frequency . If SMOD = 1,
the baud rate is 1/32 the oscillator frequency. In the 89S52 , the baud rates in
Modes 1 and 3 are determined by the Timer 1 overflow rate. In case of Timer 2 ,
these baud rates can be determined by Timer 1 , or by Timer 2 , or by both (one
for transmit and the other for receive.
CHAPTER-4
EMBEDDED C
The example projects for this book are NOT loaded automatically when you install the Keil
compiler. These files are stored on the CD in a directory “/Pont”. The files are arranged by
chapter: for example, the project discussed in Chapter 3 is in the directory “/Pont/Ch03_00-
Hello”. Rather than using the projects on the CD (where changes cannot be saved), please copy
the files from CD onto an appropriate directory on your hard disk.
Note: you will need to change the file properties after copying: file transferred from the CD will
be ‘read only’.
To ensure that the port activity is visible, we need to start the ‘periodic window update’ flag
While the simulation is running, view the performance analyzer to check the delay durations.
CHAPTER-5
RESULTS
RESULT
5.1 TEMPERATURE SENSOR:
Fig:5.2 Graph Displaying Heart Beat (bpm) for Normal Patient’s (t= 15 min.,t=5 to t=20 min.)
CHAPTER-6
ADVANTAGES
CHAPTER-7
DISADVANTAGES
CHAPTRER-8
APPLICATIONS
HOSPITAL APPLICATION
MILITARY APPLICATION
CHAPTER-9
FUTURE SCOPE
In this project we are monitoring the patient heartbeat and temperature without the
stethoscope. In this we are using the zigbee module for implementing these project, if the
government help financially We can implement this as a real time project. That is easy to monitor
the patients.
CHAPTER-10
CONCLUSION
Thus the ZIGBEE based wireless Heartbeat and Temperature monitoring system is
designed and implemented using microcontroller ATMEGA 16, in which all signals directly
measured from the human body and all parameters values displayed on LCD on the transmitter
side. This data is transmitted to the receiver wirelessly through ZIGBEE. The received signal
send to pc via RS-232 cable in which MATLAB window display graph of patient’s Physiological
Parameters.
BIBLIOGRAPHY:
The 8051 Micro controller and Embedded Systems
Kenneth J.Ayala
B.Ram
Ramesh S.Gaonkar
Electronic Components
D.V.Prasad