Вы находитесь на странице: 1из 61

RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

1.1.1 EXISTING SYSTEM:


The existing systems usually use broadcast or multicast schemes to increase the
reliability of signals transmission; however, both the schemes lead to significantly higher
network traffic and end-to-end transmission delay. In this paper, we present a reliable
transmission protocol based on any cast routing for wireless patient monitoring. Our scheme
automatically selects the closest data receiver in an any cast group as a destination to reduce the
transmission latency as well as the control overhead. The new protocol also shortens the latency
of path recovery by initiating route recovery from the intermediate routers of the original path.
On the basis of a reliable transmission scheme, we implement a zigbee device for fall
monitoring, which integrates fall detection, indoor positioning, and ECG monitoring. When the
tri axial accelerometer of the device detects a fall, the current position of the patient is
transmitted to an emergency center through a zigbee network. In order to clarify the situation of
the fallen patient, 4-s ECG signals are also transmitted. Our transmission scheme ensures the
successful transmission of these critical messages. The experimental results show that our

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 1


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

1.1.2 PROPOSED SYSTEM:


The proposed systems usually use broadcast or multicast schemes to increase the
reliability of signals transmission; however, both the schemes lead to significantly higher
network traffic and end-to-end transmission delay. 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, crystaloscillator , 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.

1.2 INTRODUCTION TO EMBEDDED SYSTEM


An embedded system is a combination of computer circuitry and software that is built into
a product for purposes such as control, monitoring and communication without human
intervention.
TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 2
RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS 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.

1.2.1 How powerful are embedded processors


The embedded system found in most consumer products employs a single chip
controller. That includes the microprocessor, a limited amount of memory and simple input
output devices. By far the vast majority of the embedded systems in production today are based
on the 4bit, 8bit, or 16bit processors.
Although 32bit processors account for relatively small percentage of the current market,
their use in embedded systems is growing at the fastest rate. In 1998, almost 250 million 32bit
embedded processor were shipped, compared to 100million desk top computers.

1.2.2 What programming languages are used?


Although it is occasionally necessary to code some small parts of an embedded
application program in assembly language, rest of the code in even the simplest application is
written in a high level language. Traditionally the choice of the language has been ‘C’. Programs

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 3


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

1.2.3 How to build an embedded application unique?


You should already be familiar with the tools and software components used to build a
desktop application program and load it into memory for execution.
Desktop application programs:

Fig: 1.1 desktop application program

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 4


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

Fig: 1.2 embedded application program

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

Fig:2.1 Block Diagram

2.2 DESCRIPTION:

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 6


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 7


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 8


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

Figure 3.1 Pin Diagram of ATMEGA16

DESCRIPTION OF MICROCONTROLLER 89S52:


The AT89S52 is a low-power, high-performance CMOS 8-bit micro controller with 8Kbytes
of in-system programmable Flash memory. The device is manufactured Using Atmel’s high-

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 9


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 10


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

TCON REGISTER :

Timer/counter Control Register

Fig:3.2 TCON REGISTER

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 11


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

TMOD REGISTER:

Timer/Counter 0 and 1 Mode

FIG:3.3 TMOD REGISTER

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 12


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

C. Heart rate measurement


Heart rate measurement is one of the very important parameters of the human
cardiovascular system. The heart rate of a healthy adult at rest is around 72 beats per minute
(BPM). Athletes normally have lower heart rates than less active people. Babies have a much
higher heart rate at around 120 BPM.

Fig:3.4 Average Heartbeat Rate

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.

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 13


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

FIG:3.5 Heart rate measurement

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.

Fig: 3.6 Temperature Sensor LM3

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 14


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 15


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

available. Line lengths of


8, 16,
20, 24,
32 and
40
charact
ers are
TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 16 all
standar
d, in
one,
two
RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

FEATURES:
(1) Interface with either 4-bit or 8-bit microprocessor.
(2) Display data RAM
(3) 80x8 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:

Fig:3.7 Address locations for a 1x16 line LCD

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 17


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

Shapes and sizes:

Fig:3.8 Different Shapes & Sizes Of LCD


LCD (Liquid Crystal Display) screen is an electronic display module and find a wide
range of applications. A 16x2 LCD display is very basic module and is very commonly used in
various devices and circuits. These modules are preferred over seven segments and other multi
segment LEDs. The reasons being: LCDs are economical easily programmable; have no
limitation of displaying special & even custom characters (unlike in seven segments), animations
and so on. A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In
this LCD each character is displayed in 5x7 pixel matrix

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 18


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

Fig:3.9 LCD display


Even limited to character based modules there is still a wide variety of shapes and sizes
available. Line lengths of 8, 16,20,24,32 and 40 characters are all standard, in one, two and four
line versions.
Several different LC technologies exist. “Supertwist” types, for example, offer Improved
contrast and viewing angle over the older “twisted pneumatic” types. Some modules are
available with back lighting, so that they can be viewed in dimly-lit conditions. The back
lighting may be either “electro-luminescent”, requiring a high voltage inverter circuit, or simple
LED illumination.

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).

Fig:3.10 pin diagram of 1x16 lines LCD

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 19


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

FIG:3.11 DESCRIPTION OF PINS

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.

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 20


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

Logic status on control lines:

• E - 0 Access to LCD disabled

- 1 Access to LCD enabled

• R/W - 0 Writing data to LCD


- 1 Reading data from LCD
• RS - 0 Instructions
-1 Character

Writing data to the LCD:


1) Set R/W bit to low
2) Set RS bit to logic 0 or 1 (instruction or character)
3) Set data to data lines (if it is writing)
4) Set E line to high
5) Set E line to low

Read data from data lines (if it is reading)on LCD:

1) Set R/W bit to high


2) Set RS bit to logic 0 or 1 (instruction or character)
3) Set data to data lines (if it is writing)
4) Set E line to high
5) Set E line to low

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 21


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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:

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 22


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

A buzzer or an beeper is an audio signaling device. which may be mechanical,


electromechanical or piezoelectric. Typical uses of buzzers include alarm devices, timers and
confirmation of user input such as a mouse click or key stroke.
ELECTROMECHANICAL:
The first electric buzzer was invented in 1831 by Joseph Henry. They were mainly used in
early doorbells until they were phased out in the early 1930’s in favour of musical chimes, which
had a softer tone.
PIEZOELECTRIC:
Piezoelectric buzzers or piezo buzzers, as they are some times called, were invented by
Japanese manufactures and fitted into a wide array of products during the 1970s to 1980s. this
advancement mainly came about because of cooperative efforts by Japanese manufacturing
companies. In 1951,they established the barium titanate application research committee, which
allowed the companies to be “comparatively cooperative” and bring about several piezoelectric
innovations and inventions.
Features
1. Low power consumption.
2. No contacts therefore, no noise and highly reliable.
Applications
• Telephone ringers.
• Various office equipment such as PPCs, printers and keyboards.
• Various home appliances such as microwave ovens.
• Confirmation sound of various audio equipment.

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

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 23


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

FIG: 3.12 POWER SUPPLY

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.

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 25


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

FIG:3.13 An ideal step-down transformer showing magnetic flux in the core

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

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 26


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

Taking the ratio of the two equations for VS and VP gives the basic equation for stepping up
or stepping down the voltage

Ideal Power Equation:

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.

Pincoming = IPVP = Poutgoing = ISVS

giving the ideal transformer equation

Pin-coming = IPVP = Pout-going = ISVS giving the ideal transformer equation

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 27


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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:

A diode bridge or bridge rectifier is an arrangement of four diodes in a bridge


