You are on page 1of 72



The project aims in designing a system which is capable of continuously displaying the heart beat of a person on LCD. Technology is being used everywhere in our daily life to fulfill our requirements. We are employing different sensors for different applications sometimes we may even use same sensors differently for different applications. Whatever it may be the final output is life has increased its speed with the technology boosters. We can not only increase the speed of life but also increase security with good ideas to make use of this technology. One of the ideal ways of using technology is to employ it to sense serious health problems so that efficient medical services can be provided to the patient in correct time. This idea to provide efficient health service to patients has given birth to the project heart beat monitoring system with voice alerts and send message to the doctors.

Heart beat monitor and display system is a portable and a best replacement for the old model stethoscope which is less efficient. The heart beat rate is calculated manually using stethoscope where the probability of error is high because the heart beat rate lies in the range of 70 to 90 per minute whose occurrence is less than 1 sec, so this device can be considered as a very good alternative instead of a stethoscope.

The functioning of this device is based on the truth that the blood circulates for every one heart beat which can be sensed by using a circuit formed by the combination of an LDR and LED. Depending upon the rate of circulation of blood per second the heart beat rate per minute is calculated. This device consists of a micro controller which takes the input from the heart beat sensor and calculates the heart rate of the patient. The micro controller also takes the responsibility to display the same on the LCD.

The main objective of this project is:

1. Monitoring the heart beat. 2. Produces voice based alerts whenever necessary.

The project provides learnings on the fallowing advancements: 1. Developing a sensor based on LED and LDR. 2. LDR characteristics. 3. Design of voice based IC circuit. 4. Conversion of AC supply to DC supply. 5. Embedded C programming. 6. PCB design. The major building blocks of this project are:

1. Regulated power supply. 2. Micro controller. 3. Heart beat sensor. 4. Reset. 5. LCD 6. Crystal oscillator. 7. LED indicators.

Regulated Power Supply:









Voice Module


Step Down Transforme

Bridge Rectifier

Filter Circuit

Regulato r section

The project aims in designing a system which is capable of continuously displaying the heart beat of a person on GLCD. Technology is being used everywhere in our daily life to fulfill our requirements. We are employing different sensors for different applications sometimes we may even use same sensors differently for different applications. Whatever it may be the final output is life has increased its speed with the technology boosters. We can not only increase the speed of life but also increase security with good ideas to make use of this technology. One of the ideal ways of using technology is to employ it to sense serious health problems so that efficient medical services can be provided to the patient in correct time. This idea to provide efficient health service to patients has given birth to the project heart beat monitoring system with voice alerts and display on LCD. Heart beat monitor and display system is a portable and a best replacement for the old model stethoscope which is less efficient. The heart beat rate is calculated manually using stethoscope where the probability of error is high because the heart beat rate lies in the range of 70 to 90 per minute whose occurrence is less than 1 sec, so this device can be considered as a very good alternative instead of a stethoscope.

The functioning of this device is based on the truth that the blood circulates for every one heart beat which can be sensed by using a circuit formed by the combination of an LDR and LED. Depending upon the rate of circulation of blood per second the heart beat rate per minute is calculated. This device consists of a micro controller which takes the input from the heart beat sensor and calculates the heart rate of the patient. The micro controller also takes the responsibility to display the same on the Graphical LCD which is interfaced to it through LCD drivers.

SOFTWARE: Embedded C RIDE to write code ISP to burn the chip

HARDWARE: At89s52 based our own developed board Power Supply ZigBee Module GSM VOICE MODULE Keypad Max232 ADVANTAGES: Low cost, automated operation, Low Power consumption.

Embedded Systems Definition of an Embedded System Embedded system is defined as, For a particular/specific application implementing the software code to interact directly with that particular hardware what we built. Software is used for providing features and flexibility, Hardware = {Processors, ASICs, Memory,...} is used for Performance (& sometimes security) There are many definitions of embedded system but all of these can be combined into a single concept. An embedded system is a special purpose computer system that is used for particular task. COMPONENTS OF EMBEDDED SYSTEM It has Hardware Processor, Timers, Interrupt controller, I/O Devices, Memories, Ports, etc. It has main Application Software Which may perform concurrently the series of tasks or ultiple tasks. It has Real Time Operating System (RTOS) RTOS defines the way the system work. Which supervise the application software. It sets the rules during the execution of the application program. A small scale embedded system may not need an RTOS.


EMBEDDED SYSTEM CONSTRAINTS An embedded system is software designed to keep in view three constraints: Available system memory Available processor speed The need to limit the power dissipation

When running the system continuously in cycles of wait for events, run, stop and

What makes embedded systems different? Real-time operation size cost time reliability safety energy security CLASSIFICATIONS OF EMBEDDED SYSTEM

1. Small Scale Embedded System

2. Medium Scale Embedded System

3. Sophisticated Embedded System

SMALL SCALE EMBEDDED SYSTEM Single 8 bit or 16bit Microcontroller. Little hardware and software complexity. They May even be battery operated. Usually C is used for developing these system. The need to limit power dissipation when system is running continuously. Programming tools: Editor, Assembler and Cross Assembler MEDIUM SCALE EMBEDDED SYSTEM Single or few 16 or 32 bit microcontrollers or Digital Signal Processors (DSP) or Reduced Instructions Set Computers (RISC). Both hardware and software complexity. Programming tools: RTOS, Source code Engineering Tool, Simulator, Debugger and Integrated Development Environment (IDE). SOPHISTICATED EMBEDDED SYSTEM Enormous hardware and software complexity Which may need scalable processor or configurable processor and programming logic arrays. Constrained by the processing speed available in their hardware units. Programming Tools: For these systems may not be readily available at a reasonable cost or may not be available at all. A compiler or retargetable compiler might have to be developed for this.

Features of Embedded Systems The versatility of the embedded computer system lends itself to utility in all kinds of enterprises, from the simplification of deliverable products to a reduction in costs in their development and manufacture. Complex systems with rich functionality employ special operating systems that take into account major characteristics of embedded systems.

Embedded operating systems have minimized footprint and may follow real-time operating system specifics. The special computers system is usually less powerful than general-purpose systems, although some expectations do exist where embedded systems are very powerful and complicated. Usually a low power consumption CPU with a limited amount of memory is used in embedded systems. Many embedded systems use very small operating systems; most of these provide very limited operating system capabilities. Since the embedded system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product, or increasing the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale. Some embedded systems have to operate in extreme environment conditions such as very high temperature & humidity. For high volume systems such as portable music players or mobile phones, minimizing cost is usually the primary design consideration. Engineers typically select hardware that is just good enough to implement the necessary functions. For low volume or prototype embedded systems, general purpose computers may be adapted by limiting the programs or by replacing the operating system with a real-time operating system. Overview of an Embedded System Architecture Every Embedded system consists of a custom-built hardware built around a central processing unit. This hardware also contains memory chips onto which the software is loaded.

Application Software Operating System


The operating system runs above the hardware and the application software runs above the operating system. The same architecture is applicable to any computer including desktop computer. However these are significant differences. It is not compulsory to have an operating system in every embedded system. For small applications such as remote control units, air conditioners, toys etc. Applications of Embedded Systems Some of the most common embedded systems used in everyday life are Small embedded controllers: 8-bit CPUs dominate, simple or no operating system (e.g., thermostats) Control systems: Often use DSP chip for control computations (e.g., automotive engine control) Distributed embedded control: Mixture of large and small nodes on a real-time Embedded networks (e.g., cars, elevators, factory automation) System on chip: ASIC design tailored to application area (e.g., consumer electronics, set-top boxes) Network equipment: Emphasis on data movement/packet flow (e.g., network switches; telephone switches) Critical systems: Safety and mission critical computing (e.g., pacemakers, automatic trains) Signal processing: Often use DSP chips for vision, audio, or other signal Processing (e.g., face recognition) Robotics: Uses various types of embedded computing (especially Vision and control) (e.g., autonomous vehicles) Computer peripherals: Disk drives, keyboards, laser printers, etc.