configuration that provides the same polarity of output voltage for any polarity of input voltage.
When used in its most common application, for conversion of alternating current (AC) input into
direct current (DC) output, it is known as a bridge rectifier. A bridge rectifier provides full-wave
rectification from a two-wire AC input, resulting in lower cost and weight as compared to a
center-tapped transformer design, but has two diode drops rather than one, thus exhibiting
reduced efficiency over a center-tapped design for the same output voltage.

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.

FIG:3.14 BRIDGE RECTIFIER PINS

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 29


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

FIG:3.15 OUPUT WAVEFORMS OF BRIDGE RECTIFIER

Output Smoothing (Using Capacitor):

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

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 30


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

the bridge alone supplies an output voltage of fixed polarity but pulsating magnitude (see
diagram above).

FIG:3.16 ARRANGING REGULATOR TO THE BRIDGE CIRCUIT

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.

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 31


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 32


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

3) VOLTAGE REGULATOR :

A voltage regulator is an electrical regulator designed to automatically maintain a constant


voltage level. The 78xx (also sometimes known as LM78xx) series of devices is a family of self-
contained fixed linear voltage regulator integrated circuits. The 78xx family is a very popular
choice for many electronic circuits which require a regulated power supply, due to their ease of
use and relative cheapness. When specifying individual ICs within this family, the xx is replaced
with a two-digit number, which indicates the output voltage the particular device is designed to
provide (for example, the 7805 has a 5 volt output, while the 7812 produces 12 volts). The 78xx
line is positive voltage regulators, meaning that they are designed to produce a voltage that is
positive relative to a common ground. There is a related line of 79xx devices which are
complementary negative voltage regulators. 78xx and 79xx ICs can be used in combination to
provide both positive and negative supply voltages in the same circuit, if necessary. 78xx ICs
have three terminals and are most commonly found in the TO220 form factor, although smaller
surface-mount and larger TrO3 packages are also available from some manufacturers. These
devices typically support an input voltage which can be anywhere from a couple of volts over the
intended output voltage, up to a maximum of 35 or 40 volts, and can typically provide up to
around 1 or 1.5 amps of current (though smaller or larger packages may have a lower or higher
current rating).

FIG:3.17 INTERNAL DIAGRAM OF VOLTAGE REGULATOR

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 33


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

3.2 MICRO CONTROLLERS

Microprocessors vs. Microcontrollers:

• Microprocessors are single-chip CPUs used in microcomputers.


• Microcontrollers and microprocessors are different in three main aspects: hardware
architecture, applications, and instruction set features.
• Hardware architecture: A microprocessor is a single chip CPU while a microcontroller is a
single IC contains a CPU and much of remaining circuitry of a complete computer (e.g., RAM,
ROM, serial interface, parallel interface, timer, interrupt handling circuit).
• Applications: Microprocessors are commonly used as a CPU in computers while
microcontrollers are found in small, minimum component designs performing control oriented
activities.
• Microprocessor instruction sets are processing Intensive.
• Their instructions operate on nibbles, bytes, words, or even double words.
• Addressing modes provide access to large arrays of data using pointers and offsets.
• They have instructions to set and clear individual bits and perform bit operations.
• They have instructions for input/output operations, event timing, enabling and setting priority
levels for interrupts caused by external stimuli.
• Processing power of a microcontroller is much less than a microprocessor.
Difference between 8051 and 8052:
The 8052 microcontroller is the 8051's "big brother." It is a slightly more powerful
microcontroller, sporting a number of additional features which the developer may make use of:
 256 bytes of Internal RAM (compared to 128 in the standard 8051).
 A third 16-bit timer, capable of a number of new operation modes and 16-bit reloads.
 Additional SFRs to support the functionality offered by the third timer.

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 34


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

PIN CONFIGURATION:

FIG:3.18 PIN CONFIGURATION OF 8051

PIN DESCRIPTION OF 8051 MICROCONTROLLER :


VCC
Supply voltage.
GND
Ground.
Port 0
Port 0 is an 8-bit open drain bi-directional 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 0 can also be configured to be the multiplexed low order address/data bus during
accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also
receives the code bytes during Flash programming and outputs the code bytes during program
verification. External pull-ups are required during program verification

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 35


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

Fig:3.19 Functioning Of Port1 Pins


Port 2
Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output buffers can
sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the
internal pull-ups and can be used as inputs. Port 2 emits the high-order address byte during
fetches from external program memory and during accesses to external data memory that use 16-
bit addresses (MOVX @DPTR). In this application, Port 2 uses strong internal pull-ups when
emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI),
Port 2emits the contents of the P2 Special Function Register. Port 2 also receives the high-order
address bits and some control signals during Flash programming and verification.
Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can
sink/source four TTL inputs. When 1s are writt 1s are written to Port 3 pins, they are pulled high
by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 36


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

Fig:3.20 Functioning Of Port3 Pins

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

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 37


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

Fig:3.21 Oscillator Connections

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 38


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

SPECIAL FUNCTION REGISTER (SFR) MEMORY:


Special Function Registers (SFR s) 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.
The Accumulator:
The Accumulator, as its name suggests is used as a general register to accumulate the
results of a large number of instructions. It can hold 8-bit (1-byte) value and is the most versatile
register.
The “R” registers: The “R” registers are a set of eight registers that are named R0, R1. Etc
up to R7. These registers are used as auxiliary registers in many operations.
The “B” registers: The “B” register is very similar to the accumulator in the sense that it
may hold an 8-bit (1-byte) value. Two only uses the “B” register 8051 instructions: MUL AB and
DIV AB.

The Data Pointer:


The Data pointer (DPTR) is the 8051’s only user accessible 16-bit (2Bytes) register. The
accumulator, “R” registers are all 1-Byte values. DPTR, as the name suggests, is used to point to
data. It is used by a number of commands, which allow the 8051 to access external memory.
THE PROGRAM COUNTER AND STACK POINTER:
The program counter (PC) is a 2-byte address, which tells the 8051 where the next
instruction to execute is found in memory. The stack pointer like all registers except DPTR and
PC may hold an 8-bit (1-Byte) value.
ADDRESSING MODES:
An “addressing mode” refers that you are addressing a given memory location. In summary,
the addressing modes are as follows, with an example of each:
Each of these addressing modes provides important flexibility.
Immediate Addressing MOV A, #20 H
Direct Addressing MOV A, 30 H
Indirect Addressing MOV A, @R0

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 39


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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:

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 40


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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.

Fig:3.22 Interrupt Register

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 41


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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

Auto-reload (Up or Down Counter)

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 42


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

Timer 2 can be programmed to count up or down when configured in its 16-bit


auto-reload mode. This feature is invoked by the DCEN (Down Counter Enable) bit
located in the SFR T2MOD . Upon reset , the DCEN bit is set to 0 so that timer 2
will default to count up. When DCEN is set , Timer 2 can count up or down ,
depending on the value of the T2EX pin . In this mode , two options are selected
by bit EXEN2 in T2CON . If EXEN2 = 0 , Timer 2 counts up to 0FFFFH and then
sets the TF2 bit upon overflow . If EXEN2 = 1 , a 16-bit reload can be triggered
either by an overflow or by a 1-to-0 transition at external input T2EX.

Baud Rate Generator

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 .

Modes 1 and 3 Baud Rates =Timer 2 Overflow Rate


16

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.

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 44


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

CHAPTER-4
EMBEDDED C

4.1 KEIL SOFTWARE:

Installing the Keil software on a Windows PC


 Insert the CD-ROM in your computer’s CD drive
 On most computers, the CD will “auto run”, and you will see the Keil installation menu.
If the menu does not appear, manually double click on the Setup icon, in the root directory: you
will then see the Keil menu.
 On the Keil menu, please select “Install Evaluation Software”. (You will not require a
license number to install this software).
 Follow the installation instructions as they appear.