Wireless systems:

Wireless network-connected sensor networks and Motes to gather and report information

Embedded PCs:

Palmtop and small form factor PCs embedded into Equipment

Command and control:

Often huge military systems and systems of systems (e.g., a fleet of warships with interconnected Computers)

Home Appliances, intercom, telephones, security systems, garage door openers, answering machines, fax machines, home computers, TVs, cable TV tuner, VCR, camcorder, remote controls, video games, cellular phones, musical instruments, sewing machines, lighting control, paging, camera, pinball machines, toys, exercise equipment Office Telephones, computers, security systems, fax machines, microwave, copier, laser printer, color printer, paging Auto Trip computer, engine control, air bag, ABS, instrumentation, security system, transmission control, entertainment, climate control, cellular phone, keyless entry

MICROCONTROLLER VERSUS MICROPROCESSOR A system designer using a general-purpose microprocessor such as the Pentium or the 68040 must add RAM, ROM, I/O ports, and timers externally to make them functional. Although the addition of external RAM, ROM, and I/O ports makes these systems bulkier and much more expensive, they have the advantage of versatility such that the designer can decide on the amount of RAM, ROM and I/O ports needed to fit the task at hand. A Microcontroller has a CPU (a microprocessor) in addition to a fixed amount of RAM, ROM, I/O ports, and a timer all on a single chip. In other words, the processor, the RAM, ROM, I/O ports and the timer are all embedded together on one chip; therefore, the designer cannot add any external memory, I/O ports, or timer to it. The fixed amount of onchip ROM, RAM, and number of I/O ports in Microcontrollers makes them ideal for many applications in which cost and space are critical.

CPU platform:

Embedded processors can be broken into two distinct categories: microprocessors (P) and microcontrollers (C). Microcontrollers have built-in peripherals on the chip, reducing size of the system. There are many different CPU architectures used in embedded designs such as ARM, MIPS, Coldfire/68k, PowerPC, x86, PIC, 8051, Atmel AVR, Renesas H8, SH, V850, FR-V, M32R, Z80, Z8, etc. This in contrast to the desktop computer market, which is currently limited to just a few competing architectures. PC/104 and PC/104+ are a typical base for small, low-volume embedded and ruggedized system design. These often use DOS, Linux, NetBSD, or an embedded real-time operating system such as QNX or VxWorks. A common configuration for very-high-volume embedded systems is the system on a chip (SoC), an application-specific integrated circuit (ASIC), for which the CPU core was purchased and added as part of the chip design. A related scheme is to use a fieldprogrammable gate array (FPGA), and program it with all the logic, including the CPU. Embedded systems are based on the concept of the microcontroller, a single integrated circuit that contains all the technology required to run an application. Microcontrollers make integrated systems possible by combining several features together into what is effectively a complete computer on a chip, including: * Central Processing Unit * Input/Output interfaces (such as serial ports) * Peripherals (such as timers) * ROM, EEPROM or Flash memory for program storage * RAM for data storage * Clock generator By integrating all of these features into a single chip it is possible to greatly reduce the number of chips and wiring necessary to control an electronic device, dramatically reducing its complexity, size and cost.

* Size & Weight: Microcontrollers are designed to deliver maximum performance for minimum size and weight. A centralized on-board computer system would greatly outweigh a collection of microcontrollers. * Efficiency: Microcontrollers are designed to perform repeated functions for long periods of time without failing or requiring service. Based on the Processor side Embedded Systems is mainly divided into 3 types 1. Micro Processor: - are for general purpose eg: our personal computer 2. Micro Controller: - are for specific applications, because of cheaper cost we will go for these 3. DSP (Digital Signal Processor):- are for high and sensitive application purpose


AT89S52 MICROCONTROLLER The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmels highdensity nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and costeffective solution to many embedded control applications. 8051 PIN DIAGRAM

AT89S52 Architecture consists of these specific features:

8 bit CPU with registers A (Accumulator) and B 16 bit Program Counter(PC) and Data Pointer (DPTR) 8 bit Program Status Word (PSW) 8 bit Stack Pointer (SP) Internal ROM of 8k Internal RAM of 128 bytes Four Register banks each containing eight registers Sixteen bytes, which may be addressed at the bit level Eighty bytes of general purpose data memory

32 I/O pins arranged as four 8-bit ports: P0,P1,P2,P3 Two 16-bit Timers/Counters: T0 and T1 Full duplex serial data Receiver/Transmitter : SBUF Control Registers: TCON, TMOD, SCON, SMOD, PCON, IP and IE. Two external and three internal interrupt sources. Oscillator and Clock circuits. Pin Description Pin ( 32 39 ) Port 0 : Port 0 is an 8-bit open drain bidirectional port. As an open drain output port, it can sink eight LS TTL loads. Port 0 pins that have 1s written to them float, and in that state will function as high impedance inputs. Port 0 is also the multiplexed low-order address and data bus during accesses to external memory. In this application it uses strong internal pull ups when emitting 1s. Port 0 emits code bytes during program verification. In this application, external pull ups are required.

Pin ( 1- 8 ) Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pull ups. Port 1 pins that have 1s written to them are pulled high by the internal pull ups, and in that state can be

used as inputs. As inputs, port 1 pins that are externally being pulled low will source current because of the internal pull ups. Alternate Functions of Port 1 used for In system Programmable P.5 P.6 P.7 MOSI --------- Instruction Input MISO ---------- Data Output SCK ----------- Clk in

Pin (21 28) Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pull ups. Port 2 emits the high-order address byte during accesses to external memory that use 16-bit addresses. In this application, it uses the strong internal pull ups when emitting 1s. Pin (10 17) Port 3: Port 3 is an 8-bit bidirectional I/O port with internal pull ups. It also serves the functions of various special features of the 80C51 Family as follows: Port Pin Alternate Function P3.0- RxD (serial input port) P3.1 -TxD (serial output port) P3.2 -INT0 (external interrupt 0) P3.3- INT1 (external interrupt 1) P3.4 -T0 (timer 0 external input) P3.5 -T1 (timer 1 external input) P3.6 -WR (external data memory write strobe) P3.7 -RD (external data memory read strobe) Pin 40 VCC: -Supply voltage Pin 20 VSS: -Circuit ground potential

Pin 29 PSEN: Program Store Enable is the read strobe to external Program Memory. When the device is executing out of external Program Memory, PSEN is activated twice each machine cycle (except that two PSEN activations are skipped during accesses to external Data Memory). PSEN is not activated when the device is executing out of internal Program Memory. Pin 30 ALE/PROG: Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. ALE is emitted at a constant rate of 1/6 of the oscillator frequency, for external timing or clocking purposes, even when there are no accesses to external memory. (However, one ALE pulse is skipped during each access to external Data Memory.) This pin is also the program pulse input (PROG) during EPROM programming. Pin 31 EA/VPP: When EA is held high the CPU executes out of internal Program Memory. Holding EA low forces the CPU to execute out of external memory regardless of the Program Counter value. In the 80C31, EA must be externally wired low. In the EPROM devices, this pin also receives the programming supply voltage (VPP) during EPROM programming. Pin 18 XTAL1: Input to the inverting oscillator amplifier. Pin 19 XTAL2: Output from the inverting oscillator amplifier. Crystal Oscillator The 8051 uses the crystal for precisely that: to synchronize its operation. Effectively, the 8051 operates using what are called "machine cycles." A single machine cycle is the minimum amount of time in which a single 8051 instruction can be executed. although many instructions take multiple cycles. 8051 has an on-chip oscillator. It needs an external crystal that decides the operating frequency of the 8051. The crystal is connected to pins 18 and 19 with stabilizing capacitors. 12 MHz (11.059MHz) crystal is often used and the capacitance ranges from 20pF to 40pF. A cycle is, in reality, 12 pulses of the crystal. That is to say, if an instruction takes one machine cycle to execute, it will take 12 pulses of the crystal to execute. Since we know the we can calculate how many instruction cycles the 8051 can execute per second: 11,059,000 / 12 = 921,583