Loading the Projects

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.

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 45


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

Note: you will need to change the file properties after copying: file transferred from the CD will
be ‘read only’.

Configuring the Simulator


Open the Keil Vision2
Go to Project – Open Project and browse for Hello in Ch03_00 in Pont and open it.

Fig:4.1 Opening Project Window

Go to Project – Select Device for Target ‘Target1’

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 46


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

Fig:4.2 selecting devices for target


Select 8052(all variants) and click OK

Fig:4.3 Select 8051

Now we need to check the oscillator frequency:


Go to project – Options for Target ‘Target1’

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 47


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

Fig:4.4 check for oscillator frequency


Make sure that the oscillator frequency is 12MHz.

Fig:4.5 frequency information


Building the Target
Build the target as illustrated in the figure below

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 48


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

Fig:4.6 Target Building

Running the Simulation


Having successfully built the target, we are now ready to start the debug session and run the
simulator.
First start a debug session

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 49


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

Fig:4.7 Debug Session


The flashing LED we will view will be connected to Port 1. We therefore want to observe the
activity on this port

Fig:4.8 port selecting

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 50


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

Fig:4.9 port output

To ensure that the port activity is visible, we need to start the ‘periodic window update’ flag

Fig:4.10 select periodic window update


Go to Debug - Go
TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 51
RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

Fig:4.11 debug selection

While the simulation is running, view the performance analyzer to check the delay durations.

Fig:4.12 port output

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 52


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

Go to Debug – Performance Analyzer and click on

Fig:4.13 performance analyzer

Double click on DELAY_LOOP_Wait in Function Symbols: and click Define button

Fig:4.14 Delay Loop

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 53


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

CHAPTER-5
RESULTS
RESULT
5.1 TEMPERATURE SENSOR:

Fig :5.1 Graph Displaying Body Temperature (oC)

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 54


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

5.2 HEART BEAT SENSOR:

Fig:5.2 Graph Displaying Heart Beat (bpm) for Normal Patient’s (t= 15 min.,t=5 to t=20 min.)

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 55


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

CHAPTER-6
ADVANTAGES

 We can transfer the data upto 100mts.


 We can transmit and receive the messages.
 Heart beat monitor and display system is a portable and a best replacement for the old
model stethoscope.
 A place in the hospital where very ill patients are monitored very closely.
 The patients in the ICU need a constant monitoring of their temperature and heart beat.
 This project is a working model, which incorporates sensors to measure important
parameters namely the temperature, respiratory temperature and heart beat.
 The patient can be analyzed by doctors in any part of the hospital where ever they are.
 Even when the patient is in an unconscious condition, all the parameters will be sensed
and doctor will be cautioned, cause it reduces doctors work load also gives more accurate result.
 We have also incorporated saline monitoring system which gives an alarm when the
saline bottle about to empty.

CHAPTER-7
DISADVANTAGES

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 56


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

 We cannot transfer the messages simultaneously.

CHAPTRER-8
APPLICATIONS

 HOSPITAL APPLICATION

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 57


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

 MILITARY APPLICATION

CHAPTER-9
FUTURE SCOPE

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 58


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 59


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

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

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 60


RELIABLE TRANSMISSION PROTOCOL FOR ZIGBEE BASED WIRELESS PATIENT MONITORING

Muhammad Ali Mazidi


Janice Gillispie Mazidi

The 8051 Micro controller Architecture, Programming & Applications

Kenneth J.Ayala

Fundamentals of Micro processors and Micro computers

B.Ram

Micro processor Architecture, Programming & Applications

Ramesh S.Gaonkar

Electronic Components

D.V.Prasad

References on the Web:


www.national.com
www.atmel.com
www.microsoftsearch.com
www.geocities.com

TRINITY COLLEGE OF ENGINEERING AND TECHNOLOGY Page 61

Вам также может понравиться