11.0592 MHz crystals are often used because it can be divided to give you exact clock rates for most of the common baud rates for the UART, especially for the higher speeds (9600, 19200).

Reset RESET is an active High input When RESET is set to High, 8051 goes back to the power on state.The 8051 is reset by holding the RST high for at least two machine cycles and then returning it low. Initially charging of capacitor makes RST High, When capacitor charges fully it blocks DC.

SIP Resistor Sip Resistor is a single in pack Resistor (i.e.,) 8 resistors connected in series. Basically SIP resistor is a 9 pin connector first pin is for power supply to the entire 8 resistors in SIP.Generally SIP Resistor is used to close the open drain connections of Port 0.

In System Programming (ISP):In-System Programming (ISP) is the ability of some programmable logic devices,
microcontrollers, and other programmable electronic chips to be programmed while

installed in a complete system, rather than requiring the chip to be programmed prior to installing it into the system. (or) In-system programming is a valuable feature that allows system firmware to be upgraded without disassembling the embedded system to physically replace memory. Most Maxim 8051-based microcontrollers can be reprogrammed from a PC or laptop via an inexpensive RS-232 serial interface and a few logic gates The primary advantage of this feature is that it allows manufacturers of electronic devices to integrate programming and testing into a single production phase, rather than requiring a separate programming stage prior to assembling the system. This may allow manufacturers to program the chips in their own system's production line instead of buying preprogrammed chips from a manufacturer or distributor, making it feasible to apply code or design changes in the middle of a production run.

REGISTERS 8051 is a collection of 8 and 16 bit registers and 8 bit memory locations. These registers and memory locations can be made to operate using the software instructions. The program instructions control the registers and digital data paths that are contained inside the 8051, as well as memory locations that are located outside the 8051. Register are used to store information temporarily, while the information could be a byte of data to be processed, or an address pointing to the data to be fetched. The vast majority of 8051 register are 8-bit registers. Generally there are two types of registers. They are General purpose Registers (GPRs) and Special Function Registers (SFRs) General Purpose Register

The 8 bits of a register are shown from MSB D7 to the LSB D0. With an 8-bit data type, any data larger than 8 bits must be broken into 8-bit chunks before it is processed.

The most widely used registers A (Accumulator) For all arithmetic and logic instructions B, R0, R1, R2, R3, R4, R5, R6, R7 DPTR (data pointer), and PC (program counter)

16 bit General Purpose Register are Data Pointer (DPTR) and Program Counter (PC) The program counter points to the address of the next instruction to be executed. DPTR. As the name suggests, is used to point the data. It is used by a number of commands which allows the microcontroller to access external memory. When the microcontroller access external memory it will access at the address indicated by DPTR.

There are 128 bytes of RAM in the 8051 The 128 bytes are divided into three different groups as follows: 1) A total of 32 bytes from locations 00 to 1F hex are set aside for register banks and the stack 2) A total of 16 bytes from locations 20H to 2FH are set aside for bit-addressable read/write memory 3) A total of 80 bytes from locations 30H to 7FH are used for read and write storage, called scratch pad

Special Function Registers The program status word (PSW) PSW register, also referred to as the flag register, is an 8 bit register Only 6 bits are used These four are CY (carry), AC (auxiliary carry), P (parity), and OV (overflow) They are called conditional flags, meaning that they indicate some conditions that resulted after an instruction was executed. The PSW3 and PSW4 are designed as RS0 and RS1, and are used to change the bank. The two unused bits are user-definable

Timer/Counters The Atmel 80C51 Microcontrollers implement two general purpose, 16-bit timers/ counters. They can be used either as timers to generate a time delay or as a counter to count events happening outside the microcontroller. The microcontroller has two 16-bit wide timers. They are identified as Timer 0 and Timer 1, and can be independently configured to operate in a variety of modes as a timer or as an event counter. When operating as a timer, the timer/counter runs for a programmed length of time, then issues an interrupt request. When operating as a counter, the timer/counter counts negative transitions on an external pin. After a preset number of counts, the counter issues an interrupt request. Register pairs (TH0, TL0), (TH1, TL1), and (TH2, TL2) are the 16-bit counting registers for Timer/Counters 0, 1, and 2, respectively.

Timer 0 Register The 16-bit register of Timer 0 is accessed as low byte and high byte. The low byte register is called TL0 (Timer 0 low byte) and high byte register is referred to as TH0 (Timer 0 high byte). These registers can be accessed like any other register, such as A, B, R0, R1, R2, etc. Timer 1 Register Timer 1 is also 16-bits, and its 16-bit register is split into two bytes, referred to as TL1 ( Timer 1 low byte ) and TH1 ( Timer 1 high byte ). These registers are accessible in the same way as the registers of timer 0. TMOD Register (timer mode) TMOD: Timer/Counter Mode Control Register. Not Bit Addressable.

Timer 1 GATE

Timer 0 When TRx (in TCON) is set and GATE=1, Timer/CounterX will run only while Into pin is high (hardware control). When GATE=0, Timer/Counter will run only while TRx=1 (software control).


Timer or Counter selector. Cleared for Timer operation (input from internal system clock). Set for Counter operation input pin). (input from TX

M1 M0 M1 0 0 1 M0 0 1 0

Mode selector bit. Mode selector bit. Mode 0 1 2 Operating Mode 13-bit Timer (8048 compatible) (TH1) 16-bit Timer/Counter 8-bit Auto-Reload Timer/Counter (TL1).

Reloaded from TH1 at overflow. 1 1 1 1 3 3 timer 1 halted. Retains count. (Timer 1) Timer/Counter 1 stopped.

TCON: Timer/Counter Control Register Bit Addressable.

The upper four Bits are used to Store the TF and TR bits of both

The lower 4 bits Are set aside for controlling the


Timer1 overflow flag. Set by hardware when the Timer/Counter 1 overflows. Cleared by hardware as processor vectors to the interrupt service routine.


Timer 1 run control bit. Set/cleared by software to turn Timer/Counter 1 ON/OFF.


Timer0 overflow flag. Set by hardware when the Timer/Counter 0 overflows. Cleared by hardware as processor vectors to the service routine.


Timer 0 run control bit. Set/cleared by software to turn Timer/Counter 0 ON/OFF.


External Interrupt 1 edge flag. Set by hardware when External interrupt edge is detected. Cleared by hardware when interrupt is processed.


Interrupt 1 type control bit. Set/cleared by software to specify falling edge/low level triggered External Interrupt.


External Interrupt 0 edge flag. Set by hardware when External Interrupt edge is detected. Cleared by hardware when interrupt is processed.


Interrupt 0-type control bit. Set/cleared by software to specify falling edge/low level triggered External Interrupt


The 8051 serial port is full duplex. In other words, it can transmit and receive data at the same time. Unlike any other register in the 8051, SBUF is in fact two distinct registers - the write-only register and the read-only register. Transmitted data is sent out from the write-only register while received data is stored in the read-only register. There are two separate data lines, one for transmission (TXD) and one for reception (RXD). Therefore, the serial port can be transmitting data down the TXD line while it is at the same time receiving data on the RXD line. The TXD line is pin 11 of the microcontroller (P3.1) while the RXD line is on pin 10 (P3.0) Serial data communication uses two methods, asynchronous and synchronous. The synchronous method transfers a block of data (characters) at a time, while the asynchronous method transfers a single byte at a time. It is possible to write software to use either of these methods, but the programs can be tedious and long. For this reason, there are special IC chips made by many manufacturers for serial data communications. These chips can be commonly referred to as UART (Universal Asynchronous Receiver-transmitter) and USART ( Universal Synchronous Asynchronous Receiver-Transmitter). The 8051 chip has a built-in UART.

Asynchronous Serial Communication and Data Framing Start Bits and Stop Bits In the asynchronous method is character is placed between start and stop bits, this is called data framing. In asynchronous communication, at least two extra bits are transmitted with the data word; a start bit and a stop bit. Therefore, if the transmitter is using an 8-bit system, the actual number of bits transmitted per word is ten. In most protocols the start bit is a logic 0 while the stop bit is logic 1. Therefore, when no data is being sent the data line is continuously HIGH. The receiver waits for a 1 to 0 transition. In other words, it awaits a transition from the stop bit (no data) to the start bit (logic 0). Once this transition occurs the receiver knows a data byte will follow. Since it knows the data rate (because it is defined in the protocol) it uses the same clock as frequency as that used by the transmitter and reads the correct number of bits and stores them in a register. For example, if the protocol determines the word size as eight bits, once the receiver sees a start bit it reads the next eight bits and places them in a buffer. Once the data word has been read the receiver checks to see if the next bit is a stop bit, signifying the end of the data. If the next bit is not logic 1 then something went wrong with the transmission and the receiver

dumps the data. If the stop bit was received the receiver waits for the next data word, i.e.; it waits for a 1 to 0 transition.

Goes out first

Baud Rates in the 8051

11.0592 MHz

Machine cycle 12 frequency 921.6 kHz

XTAL oscillator

28800 Hz Timer 1 By UART To timer 1 To set the Baud rate


XTAL = 11.0592 MHz: The frequency of system clock = 11.0592 MHz / 12 = 921.6 kHz The frequency sent to timer 1 = 921.6 kHz/ 32 = 28,800 Hz (a) 28,800 / 3 = 9600 where -3 = FD (hex) is loaded into TH1

(b) 28,800 / 12 = 2400 where -12 = F4 (hex) is loaded into TH1 (c) 28,800 / 24 = 1200 where -24 = E8 (hex) is loaded into TH1 SBUF SBUF is an 8-bit register used solely for serial communication in the 8051. For a byte of data to be transferred via the TxD line, it must be placed in the SBUF register. Similarly, SBUF holds the byte of data when it is received by the 8051s RxD line. SBUF can be accessed like any other register in the 8051.

The moment a byte is written into SBUF, it is framed with the start and stop bits and transferred serially via the TxD pin. Similarly, when the bits are received serially via RxD, the 8051 deframes it by eliminating the stop and start bits, making a byte out of the data received, and then placing it in the SBUF. DATA TRANSMISSION: Transmission of serial data bits begins anytime data is written to sbuf. TI " (SCON) set to 1 when data has been transmitted and signifies that " SBUF " is empty and that another data byte can be sent.

DATA RECEPTION: Reception of serial data will begin if the receive enable bit (REN) in SCON is set to ' 1 ' for all modes. For mode ' 0 ' only RI must be cleared to 0. Receiver interrupt flag ' RI ' (in SCON) is set after data has been received in all modes. Setting of ' REN ' bit is a direct program control that limits the reception of unexpected data. SCON (Serial Control ) Register SM0 SM1 SM2 REN TB8 RB8 TI RI

Mode 0: Serial data enters and exits through RxD. TxD outputs the shift clock. 8 bits are transmitted/received (LSB first). The baud rate is fixed at 1/12 the oscillator frequency.

Mode 1: 10 bits are transmitted (through TxD) or received (through RxD): a start bit (0), 8 data bits (LSB first), and a stop bit (1). On receive; the stop bit goes into RB8 in Special Function Register SCON. The baud rate is variable. Mode 2: 11 bits are transmitted (through TxD) or received (through RxD): start bit (0), 8 data bits (LSB first), a programmable 9th data bit, and a stop bit (1). On Transmit, the 9th data bit (TB8 in SCON) can be assigned the value of 0 or 1. Or, for example, the parity bit (P, in the PSW) could be moved into TB8. On receive; the 9th data bit goes into RB8 in Special Function Register SCON, while the stop bit is ignored. The baud rate is programmable to either 1/32 or 1/64 the oscillator frequency. Mode 3: 11 bits are transmitted (through TxD) or received (through RxD): a start bit (0), 8 data bits (LSB first), a programmable 9th data bit, and a stop bit (1). In fact, Mode 3 is the same as Mode 2 in all respects except baud rate. The baud rate in Mode 3 is variable. In all four modes, transmission is initiated by any instruction that uses SBUF as a destination register. Reception is initiated in Mode 0 by the condition RI = 0 and REN = 1. Reception is initiated in the other modes by the incoming start bit if REN = 1. SM2 Enables the multiprocessor communication feature in Modes 2 and 3. In Mode 2 or 3, if SM2 is set to 1, then Rl will not be activated if the received 9th data bit (RB8) is 0. In Mode 1, if SM2=1 then RI will not be activated if a valid stop bit was not received. In Mode 0, SM2 should be 0.

REN Enables serial reception. Set by software to enable reception. Clear by software to disable reception. TB8 The 9th data bit that will be transmitted in Modes 2 and 3. Set or clear by software as desired. RB8 In Modes 2 and 3, is the 9th data bit that was received. In Mode 1, it SM2=0, RB8 is the stop bit that was received. In Mode 0, RB8 is not used. TI (Transmit Interrupt)

This is an extremely important flag bit in the SCON register. When the 8051 finishes the transfer of the 8-bit character it raises the TI flag to indicate that it is ready to transfer another byte. The TI bit is raised at the beginning of the stop bit. RI (Receive Interrupt) This is an extremely important flag bit in the SCON register. When the 8051 receives data serially via RxD, it gets rid of the start and stop bits and places the byte in the SBUF register. Then it raises the RI flag bit to indicate that a byte has been received and could be picked up before it is lost. INTERRUPTS An interrupt is a special feature which allows the 8051 to provide the illusion of "multitasking," although in reality the 8051 is only doing one thing at a time. The word "interrupt" can often be substituted with the word "event." An interrupt is triggered whenever a corresponding event occurs. When the event occurs, the 8051 temporarily puts "on hold" the normal execution of the program and executes a special section of code referred to as an interrupt handler. The interrupt handler performs whatever special functions are required to handle the event and then returns control to the 8051 at which point program execution continues as if it had never been interrupted. Interrupt Service Routine For every interrupt, there must be an interrupt service routine (ISR). Or interrupt handler. When an interrupt is invoked, the microcontroller runs the interrupt service routine. For every interrupt, there is a fixed location in memory that holds the address of its ISR. The group of memory locations set aside to hold the addresses of the ISRs is called interrupt vector table. Six Interrupts in 8051 1. Reset : When the reset pin is activated, the 8051 jumps to address location 0000 2. Two interrupts are set aside for the timers: one for the Timer 0 and one for Timer1. 3. Two interrupts are set aside for hardware external interrupts : one for INT0 and one for INT1

4. Serial communication has a single interrupt that belongs to both receive and transmit. Enabling Interrupt (IE) Register All interrupt are disabled after reset We can enable and disable them bye IE EA EA IE.7 -ET2 ES ET1 EX1 ET0 EX0

If EA=0, disables all interrupts, no interrupt is acknowledged If EA=1, each interrupt source is individually enabled or disabled by setting or clearing its enable bit.


IE.6 IE.5

Not implemented, reserved for future use. Enables or disables Timer2 overflow or capture interrupt (8052 only)


IE.4 IE.3 IE.2 IE.1 IE.0

Enables or disables the serial port interrupt. Enables or disables Timer 1 overflow interrupt. Enables or disables external interrupt 1. Enables or disables Timer 0 overflow interrupt. Enables or disables external interrupt 0.

Interrupt Priority (IP) Register 0= lower priority, 1= higher priority, reset IP=00H Lower priority ISR can be interrupted by a high priority interrupt. A high priority ISR can not be interrupted. Low-priority interrupt wait until 8051 has finished servicing the high-priority interrupt.









--PT2 PS PT1 PX1 PT0 PX0

IP.7 IP.6 IP.5 IP.4 IP.3 IP.2 IP.1 IP.0

Reserved Reserved Timer2 interrupt priority bit (8052 only) serial port interrupt priority bit. Timer 1 interrupt priority bit. external interrupt 1 priority bit. Timer 0 interrupt priority bit. external interrupt 0 priority bit.

BASIC REQUIRMENT The following are the basic five requirements of microcontroller 1. Power Supply 2. Crystal Oscillator 3. Reset 4. SIP Resistor 5. Resistor for EA Pin 1. Regulated Power Supply In mains-supplied electronic systems the AC input voltage must be converted into a DC voltage with the right value and degree of stabilization. The common DC voltages that are required to power up the devices are generally in the range of 3 VDC to 30 VDC. Typically the fixed types of DC voltages are 5V, 9V, 12V, 15V and 18V DC. POWER SUPPLY MODULES: STEP DOWN TRANSFORMER BRIDGE RECTIFIER WITH FILTER


Transformer Transformers convert AC electricity from one voltage to another with little loss of power. Transformers work only with AC and this is one of the reasons why mains electricity is AC. Step-up transformers increase voltage, step-down transformers reduce voltage. A step down power transformer is used to step down the AC voltage from the line voltage
of 110 VAC or 220 VAC i.e, it converts higher voltage at the input side to a lower voltage at the output.

Step Down Transformer:

In step down transformer secondary voltage is less than its primary voltage. It is designed to reduce the voltage from the primary winding to the secondary winding. As a step-down unit, the transformer converts high-voltage, low-current power into low-voltage, high-current power. The larger-gauge wire used in the secondary winding is necessary due to the increase in current. The primary winding, One of the most important considerations to increase transformer efficiency and reduce heat is choosing the metal type of the windings. Copper windings are much more efficient than aluminum and many other winding metal choices, but it also costs more. Transformers with copper windings cost more to purchase initially, but save on electrical cost over time as the efficiency more than makes up for the initial cost. Rectifier The Full Wave Bridge Rectifier The main advantage of this bridge circuit is that it does not require a special centre tapped transformer, thereby reducing its size and cost. The single secondary winding is connected to one side of the diode bridge network and the load to the other side as shown below. The Diode Bridge Rectifier

The four diodes labelled D1 to D4 are arranged in "series pairs" with only two diodes conducting current during each half cycle. During the positive half cycle of the supply, diodes D1 and D2 conduct in series while diodes D3 and D4 are reverse biased and the current flows through the load as shown below. The Positive Half-cycle

During the negative half cycle of the supply, diodes D3 and D4 conduct in series, but diodes D1 and D2switch "OFF" as they are now reverse biased. The current flowing through the load is the same direction as before. The Negative Half-cycle

As the current flowing through the load is unidirectional, so the voltage developed across the load is also unidirectional the same as for the previous two diode full-wave rectifier, therefore the average DC voltage across the load is 0.637Vmax. However in reality, during each half cycle the current flows through two diodes instead of just one so the amplitude of the output

voltage is two voltage drops ( 2 x 0.7 = 1.4V ) less than the input VMAX amplitude. The ripple frequency is now twice the supply frequency (e.g. 100Hz for a 50Hz supply) Typical Bridge Rectifier Although we can use four individual power diodes to make a full wave bridge rectifier, premade bridge rectifier components are available "off-the-shelf" in a range of different voltage and current sizes that can be soldered directly into a PCB circuit board or be connected by spade connectors. The image to the right shows a typical single phase bridge rectifier with one corner cut off. This cut-off corner indicates that the terminal nearest to the corner is the positive or +ve output terminal or lead with the opposite (diagonal) lead being the negative or ve output lead. The other two connecting leads are for the input alternating voltage from a transformer secondary winding. The Smoothing Capacitor We saw in the previous section that the single phase half-wave rectifier produces an output wave every half cycle and that it was not practical to use this type of circuit to produce a steady DC supply. The full-wave bridge rectifier however, gives us a greater mean DC value (0.637 Vmax) with less superimposed ripple while the output waveform is twice that of the frequency of the input supply frequency. We can therefore increase its average DC output level even higher by connecting a suitable smoothing capacitor across the output of the bridge circuit as shown below.

Full-wave Rectifier with Smoothing Capacitor

The smoothing capacitor converts the full-wave rippled output of the rectifier into a smooth DC output voltage. Generally for DC power supply circuits the smoothing capacitor is an Aluminium Electrolytic type that has a capacitance value of 100uF or more with repeated DC voltage pulses from the rectifier charging up the capacitor to peak voltage. However, their are two important parameters to consider when choosing a suitable smoothing capacitor and these are its Working Voltage, which must be higher than the no-load output value of the rectifier and its Capacitance Value, which determines the amount of ripple that will appear superimposed on top of the DC voltage. Too low a capacitance value and the capacitor has little effect on the output waveform. But if the smoothing capacitor is sufficiently large enough (parallel capacitors can be used) and the load current is not too large, the output voltage will be almost as smooth as pure DC. As a general rule of thumb, we are looking to have a ripple voltage of less than 100mV peak to peak. The maximum ripple voltage present for a Full Wave Rectifier circuit is not only determined by the value of the smoothing capacitor but by the frequency and load current, and is calculated as:

Bridge Rectifier Ripple Voltage

Where: I is the DC load current in amps, is the frequency of the ripple or twice the input frequency in Hertz, and C is the capacitance in Farads. The main advantages of a full-wave bridge rectifier is that it has a smaller AC ripple value for a given load and a smaller reservoir or smoothing capacitor than an equivalent half-wave rectifier. Therefore, the fundamental frequency of the ripple voltage is twice that of the AC supply frequency (100Hz) where for the half-wave rectifier it is exactly equal to the supply frequency (50Hz). The amount of ripple voltage that is superimposed on top of the DC supply voltage by the diodes can be virtually eliminated by adding a much improved -filter (pi-filter) to the output terminals of the bridge rectifier. This type of low-pass filter consists of two smoothing capacitors, usually of the same value and a choke or inductance across them to introduce a high impedance path to the alternating ripple component. Another more practical and cheaper alternative is to use an off the shelf 3-terminal voltage regulator IC, such as a LM78xx (where "xx" stands for the output voltage rating) for a positive output voltage or its inverse equivalent the LM79xx for a negative output voltage which can reduce the ripple by more than 70dB (Datasheet) while delivering a constant output current of over 1 amp. In the next tutorial about diodes, we will look at the Zener Diode which takes advantage of its reverse breakdown voltage characteristic to produce a constant and fixed output voltage across itself.

Filter Filtering is performed by a large value electrolytic capacitor connected across the DC supply to act as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling. The diagram shows the unfiltered varying DC (dotted line) and the filtered DC (solid line). The capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies current to the output.

Typically 1000 f capacitor is used in microcontroller of 8051.

CHAPTER-4 GSM: Global System for Mobile Communication (GSM)

Definition: Global system for mobile communication (GSM) is a globally accepted standard for digital cellular communication. GSM is the name of a standardization group established in 1982 to create a common European mobile telephone standard that would formulate specifications for a panEuropean mobile cellular radio system operating at 900 MHz. A GSM modem is a wireless modem that works with a GSM wireless network. A wireless modem behaves like a dial-up modem. The main difference between them is that a dial-up modem sends and receives data through a fixed telephone line while a wireless modem sends and receives data through radio waves. A GSM modem can be an external device or a PC Card / PCMCIA Card. Typically, an external GSM modem is connected to a computer through a serial cable or a USB cable. A GSM modem in the form of a PC Card / PCMCIA Card is designed for use with a laptop computer. It should be inserted into one of the PC Card / PCMCIA Card slots of a laptop computer. Like a GSM mobile phone, a GSM modem requires a SIM card from a wireless carrier in order to operate. As mentioned in earlier sections of this SMS tutorial, computers use AT commands to control modems. Both GSM modems and dial-up modems support a common set of standard AT commands. You can use a GSM modem just like a dial-up modem. In addition to the standard AT commands, GSM modems support an extended set of AT commands. These extended AT commands are defined

in the GSM standards. With the extended AT commands, you can do things like:

Reading, writing and deleting SMS messages. Sending SMS messages. Monitoring the signal strength. Monitoring the charging status and charge level of the battery. Reading, writing and searching phone book entries.

The number of SMS messages that can be processed by a GSM modem per minute is very low -- only about six to ten SMS messages per minute. GSM AT COMMANDS AT AT&D0 AT+IFC=00 AT+CMGF=1 AT+CNMI=22000 AT commands features 1. Setting up your GSM modem Most GSM modems comes with a simple manual and necessary drivers. To setup your T-ModemUSB, download the USB GSM Modem Quick Start ( Windows ) guide (460kB PDF). You would be able to send SMS from the Windows application and also setup GPRS connectivity. The GSM modem will map itself as a COM serial port on your computer.

Windows based control panel to setup GSM modem, GPRS and send SMS


Using the HyperTerminal

Hint :: By developing your AT commands using HyperTerminal, it will be easier for you to develop your actual program codes in VB, C, Java or other platforms. Go to START\Programs\Accessories\Communications\HyperTerminal (Win 2000) to create a new COM connection, Port :: eg. "My As USB indicated GSM in Modem". the Suggested settings :: T-Modem Control Tool

- Bits per second :: 230400 ( or slower ) -Data Bits : 8

- Parity : None-

StopBitsFlowControl: HardwareYou are now ready to start working with AT commands. Type in "AT" and you should get a "OK", else you have not setup your HyperTerminal correctly. Check your port settings and also make sure your GSM modem is properly connected and the drivers installed.

3. Initial setup AT commands We are ready now to start working with AT commands to setup and check the status of the GSM modem. AT AT+CPIN="xx xx" AT+CREG? Returns a "OK" to confirm that modem is working To enter the PIN for your SIM ( if enabled ) A "0,1" reply confirms your modem is connected to GSM network


Indicates the signal strength, 31.99 is maximum.

4. Sending SMS using AT commands We suggest try sending a few SMS using the Control Tool above to make sure your GSM modem can send SMS before proceeding. Let's look at the AT commands involved .. AT+CMGF=1 To format SMS as a TEXT message

AT+CSCA="+xx Set your SMS center's number. Check with xxx" your provider.

To send a SMS, the AT command to use is AT+CMGS.. AT+CMGS="+yyyyy"<Enter>> Your SMS text message here <Ctrl-Z> The "+yyyyy" is your receipent's mobile number. Next, we will look at receivingSMSviaATcommands. 5. Receiving SMS using AT commands The GSM modem can be configured to response in different ways when it receives a SMS. a) Immediate - when a SMS is received, the SMS's details are immediately sent to the host computer (DTE) via the +CMT command AT+CMGF=1 To format SMS as a TEXT message

AT+CNMI=1,2,0, Set how the modem will response when a 0,0 SMS received

When a new SMS is received by the GSM modem, the DTE will receive the following +CMT : "+61xxxxxxxx" , , "04/08/30,23:20:00+40" This the text SMS message sent to the modem Your computer (DTE) will have to continuously monitor the COM serial port, read and parse the message. b) Notification - when a SMS is recieved, the host computer (DTE) will be notified of the new message. The computer will then have to read the

message from the indicated memory location and clear the memory location. AT+CMGF=1 To format SMS as a TEXT message

AT+CNMI=1,1,0, Set how the modem will response when a SMS 0,0 is received

When a new SMS is received by the GSM modem, the DTE will receive the following .. Notification sent to the computer. Location 3 in SIM memory AT command to send read the received SMS from modem

+CMTI: "SM",3 AT+CMGR=3 <Enter>

The modem will then send to the computer details of the received SMS from the specified memory location ( eg. 3 ) +CMGR: "REC READ","+61xxxxxx",,"04/08/28,22:26:29+40" This command is to the clear new the SMS memory received location by in the the GSM GSM modem modem..

After reading and parsing the new SMS message, the computer (DTE) should send a AT AT+CMGD=3 <Enter> To clear the SMS receive memory location in the GSMmodem If the computer tries to read a empty/cleared memory location, a +CMS ERROR: 321 will be sent to the computer


In this project GSM Modem is interfaced with the microcontroller through rs232 interface. Since the voltage levels of the microcontroller are different with that of the GSM modem we use a voltage converter or the line driver such as MAX232 to make them rs232 compatible. GSM and GPS both communicate through UART. Since microcontroller has only one inbuilt UART a multiplexer is used to interface GSM and GPS to the microcontroller. RS232 The most popular serial communication standard for asynchronous communications is RS-232 (Recommended Standard 232. This specifies the rule of how different connected devices communicate. The connected devices can either be terminals or communication equipments commonly referred as DTE & DCE. According to RS232 interface, it requires only 3 lines i.e. Rx, Tx & Ground when compared to the bunch of connectors required for parallel









establish, serial communication is preferred based on the costs for the communication lines. The EIA (Electronics Industry Association) RS232C Standard specifies & suggests a maximum baud rate of 20,000bps, and RS232D is an advanced version of the same, which allows 1.5 Mbps. The connectors specified are D-TYPE 25 pin connector and D-TYPE 9 pin connector. D-Type-25 pinPin outs no. 3 2 7 8 6 5 1 4 9 2 3 4 5 6 7 8 20 22 RD TD RTS CTS DSR SG DCD DTR RI Receive Data (Serial data input) Transmit Data (Serial data output) Request to send (acknowledge to modem that UART is ready to exchange data Clear to send (i.e.; modem is ready to exchange data) Data ready state (UART establishes a link) Signal ground Data Carrier detect (This line is active when modem detects a carrier Data Terminal Ready. Ring Indicator (Becomes active when modem detects ringing signal from PSTN Function


According to RS232 specifications, the logic 1 and logic 0 are called as mark & space. The signal voltage levels are specified as mark should be in the range of -3 to -15 volts and space should be in the range of 3 to 15 volts. The modern low power consuming CMOS devices use different logic levels than the RS232 line specification. The logic levels of CMOS devices are in the range of 3.3v-5.5v for 1 and -0.3v to 0.8v for 0. Therefore when communicating with such CMOS/TTL devices, the logic levels need to be converted RS232 INTERFACED TO MAX 232

J2 9 8 7 6 5 4 3 2 1 16 U3 T1O U T T XD P 3 .1 C4 5V C 0 . 51 u f C6 0 .1 u f 0 .1 u f C7 0 .1 u f M A X3232 15 13 8 10 11 1 3 4 5 2 6 R 1 IN R 2 IN T 2 IN T 1 IN C C C C 1+ 12+ 2GND C1 1uf R 1O U T R 2O U T T1O U T T2O U T 12 9 14 7 P 3 .0 R XD T1O U T

V+ V-


Rs232 is 9 pin db connector, only three pins of this are used ie 2, 3, 5 the transmit pin of rs232 is connected to rx pin of microcontroller MAX232: MAX232 is used to convert TTL logic into 0/1 logic and vice versa.So it is placed between Microcontroller and Serial Port for convertion. PIN DIAGRAM:


MAX232 is compatible with RS-232 standard, and consists of dual transceiver. Each receiver converts TIA/EIA-232-E levels into 5V TTL/CMOS levels. Each driver converts TTL/ COMS levels into TIA/EIA-232-E levels. Features: Input voltage levels are compatible with standard MOS levels Output voltage levels are compatible with EIA/TIA-232-E levels Single Supply voltage: 5V Low input current: 0.1A at A= 25 Output current: 24mA Latching current not less than 450mA at A= 25 The transmitter outputs and receiver inputs are protected to +/-15kV Air ESD

Applications; Battery-Powered RS232 Systems Terminals Modems


MAX232 is connected to the microcontroller as shown in the figure above 17, 18 pins are connected to the TX and RX pin i.e. transmit and receive pin of microcontroller


An LCD or a liquid crystal display consists of liquid crystals between electrodes. The arrangement consists of polarization filters which are aligned perpendicular to each other.

This arrangement doesnt allow any visible light if there was no liquid crystal between the filters. This arrangement is aligned in between transparent conductors. When sufficient voltage is applied to a certain pixel, the crystal at that pixel aligns such that no light passes through it. Therefore that particular pixel appears dark. If such an electric field is applied for a longer period, the alignment of the crystal change, and the quality of LCD degrades. In a bigger LCD display, to provide voltage sources to each pixel, the rows and column lines are multiplexed. PIN DESCRIPTION OF THE LCD:



LCDs connected to the 8051 are 16x2 displays. This means 16 characters per line by 2 lines.

EN, RS, and RW (4,5&6 Pins) These three pins are referred as Control lines The 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. The 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. The 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.


Applications: The most common application of liquid crystal technology is in liquid crystal displays (LCDs). From the ubiquitous wrist watch and pocket calculator to an advanced VGA computer screen, this type of display has evolved into an important and versatile interface.

The LCD is generally interfaced in 8-bit mode or 4-bit mode. in this project LCD is connected in 4-bit mode the interface connections of LCD with microcontroller are as follows RS of LCD is connected to p0.0 of microcontroller EN of LCD is connected to p0.1 of microcontroller D4 of LCD is connected to p0.4 of microcontroller D5 of LCD is connected to p0.5 of microcontroller D6 of LCD is connected to p0.6 of microcontroller D7 of LCD is connected to p0.7 of microcontroller In 8-bit mode, the complete ASCII code is sent at once along with the control signals. But in 4-bit mode, the data is divided into two parts, i.e. MSB & LSB, and are called upper nibble & lower nibble. The control signals are RS, R/W & E. RS is used to select the internal registers i.e. data register & command register. R/W is used to set the mode of LCD to read mode or write mode. E is used as chip select and is used to push the data internally to the corresponding registers. To transfer the data/command in 8-bit mode, the data is written to the 8-bit data bus after selecting the required register and setting the mode to write mode. The E signal pin is then given a high to low signal to transfer the data.

To transfer the data/command in 4-bit mode, the higher nibble is first written to the MSB of the data port and the E is given a high to low signal. After a little delay or when the LCD is not busy, the lower nibble is transferred in the same procedure.



These sensor consist of only a pair of IR photo transistor and receiver LEDs enclosed in a specially designed plastic dome housing and cable with stereo jack plug. The probe dome alone does not have any other circuit . To use the probe you must have some suitable application circuit or compatible pulse rate monitor.

The technical data of probe dome is given above for comparison .

APR 9301:

Single-Chip Voice Recording & Playback Device for Single 20 to 30 Second Message

General Description:

The APR930 1 device offers true single-chip solid-state storage capability and requires no software or microcontroller support. It provides high-quality recording and playback with a single 20- to 30-second message. It is ideal for portable voice recorders, toys, and many other consumer and industrial applications. APLUS integrated analog/multi-level storage technology is implemented in advanced Flash non-volatile memory cells, each of which can typically store more than 256 voltage levels. The APR93 0 1 device stores and reproduces voice signals in their natural forms, eliminating the distortion that is often introduced by encoding and compression. The device combines a small size with low power consumption, nonvolatility, and ease-of-use for a cost effective solution to voice recording and playback. Features Single-chip, high quality voice recording & playback solution

- No external ICs required - Minimum external components Non-volatile Flash memory technology - No battery backup required - 100K record cycles (typical) - 100-year message retention (typical) Single message of 20 to 30 seconds, with external resistor selection. User-friendly, easy-to-use operation - Programming & development systems not required - Level-activated recording & edge-activated playback switches Low power consumption - Operating current: 25 mA (typical, no load) - Standby current: 1 mA (typical, no load) Automatic power-down feature for longer battery life Chip enable pin for simple message expansion Single 5 V power supply Sample Application Figure 3 shows the diagram for a single, 20-second message recording and playback application using theAPR9301 device. When pins are connected as shown in this example, the operating modes are as follows: Record Mode (Level-Activated) A single voice message of up to 20 seconds can be recorded. The /LED pin will go low during the actual recording process to provide a visual indication if an LED light is connected to

this pin. The chip is in record mode as long as the /RecL pin stays low (levelactivated). If the message lasts longer than 20 seconds, recording will terminate automatically after the last available memory cell is written. If the message is shorter than 20 seconds, the recording operation will stop when the the /RecL pin goes high. The speaker driver is automatically tristated during the recording operation. Messages of up to 30 seconds can be recorded by using different OscR resistor values (see Table 1). Playback Mode (Edge-Activated) Playback always starts from the beginning of the message. The chip is in playback mode after the /PlayE pin pulses low (edge-activated). Playback will stop immediately when the /PlayE pin pulses low a second time. If the newly recorded message is shorter than the previously recorded message, the remaining portion of the previous message will not be played after the new message is played back. The input preamplifier, AGC, and main amplifier circuits are disabled during playback. Standby Mode (/CE = "0") The chip will automatically return to the standby state after recording or playback operation is completed. Power Down Mode (/CE = "1") The chip is always in standby state. No recording or playback is allowed. Current consumption is typically less than 1 mA.


CHAPTER-5 Software implementation 5.1 RIDE

Please note that in this page RIDE will reference to RIDE6 software which supports 8051, XA and other derivates. For ARM, ST7 and STM8 family the software is RIDE7. RIDE is a fully featured Integrated Development Environment (IDE) that provides seamless integration and easy access to all the development tools. From editing to compiling, linking, debugging and back to the start, with a Simulator, ICE, Rom Monitor or other debugging tools, RIDE conveniently manages all aspects of the Embedded Systems development with a single user interface.

Fig: RIDE Multi-file Editor RIDE is based on a fast multi-document editor designed to meet the specific needs of programming. The various methods, menus, commands, and shortcuts are all fully compliant with the Microsoft specifications for Windows 2000, XP and NT. Classic commands, such as string search and block action are integrated. Advanced features such as Matching Delimiter (parenthesis, brackets), Grep (multi-file search) and Indenter are integrated as well. The customizable color-highlighting feature is very useful to indicate specific syntactic elements as they appear in the source file: keywords, comments, identifiers, operators, and so

on. The color-highlighting feature is automatically keyed to the intrinsic file type (which means, it works differently for C and assembler).This permits the user to identify quickly and easily those parts of the code responsible for syntax errors. - top Project Manager: The project manager creates links between the various files that includes a project and the tools necessary to create that project. A project is dedicated to a particular target: 8051, XA, or other microcontrollers. The linker manages object and library files, and output format conversion as necessary.

Fig Project Manager Tree-structured projects ease the management of the most complex applications (bank switching, flash, multi-processor, multi-module...). The Project Make command directs the integrated "make" utility to build or rebuild the target programs for the current project. To avoid wasting time, each source file will be translated by its associated tool only if any of its dependencies are found to be out of date. Dependency analyses, even directly or indirectly included files, are automatic. Options can be defined as global (for all the files) or as local (for a specific node or file). Individual attributes can be set for any file in the project. Similarities between the different tools make migration from one processor family to another immediate and easy, permitting multi-processor projects.

The Message Window and the On-line Help: The message window displays all warning, error, and progress messages generated during the processing of files associated with each project. Clicking on an error string in the message window automatically positions the cursor at the point of that error in the source code window. The Online help system is context-sensitive and provides information on nearly all aspects of RIDE. A specific help file is supplied with each tool driven by the IDE ('C' Compiler, Assembler, Linker, and RTOS). Online menu hints appear on the status line whenever you select a menu command.

Fig Message The Script Language: Most RIDE commands can be run from a script file. Scripts are written in a C-like language, and are interpreted at execution time. With the script language, most repetitive tasks can be done automatically thus speeding up operations and reducing the probability of errors. Scripts are very useful for Hardware Testing (board, emulator) and to initialize the system to a known status, but can also be conveniently used for other tasks such as creating very complex breakpoints or redirecting some output to a file to run a 'batch' debug session. Context Saving:

When a project is closed, the whole associated context is saved (open file list, window size and position etc.). Settings associated with the debugger are also saves such as breakpoints, watches etc... Integrated High-level Debug: RIDE provides a fully integrated source-level debugging environment. All information necessary is derived from the translators used to accomplish each step of the process. This includes mundane aspects such as "path names", and source code specific information such as details of complex data types. With the simple click of a mouse button, the user can select among several powerful capabilities: simulate, monitor, or emulate. The fast smooth integration given by RIDE promotes a feeling of familiarity and ease of use, while providing a level of comfort and efficiency that reduces the most difficult and complex applications to tasks that are easily managed. This seamless progression of the "code-translate-link-debug-test" cycle is the result of perfect communication between the programming tools and the debugger. This is the heart of RIDE.

Fig : Debugger Integral Simulation: RIDE includes simulation engines for most 8051, and XA derivatives. The simulator/debugger is cleanly integrated into the presentation Windows. A wide range of 'views' can be selected to provide flexible direct examination of all memory spaces as well

the all internal peripherals. The simulation engines perform detailed and faithful simulations (including IDLE or Power down modes), of all peripherals (including interrupt and watchdog events) present on the selected component. Advanced Features RIDE provides a rich variety of 'views' into an application. These views or windows are associated with control commands like complex breakpoints or high level trace recording. - top 4.2 ISP 3.0 Introduction This ISP Programmer can be used either for in-system programming or as a standalone spi programmer for Atmel ISP programmable devices. The programming interface is compatibe to STK200 ISP programmer hardware so the users of STK200 can also use the software which can program both the 8051 and AVR series devices. Hardware The power to the interface is provided by the target system. The 74HCT541 IC isolates and buffers the parallel port signals. It is necessary to use the HCT type IC in order to make sure the programmer should also work with 3V type parallel port. The printer port buffer interface is same as shown in figure 1.For the ucontrollera40pinZIFsocketcanbe used. This programmer circuit can be use to program the 89S series devices and the AVR series device switches are pin compatible to 8051, like

90S8515. For other AVR series devices the user can make an adapter board for 20, 28 and 40 pin devices. The pin numbers shown in brackets correspond to PC parallel port connector. Software The file contains the main program and the i/o port driver. Place all files in the same folder. The main screen view of the program is shown in figure 3. Also make sure do not program the RSTDISBL fuse in ATmega8, ATtiny26

and ATtiny2313 otherwise further spi programming is disable and you will need a
parallel programmer to enable the spi programming. For the fuses setting consult

the datasheet of the respective device. For the auto hardware detection it is necessary to short pin 2 and 12 of

DB25connector, otherwise the software uses the default parallel port i.e. LPT1. Following are the main features of this software, Read and write the Intel Hex file. Read signature, lock and fuse bits. Clear and Fill memory buffer. Verify with memory buffer. Reload current Hex file. Display buffer checksum. Program selected lock bits & fuses.

Auto detection of hardware. Note: The memory buffer contains both the code data and the for the devices which have eeprom memory. The eeprom eeprom data address


in buffer is started after he code memory, so it is necessary the hex file should contains the eeprom start address after the end of code memory last address i.e. for 90S2313 the start address for eeprom memory is 0x800.

The software erase

does the








s function is performed automatically during device programming. If you are required to controller, first use the clear buffer command then program the controller, this will erase the controller and also set the AVR device fuses to default setting.

Fig Main screen of the program ISP-Pgm Ver 3.0a 4.3 EMBEDDED C Ex: Hitec c, Keil c HI-TECH Software makes industrial-strength software development tools and C compilers that help software developers write compact, efficient embedded processor code. For over two decades HI-TECH Software has delivered the industry's most reliable embedded software development tools and compilers for writing efficient and compact code to run on the most popular embedded processors. Used by tens of thousands of customers including General Motors, Whirlpool, Qualcomm, John Deere and many others, HI-TECH's

reliable development tools and C compilers, combined with world-class support have helped serious embedded software programmers to create hundreds of breakthrough new solutions. Whichever embedded processor family you are targeting with your software, whether it is the ARM, PICC or 8051 series, HI-TECH tools and C compilers can help you write better code and bring it to market faster. HI-TECH PICC is a high-performance C compiler for the Microchip PIC micro 10/12/14/16/17 series of microcontrollers. HI-TECH PICC is an industrial-strength ANSI C compiler - not a subset implementation like some other PIC compilers. The PICC compiler implements full ISO/ANSI C, with the exception of recursion. All data types are supported including 24 and 32 bit IEEE standard floating point. HI-TECH PICC makes full use of specific PIC features and using an intelligent optimizer, can generate high-quality code easily rivaling hand-written assembler. Automatic handling of page and bank selection frees the programmer from the trivial details of assembler code. Embedded C Compiler ANSI C - full featured and portable. Reliable - mature, field-proven technology. Multiple C optimization levels. An optimizing assembler. Full linker, with overlaying of local variables to minimize RAM usage. Comprehensive C library with all source code provided. Includes support for 24-bit and 32-bit IEEE floating point and 32-bit long data types. Mixed C and assembler programming. Unlimited number of source files. Listings showing generated assembler.




MPLAB IDE, MPLAB ICD and most 3rd-party development tools.

Runs on multiple platforms: Windows, Linux, UNIX, Mac OS X, and Solaris. Embedded Development Environment. PICC can be run entirely from the. This environment allows you to manage all of your PIC projects. You can compile, assemble and link your embedded application with a single step. Optionally, the compiler may be run directly from the command line, allowing you to compile, assemble and link using one command. This enables the compiler to be integrated into third party development environments, such as Microchip's MPLAB IDE.

REFERENCES: 1. The 8051 micro controller and embedded systems by Mazidi. 2.
3. 4.

5. Embedded systems with 8051 by kenith j ayala