You are on page 1of 117

Table of Contents

1.Introduction 2. Literature survey 3.Formation of the Problem 4.System specification 5.Design of solution 6.Implementation 7.Results and Discussions 8.System testing 9.Conclusion and future scope 10.References

ABSTRACT: The main aim of this project is develop an intelligent ambulance which will reach the hospitals without any problem in heavy traffics. INTRODUCTION: This particular project is designed for the cities with heavy traffic. Eg: In Bangalore the roads are full jammed every time. Most of the time the traffic will at least for 100meters .In this distance the traffics police can¶t hear the siren form the ambulance .so he ignores this .Then the ambulance has to wait till the traffic is left. Some times to leave the traffic it takes at least 30 minutes .So by this time anything can happen to the patient .So this project avoid these disadvantages. According to this project, if any ambulance comes near or when the ambulance at emergency comes to any traffic post the traffic signals automatically stop the signals and give green signal for this ambulance. COMPONENTSUSED:
Power Supply - 12V/1A DC Micro controller ± AT89C51 Buzzer - 5Vdc Light Emitting Diode (LED) RF transmitter & receiver IR Transmitter and Receiver

Keil uVision3 Embedded c

When the ambulance at emergency comes to any traffic post the traffic signals automatically stop the signals and give green signal for this ambulance. The ambulance carries an IR transmitter and IR receiver will be there some few meter before the signal. The receiver will receive the signal and the module will send the command turn on green through the RF and every traffic post will have an RF receiver. So whenever the ambulance comes near the traffic, the ambulance will transmit a code say ³emergency´ the receiver will receive this signal .Then it immediately switch off the other signals that is it make all the signals red and later make this particular direction signal green. So by doing this the ambulance can go without any problem.

BLOCK DIAGRAM: Module in Ambulance

Power Supply
Trans former Rectifie r Regulator


16X2 LCD

RF encoder



Block diagram: Traffic post Power Supply Trans former Rectifier Regulator (7805) Filter 16X2 LCD RF Receiver RF Decoder GREEN LED AT89C51 MCU RED LED YELLOW LED .


such as a personal computer. reducing the size and cost of the product. to very high with multiple units. to large stationary installations like traffic lights. In contrast. as many systems have some element of programmability. embedded systems range from portable devices such as digital watches and mp4 players. or the systems controlling nuclear power stations. benefiting from economics of scale. because they allow different applications to be loaded and peripherals to be connected Every embedded system consists of custom-built hardware built around a Central Processing Unit (CPU). This hardware also contains memory chips onto which the software is loaded. a general-purpose computer. It is usually embedded as part of a complete device including hardware and mechanical parts.1 Embedded Systems An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions.CHAPTER 2 Literature survey 2. Embedded systems control many of the common devices in use today. Since the embedded system is dedicated to specific tasks. In general. peripherals and networks mounted inside a large chassis or enclosure. Physically. The software residing on . Complexity varies from low. often with real-time computing constraints. or increasing the reliability and performance. handheld computers share some elements with embedded systems ² such as the operating systems and microprocessors which power them ² but are not truly embedded systems. Some embedded systems are mass-produced. factory controllers. with a single microcontroller chip. can do many different tasks depending on programming. "embedded system" is not an exactly defined term. For example. design engineers can optimize it.

For small appliances such as remote control units. . In such a case. Many embedded systems consist of small. you need to integrate the application software with the operating system and then transfer the entire software on to the memory chip. for reasons such as safety and usability. The program instructions written for embedded systems are referred to as firmware. Similarly. an embedded system in automobiles provides a specific function as a subsystem of the car itself. but the overall purpose of the Robot Guitar is. small or non-existent keyboard and/or screen. The operating system runs above the hardware. 2. allowing the system hardware to be simplified to reduce costs. computerized parts within a larger device that serves a more general purpose. to play music. The same architecture is applicable to any computer including a desktop computer. the software will continue to run for a long time you don¶t need to reload new software. It is not compulsory to have an operating system in every embedded system. there are significant differences.the memory chip is also called the µfirmware¶.2 Characteristics 1. The embedded system architecture can be represented as a layered architecture as shown in Fig. For example. Some also have real-time performance constraints that must be met. For applications involving complex processing. and the application software runs above the operating system. They run with limited computer hardware resources: little memory. Once the software is transferred to the memory chip. it is advisable to have an operating system. However. Embedded systems are designed to do some specific task. 2. of course. toys etc. and are stored in read-only memory or flash memory chips. rather than be a general-purpose computer for multiple tasks. air conditioners. 3. the features an embedded system for tuning the strings. there is no need for an operating system and you can write only the software specific to that application. others may have low or no performance requirements. Embedded systems are not always standalone devices..

Born of parallel developments in computer architecture and integrated circuit fabrication . semiconductor firms soon followed Intel¶s pioneering technology so that by the late 1970¶s we could choose from a half dozen or so micro processor typThe 1970s also saw the growth of the number of personal computer users from a Handful of hobbyists and hackers to millions of business. Besides. Among the applications of a micro controller we can mention industrial automation. nowadays. industrial. A bye product of microprocessor development was the micro controller. Other. well established. mobile telephones. is an indispensable device for electrical/electronic engineers and also for technicians in the area. radios. defense.with the introduction of the 4 bit 4004 by a small. .Figure 2. because of its versatility and its enormous application. The same fabrication techniques and programming concepts that make possible general-purpose microprocessor also yielded the micro controller.3 Micro Controllers The micro controller. the present trend in digital electronics is toward restricting to micro controllers and chips that concentrate a great quantity of .the microprocessor or computer on chip first becomes a commercial reality in 1971. microwave ovens and VCRs. governmental. and educational and private users now enjoying the advantages of inexpensive computing.1 A typical embedded system block diagram 2. unknown company by the name of Intel corporation.

A modern communications system is first concerned with the sorting. Radio communication became the most widely used and refined through the invention of and use of transistor. planning and use. the micro controller is the best solution. broadcast. the ability to program an 8051 is an important skill for anyone who plans to develop products that will take advantage of micro controllers. the use of satellites and fiber optics has made communication even more wide spread. computer communications. In this context. The actual transmission then follows. In dedicated systems. Despite it¶s relatively old age. because it is cheap and easy to manage. it started with wire telegraphy in the early 80¶s. since they can always affect its design. integrated circuit. receiving and processing of information by electric means.3 Communication: Communication refers to the sending. and other semi-conductor devices. It is also important to consider the human factors influencing a particular system. As such. Many derivative micro controllers have since been developed that are based on--and compatible with--the 8051. the 8051 is one of the most popular micro controllers in use today. 2. like PLDs (Programmable Logic Devices) and GALs (Gate Array Logic). Most recently. telephony and telegraphy. point to point and mobile communications (commercial and military). radio telemetry and radio aids to navigation. . processing and storing of information before its transmission.logical circuits. with an increasing emphasis on computer and other data communications. developing with telephony and radio some decades later.All the controllers belongs to 8051 architecture follow harward architecture and CISC design. forms of communications include radio. radar.In 8051 architecture there are so many controllers developed by different semiconductor companies. storage and interpretation.Here we are going to use the controller manufactured by Atmel semiconductors which is AT89C51. which may include processing steps such as decoding. Finally we have reception. Thus. with further processing and the filtering of noise.

Unfortunately. Lately. infrared.4 IR Remote Theory The cheapest way to remotely control a device within a visible range is via Infra-Red light. there are few adorable environments available for development and classroom use. so students often do not learn about these technologies during hands-on lab exercises. Infra-Red actually is normal light with a particular colour. Engineers who have knowledge of embedded systems and wireless communications will be in high demand. These embedded communications devices will be integrated into applications ranging from homeland security to industry automation and monitoring. optical fiber. we want to use it but we're not interested in seeing it. creating a revolutionary way of disseminating and processing information. After this combination we are connecting the DARLINGTON PAIR TRANSISTOR." Technology advancements are providing smaller and more cost effective devices for integrating computational processing. thus making it ideal for us hobbyists to use IR control for our own projects. and generally wireless radio. At last this entire connector is connected to any one external interrupt to generating the interruption of the main program. End of the IR sensor we have to connect a NOT gate for the inverting purpose means low input have corresponding low output. Another reason is because IR LEDs are quite easy to make. There are now more mobile phone subscriptions than wired-line subscriptions. . They will also enable custom tailored engineering solutions. and short-distance wireless communication used for personal wireless networks. 2. and a host of other functionalities. That's one of the reasons why IR is chosen for remote control purposes.Wireless communication has become an important feature for commercial products and a popular research topic within the last ten years. one area of commercial interest has been low-cost. The communication mediums were twisted pair. and the need for employees in these technological areas. and therefore can be very cheap. Almost all audio and video equipment can be controlled this way nowadays. lowpower. With new technologies and devices come new business activities. Due to this wide spread use the required components are quite cheap. wireless communication. We humans can't see this colour because its wave length of 950nm is below the visible spectrum. IR sensor is the combination of IR LED with PHOTO DIODE.

Ge. the shorter the wavelength. Imagine an RF transmitter wiggling an electron in one location. RF usually refers to oscillations in electrical circuits or electromagnetic radiation RF communication works by creating electromagnetic waves at a source and being able to pick up those electromagnetic waves at a particular destination. The wavelength for a 900 MHz device is longer than that of a 2.Si. 2. GaAs.IR LED wave length range 1. megahertz (MHz or millions of cycles per second) and gigahertz (GHz or billions of cycles per second). The effect is an electromagnetic (EM) wave that travels out from the initial location resulting in electrons wiggling in remote locations. These IR s are not visible range for observation purpose we have to connect LED s are not. The wavelength of an electromagnetic signal is inversely proportional to the frequency.4 GHz device. Frequency is measured in Hertz (cycles per second) and radio frequencies are measured in kilohertz (KHz or thousands of cycles per second).5 RF Technology Radio frequency (RF) is a frequency or rate of oscillation within the range of about 3 Hz to 300 GHz.6m to 2. Since most of this range is beyond the vibration rate that most mechanical systems can respond to. This range corresponds to frequency of alternating current electrical signals used to produce and detect radio waves. somewhat akin to dropping a pebble in a pond. signals with longer wavelengths travel a greater distance and penetrate through. In general. and around objects better than signals with shorter wavelengths. CdSe .4m. . the higher the frequency. An RF receiver can detect this remote electron wiggling. This wiggling electron causes a ripple effect. These electromagnetic waves travel through the air at near the speed of light. Materials used for IR LED are InSB. Higher frequencies result in shorter wavelengths.

The receiver can make this same information available at a remote location. In order to accurately compute range ± it is essential to understand a few terms: dB . The conversion formula for it is Power in dBm = 10* (log x) where x is the power in milliwatts.Decibels Decibels are logarithmic units that are often used to represent RF power. This area must be clear or else signal strength will weaken. milliwatts or dBm.) Receiver sensitivity . communicating with no wires. In. Line-of-site (LOS) Line-of-site when speaking of RF means more than just being able to see the receiving antenna from the transmitting antenna. houses or the ground) can be in the Fresnel zone. a designer has two overriding constraints: it must operate over a certain distance (range) and transfer a certain amount of information within a time frame (data rate). In most wireless systems. Transmit power is usually measured in Watts. The Fresnel zone is the area around the visual line-of-sight that radio waves spread out into after they leave the antenna.The RF communication system then utilizes this phenomenon by wiggling electrons in a specific pattern to represent information. There are essentially two parameters to look at when trying to determine range. (For conversion between watts and dB see below. Transmit Power Transmit power refers to the amount of RF power that comes out of the antenna port of the radio. To convert from watts to dB: Power in dB = 10* (log x) where x is the power in watts. Then the economics of the system must work out (price) along with acquiring government agency approvals (regulations and licensing). order to have true line-of-site no objects (including trees. Another unit of measure that is encountered often is dBm (dB milliwatts).

less distortions and no interference. It is convenient to use an example with sound waves. Higher data rates allow the communication to take place in less time. Example: Maxstream 9XStream TX Power: 20dBm Maxstream 9XStream RX Sensitivity: -110dBm Total Link budget: 130dBm. For non line-of-site applications range calculations are more complex because of the various ways the signal can be attenuated. Transmit power is how loud someone is yelling and receive sensitivity would be how soft a voice someone can hear. RF is widely used because it does not require any line of sight. The link budget is the total amount of signal attenuation you can have between the transmitter and receiver and still have communication occur. . RF usually refers to oscillations in electrical circuits. a mathematical formula can be used to figure out the approximate range for a given link budget. Data rates are usually dictated by the system . This means about 30% more distance in line-of-sight conditions. Lower data rates. potentially using less power to transmit. allow the radio module to have better receive sensitivity and thus more range. PROPERTIES OF RF: .Receiver sensitivity refers to the minimum level signal the radio can demodulate. WHAT IS THE NEED FOR RF? Radio frequency is a frequency or rate of oscillation within the range of about 3 Hz to 300 GHz. This range corresponds to frequency of alternating current electrical signals used to produce and detect radio waves Since most of this range is beyond the vibration rate that most mechanical systems can respond to. Transmit power and receive sensitivity together constitute what is know as ³link budget´.how much data must be transferred and how often does the transfer need to take place. For line-of-site situations. In the XStream modules the 9600 baud module has 3dB more sensitivity than the 19200 baud module.

000 km to 10. known as the skin effect. communication with mines .000 km directly audible when converted to sound. communication with submarines Super low frequency SLF 30 to 300 Hz 1.000 km directly audible when converted to sound. One such property is the ease with which it can ionize air to create a conductive path through air.000 km directly audible when converted to sound. Another special property is an electromagnetic force that drives the RF current to the surface of conductors. The degree of effect of these properties depends on the frequency of the signals. AC power grids (50 hertz and 60 hertz) Ultra low frequency ULF 300 to 3000 Hz 100 km to 1. like the dielectric insulator of a capacitor. DIFFERENT RANGES PRESENT IN RF AND APPLICATIONS IN THEIR RANGES? Extremely low frequency ELF 3 to 30 Hz 10.Electrical currents that oscillate at RF have special properties not shared by direct current signals. This property is exploited by 'high frequency' units used in electric arc welding. Another property is the ability to appear to flow through paths that contain insulating material.000 km to 100.

maritime and aviation communication High frequency HF 3 to 30 MHz 10 m to 100 m Shortwave. or "ultrasound" 20-30+ kHz) Low frequency LF 30 to 300 kHz 1 km to 10 km AM broadcasting. 18-20 kHz.Very low frequency VLF 3 to 30 kHz 10 km to 100 km directly audible when converted to sound (below ca. AM broadcasting. lowFER Medium frequency MF 300 to 3000 kHz 100 m to 1 km navigational beacons. amateur radio. navigational beacons. citizens' band radio Very high frequency VHF 30 to 300 MHz .

mobile telephones. GPR Ultra high frequency UHF 300 to 3000 MHz 10 cm to 100 cm Broadcast television. cordless telephones. satellite links. wireless networking. microwave ovens. Longer range. remote sensing. Satellite television. 2. radio astronomy. door openers. . 3. advanced weapons systems. aviation. No line of sight is needed. microwave links.1 m to 10 m FM broadcasting broadcast television. advanced security scanning WHY DO WE GO FOR RF COMMUNICATION? RF Advantages: 1. Not blocked by common materials: It can penetrate most solids and pass through walls. Extremely high frequency EHF 30 to 300 GHz 1 mm to 10 mm Microwave data links. GPR Super high frequency SHF 3 to 30 GHz 1 cm to 10 cm Wireless networking. remote keyless entry for automobiles.

It is not much sensitive to the environmental changes and weather conditions.. and thus GSM is considered a second generation (2G) mobile phone system. The GSM Association. RF Disadvantages: 1. Interference: communication devices using similar frequencies .7 GSM Technology GSM (Global System for Mobile Communications: originally from Groupe Spécial Mobile) is the most popular standard for mobile telephony systems in the world. Lack of security: easier to "eavesdrop" on transmissions since signals are spread out in space rather than confined to a wire 3. scanners.It is a globally accepted standard for digital cellular communication. various systems have been developed without the benefit of standardized specification. GSM differs from its predecessor technologies in that both signaling and speech channels are digital. 5. GSM is the name of standardization group established in 1982 to create a common European mobile telephone standard that would formulate specifications for a pan-European mobile cellular radio system operating at 900MHZ. Throughout the evolution of cellular telecommunications. It is not sensitive to the light. estimates that 80% of the global mobile market uses the standard. providing subscribers the use of their phones in many parts of the world. Federal Communications Commission(FCC) licenses required for some products 5.GSM is used by over 2 billion people across more than 212 countries and territories.Its ubiquity enables international roaming arrangements between mobile phone operators. wrist radios and personal locators can interfere with transmission 2. Higher cost than infrared 4.wireless phones. This also facilitates the wide-spread implementation of data communication applications into the system. Lower speed: data rate transmission is lower than wired and infrared transmission 2. its promoting industry trade organization of mobile phone carriers and manufacturers.4. This presented many problems directly .

GSM-History ‡ Developed by Group Special Mobile (founded 1982) which was an initiative of CEPT (Conference of European Post and Telecommunication) . GSM-Introduction Architecture Technical Specifications Frame Structure Channels y Security y Characteristics and features y Applications Definition: Global System for Mobile (GSM) is a second generation cellular standard developed to cater voice services and data delivery using digital modulation.related to compatibility. especially with the development of digital radio technology. The GSM standard is intended to address these problems.

Australia. GSM IN WORLD Figures: March. Europe. 2005 3% 3% (INDIA) 4% 3% 3% 37% 4% Arab World Asia Pacific Africa East Central Asia Europe Russia India North America South America 43% 1% . Africa.‡ Aim : to replace the incompatible analog system ‡ Presently the responsibility of GSM standardization resides with special mobile group under ETSI ( European telecommunication Standards Institute ) ‡ Full set of specifications phase-I became available in 1990 ‡ Under ETSI. GSM is named as ³Global System for Mobile communication ³ ‡ Today many providers all over the world use GSM (more than 135 Countries in Asia. America) ‡ More than 1300 million subscribers in world and 45 million subscribers in India.

GSM IN INDIA Figures: March 2005 Reliance 3% MTNL Spice 2% 4% Aircel 4% BPL 6% IDEA 13% Bharti Bharti 27% BSNL Hutch IDEA BPL Aircel BSNL 22% Spice Reliance MTNL Hutch 19% GSM SERVICES  Tele-services  Bearer or Data Services  Supplementary services Tele-services ‡ Telecommunication services that enable voice communication .

Mobile telephony . outgoing calls.Notification of an incoming call while on the handset Call Hold.All calls.Emergency calling Bearer or Data Services  Include various data services for information transfer between GSM and other networks like PSTN. ISDN etc at rates from 300 to 9600 bps  Short Message Service (SMS) ± up to 160 character alphanumeric data transmission to/from the mobile terminal  Unified Messaging Services(UMS)  Group 3 fax  Voice mailbox  Electronic mail Supplementary services Call related services : ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ Call Waiting.Calls can be sent to various numbers defined by the user Multi Party Call Conferencing .via mobile phones ‡ Offered services .Put a caller on hold to take another call Call Barring.Link multiple calls together CLIP ± Caller line identification presentation CLIR ± Caller line identification restriction CUG ± Closed user group . or incoming calls Call Forwarding.

GSM System Architecture-I  Mobile Station (MS) Mobile Equipment (ME) Subscriber Identity Module (SIM)  Base Station Subsystem (BSS) Base Transceiver Station (BTS) Base Station Controller (BSC)  Network Switching Subsystem(NSS) Mobile Switching Center (MSC) Home Location Register (HLR) Visitor Location Register (VLR) Authentication Center (AUC) Equipment Identity Register (EIR) System Architecture Mobile Station (MS) The Mobile Station is made up of two entities: .

hand held device Uniquely identified by an IMEI (International Mobile Equipment Identity) Voice and data transmission Monitoring power and signal quality of surrounding cells for optimum handover Power level : 0.A5 and A8 algorithms  Protected by a password or PIN  Can be moved from phone to phone ± contains key information to activate the phone System Architecture Base Station Subsystem (BSS) Base Station Subsystem is composed of two parts that communicate across the standardized Abis interface allowing operation between components made by different suppliers .Key Ki.vehicle mounted. Subscriber Identity Module (SIM) Mobile Equipment y y y y y y Portable.1. Subscriber Identity Module (SIM)  Smart card contains the International Mobile Subscriber Identity (IMSI)  Allows user to send and receive calls and receive other subscribed services  Encoded network identification details .Kc and A3. Mobile Equipment (ME) 2.8W ± 20 W 160 character long SMS.

 Frequency hopping  Communicates with Mobile station and BSC  Consists of Transceivers (TRX) units Base Station Controller (BSC)  Manages Radio resources for BTS  Assigns Frequency and time slots for all MS¶s in its area  Handles call set up  Transcoding and rate adaptation functionality  Handover for each MS  Radio Power control  It communicates with MSC and BTS System Architecture Network Switching Subsystem(NSS) Mobile Switching Center (MSC)  Heart of the network  Manages communication between GSM and other networks  Call setup function and basic switching . Base Station Controller (BSC) System Architecture Base Station Subsystem (BSS) Base Transceiver Station (BTS):  Encodes.modulates and feeds the RF signals to the antenna. Base Transceiver Station (BTS) 2.encrypts.multiplexes.1.

Location Updating . by HLR database Controls those mobiles roaming in its area Reduces number of queries to HLR Database contains IMSI. Location Area. TMSI.Inter BSS and inter MSC call handoff  MSC does gateway function while its customer roams to other network by using HLR/VLR. System Architecture Network Switching Subsystem  Home Location Registers (HLR) . Kc) . MSRN.Permanent database about mobile subscribers in a large service area (generally one per GSM network operator) Database contains IMSI. Call routing  Billing information and collection  Mobility management .  Visitor Location Registers (VLR) - Temporary database which updates whenever new MS enters its area. and supplementary services. roaming restrictions. SRES. MS ISDN.Registration . MSISDN. authentication key  Authentication Center (AUC) Protects against intruders in air interface Maintains authentication keys and algorithms and provides security triplets ( RAND. prepaid/postpaid.

Database that is used to track handsets using the IMEI (International Mobile Equipment Identity) Made up of three sub-classes: The White List. The Black List and the Gray List Only one EIR per PLMN GSM Specifications-1  RF Spectrum GSM 900 Mobile to BTS (uplink): 890-915 Mhz BTS to Mobile(downlink):935-960 Mhz Bandwidth : 2* 25 Mhz GSM 1800 Mobile to BTS (uplink): 1710-1785 Mhz BTS to Mobile(downlink) 1805-1880 Mhz Bandwidth : 2* 75 Mhz GSM Specification-II  Carrier Separation : 200 Khz  Duplex Distance : 45 Mhz  No.- Generally associated with HLR  Equipment Identity Register (EIR) . of RF carriers : 124 .

833 Kbps OPERATION OF GSM . Access Method : TDMA/FDMA  Modulation Method : GMSK  Modulation data rate : 270.

Call Routing  Call Originating from MS  Call termination to MS Outgoing Call .

4 MS sends dialed number to BSS BSS sends dialed number to MSC MSC checks VLR if MS is allowed the requested service. 10 MSC routes the call to GMSC GMSC routes the call to local exchange of called use7. If so. 8. MSC. 5 6 9. BSS Incoming Call . MSC asks BSS to allocate resources for call. 2. 3. Answer back (ring back) tone is routed from called user to MS via GMSC.1.

Get current status of MS 10. 9. 13. Forwarding call to GSMC 3.1. 15. Security checks 16. Paging of MS 12. 11. MS answers 14. Forward Call to current MSC 8. Calling a GSM subscribers 2. Request MSRN from VLR 6. Forward responsible MSC to GMSC 7. 17. 5. Set up connection . Signal Setup to HLR 4.

A5 algorithm for encryption .  SIM is provided 4-8 digit PIN to validate the ownership of SIM  3 algorithms are specified : .A3 algorithm for authentication . GSM uses encryption and TMSI instead of IMSI.Handovers  Between 1 and 2 ± Inter BTS / Intra BSC  Between 1 and 3 ± Inter BSC/ Intra MSC  Between 1 and 4 ± Inter MSC Security in GSM  On air interface.

.  International roaming capability.  Full international roaming capability.  User/terminal authentication for fraud control.A8 algorithm for key generation Characteristics of GSM Standard  Fully digital system using 900. Advantages of GSM over Analog system:  Capacity increases  Reduced RF transmission power and longer battery life.leading to wider range of services GSM Applications  Mobile telephony  GSM-R  Telemetry System .  Low speed data services (upto 9.  TDMA over radio carriers(200 KHz carrier spacing.Fleet management .  8 full rate or 16 half rate TDMA channels per carrier.  Compatibility with ISDN.6 Kb/s).  Support of Short Message Service (SMS).  Encryption capability for information security and privacy.  Encryption of speech and data transmission over the radio path.1800 MHz frequency band.  Compatibility with ISDN.  Better security against fraud (through terminal validation and user authentication).

6 Kbps (data rate)  2.Remote control and fault reporting of DG sets  Value Added Services Future Of GSM  2nd Generation GSM -9.5 Generation ( Future of GSM) HSCSD (High Speed ckt Switched data)  Data rate : 76.2 Kbps EDGE (Enhanced data rate for GSM Evolution)  Data rate: 547.2 The structure of a GSM network CHAPTER 3 Problem formulation .4 .348 ± 2.6 x 8 kbps) GPRS (General Packet Radio service)  Data rate: 14.Automatic meter reading .Toll Collection .2 Kbps (max)  3 Generation WCDMA(Wide band CDMA)  Data rate : 0..8 Kbps (9.0 Mbps Figure 2.115.

If any ambulance comes near or when the ambulance at emergency comes to any traffic post the traffic signals automatically stop the other 3 sides with giving red signal and give green signal for this ambulance. RF and GSM communication.Due to that there is time waste process. Due to this other side vehicles have to wait for the time to complete the process. the traffic signals will glow for given fixed time. . Even though there are no vehicles at particular side.The problem with the traffic system is that for every minute the vehicles at the 4-way road will be heavy and the traffic lights shall be changed to each side for some fixed time. So that for this implementation we using different technology such IR.

5V Operating Range ‡ Fully Static Operation: 0 Hz to 33 MHz ‡ Three-level Program Memory Lock ‡ 256 x 8-bit Internal RAM ‡ 32 Programmable I/O Lines ‡ Three 16-bit Timer/Counters ‡ Eight Interrupt Sources ‡ Full Duplex UART Serial Channel ‡ Low-power Idle and Power-down Modes ‡ Interrupt Recovery from Power-down Mode ‡ Watchdog Timer ‡ Dual Data Pointer ‡ Power-off Flag .CHAPTER 4 System Specification 4.0V to 5.1 89S52 Micro Controller Features: ‡ Compatible with MCS-51® Products ‡ 8K Bytes of In-System Programmable (ISP) Flash Memory ± Endurance: 1000 Write/Erase Cycles ‡ 4.

three 16-bit timer/counters. on-chip oscillator.standard 80C51 instruction set and pin out. serial port. a six-vector two-level interrupt architecture. In addition. disabling all other chip . the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. Watchdog timer. timer/counters. 256 bytes of RAM. 32 I/O lines. the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. and interrupt system to continue functioning. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip. high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The Idle Mode stops the CPU while allowing the RAM. The device is manufactured using Atmel¶s high-density nonvolatile memory technology and is compatible with the industry. The AT89S52 provides the following standard features: 8K bytes of Flash. a full duplex serial port. two data pointers. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. and clock circuitry. The Power-down mode saves the RAM contents but freezes the oscillator.Description The AT89S52 is a low-power.

functions until the next interrupt or hardware reset. .


External pull ups are required during program verification. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification.0 and P1. In this mode. Port 1 also receives the low-order address bytes during Flash programming and verification. . P1. The Port 1 output buffers can sink/source four TTL inputs. As inputs.1/T2EX). Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull ups. respectively. In addition. P0 has internal pull ups. When 1s are written to Port 1 pins.0/T2) and the timer/counter 2 trigger input (P1. as shown in the following table. the pins can be used as high impedance inputs. As an output port. they are pulled high by the internal pull ups and can be used as inputs. When 1s are written to port 0 pins.1 can be configured to be the timer/counter 2 external count input (P1.Pin Description VCC: Pin 40 provides supply voltage to the chip. The voltage source is + 5V. Port 0 can also be configured to be the multiplexed low order address/data bus during accesses to external program and data memory. GND: Pin 20 provides ground. each pin can sink eight TTL inputs. Port 1:Port 1 is an 8-bit bidirectional I/O port with internal pull ups. Port 0: Port 0 is an 8-bit open drain bidirectional I/O port.

they are pulled high by the internal pull-ups and can be used as inputs. Port 2 uses strong internal pull-ups when emitting 1s. As inputs.Port 2:Port 2 is an 8-bit bidirectional I/O port with internal pull ups. As inputs. Port 3 also receives some control signals for Flash programming and verification. Port 2 emits 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 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 3:Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. 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 uses 16-bit addresses (MOVX @ DPTR). . The Port 2 output buffers can sink/source four TTL inputs. In this application. Port 3 also serves the functions of various special features of the AT89S52. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins. Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. When 1s are written to Port 3 pins. as shown in the following table. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI).

Note. the pin is weakly pulled high. In the default state of bit DISRTO. 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. . If desired. With the bit set. In normal operation. that one ALE pulse is skipped during each access to external data memory. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. ALE is active only during a MOVX or MOVC instruction. ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. however. the RESET HIGH out feature is enabled. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode. ALE/PROG:Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. except that two PSEN activations are skipped during each access to external data memory.RST:Reset input. EA/VPP:External access enable. ALE operation can be disabled by setting bit 0 of SFR location 8EH. A high on this pin for two machine cycles while the oscillator is running resets the device. When the AT89S52 is executing code from external program memory. PSEN:Program Store Enable (PSEN) is the read strobe to external program memory. This pin drives High for 96 oscillator periods after the Watchdog times out. This pin is also the program pulse input (PROG) during flash programming. Otherwise. PSEN is activated twice each machine cycle.

The register pair (RCAP2H. and unoccupied addresses may not be implemented on the chip. XTAL1:Input to the inverting oscillator amplifier and input to the internal clock operating circuit. User software should not write 1s to these unlisted locations. and write accesses will have an indeterminate effect. that if lock bit 1 is programmed. however. EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. the reset or inactive values of the new bits will always be 0. Read accesses to these addresses will in general return random data. Timer 2 Registers: Control and status bits are contained in registers T2CON (shown in Table 2) and T2MOD (shown in Table 3) for Timer 2. XTAL2:Output from the inverting oscillator amplifier. In that case.Note. RCAP2L) is the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode. . Note that not all of the addresses are occupied. Special Function Registers A map of the on-chip memory area called the Special Function Register (SFR) space is shown in Table 1. This pin also receives the 12volt programming enable voltage (VPP) during Flash programming. since they may be used in future products to invoke new features.

4) in the PCON SFR. Two priorities can be set for each of the six interrupt sources in the IP register. It can be set and rest under software control and is not affected by reset. two banks of 16-bit Data Pointer Registers are provided: DP0 at SFR address locations 82H-83H and DP1 at 84H-85H. Memory Organization . Bit DPS = 0 in SFR AUXR1 selects DP0 and DPS = 1 selects DP1. The user should always initialize the DPS bit to the appropriate value before accessing the respective Data Pointer Register. POF is set to ³1´ during power up.Interrupt Registers: The individual interrupt enable bits are in the IE register. Dual Data Pointer Registers: To facilitate accessing both internal and external data memory. Power Off Flag: The Power Off Flag (POF) is located at bit 4 (PCON.

rather than P2 (whose address is 0A0H). The upper 128 bytes occupy a parallel address space to the Special Function Registers. #data Instructions that use indirect addressing access the upper 128 bytes of RAM. For example. Watchdog Timer . Instructions which use direct addressing access of the SFR space. accesses the data byte at address 0A0H. MOV @R0. program fetches to addresses 0000H through 1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH are to external memory. Data Memory The AT89S52 implements 256 bytes of on-chip RAM. Up to 64K bytes each of external Program and Data Memory can be addressed. the following indirect addressing instruction. On the AT89S52. Program Memory If the EA pin is connected to GND. so the upper 128 bytes of data RAM are available as stack space. the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. When an instruction accesses an internal location above address 7FH. where R0 contains 0A0H. the following direct addressing instruction accesses the SFR at location 0A0H (which is P2). #data Note that stack operations are examples of indirect addressing. This means that the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space. For example. MOV 0A0H. all program fetches are directed to external memory.MCS-51 devices have a separate address space for Program and Data Memory. if EA is connected to VCC.

it will drive an output RESET HIGH pulse at the RST pin. When WDT overflows. the user needs to service it by writing 01EH and 0E1H to WDTRST to avoid a WDT overflow. DTRST is a write-only register. The 13-bit counter overflows when it reaches 8191 (1FFFH). There are two methods of exiting Power-down mode: by a hardware reset or via a level-activated external interrupt which is enabled prior to entering Power-down mode. To reset the WDT the user must write 01EH and 0E1H to WDTRST. where TOSC=1/FOSC. When Power-down is exited with hardware reset. and this will reset the device. The WDT counter cannot be read or written. When the WDT is enabled. it will increment every machine cycle while the oscillator is running. it will generate an output RESET pulse at the RST pin. There is no way to disable the WDT except through reset (either hardware reset or WDT overflow (reset). servicing the WDT should occur as it normally does whenever the AT89S52 is reset. When the WDT is enabled. a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H). WDT during Power-down and Idle In Power-down mode the oscillator stops. The WDT consists of a 13-bit counter and the Watchdog Timer Reset (WDTRST) SFR. The WDT is defaulted to disable from exiting reset. it should be serviced in those sections of code that will periodically be executed within the time required to prevent a WDT reset. Using the WDT To enable the WDT. Exiting . This means the user must reset the WDT at least every 8191 machine cycles. To enable the WDT. it will increment every machine cycle while the oscillator is running. which means the WDT also stops. When WDT overflows.(One-time Enabled with Reset-out) The WDT is intended as a recovery method in situations where the CPU may be subjected to software upsets. The RESET pulse duration is 96xTOSC. The WDT timeout period is dependent on the external clock frequency. the user does not need to service the WDT. a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H). When the WDT is enabled. To make the best use of the WDT. While in Power-down mode.

Timer 0 The 16-bit register of timer 0 is accessed as low byte and high byte. To prevent the WDT from resetting the AT89S52 while in IDLE mode. it is best to reset the WDT just before entering Power-down mode. UART Serial data communication uses two methods. there are special IC chips made by the manufacturers for the serial data communications. and reenter IDLE mode. With WDIDLE bit enabled. the user should always set up a timer that will periodically exit IDLE. The low byte register is called TL0 ( Timer 0 low byte) and the high byte register is referred to as TH0 ( Timer 0 high . These chips are commonly referred to as UART ( universal asynchronous receiver-transmitter) and USART ( universal synchronous receiver-transmitter). the interrupt is serviced. The interrupt is held low long enough for the oscillator to stabilize. but programs can be tedious and long. The synchronous method transfers a block of data (characters ) at a time. When the interrupt is brought high. For this reason.Power-down with an interrupt is significantly different. The 8052 has built-in UART. while the asynchronous method transfers a single byte at a time. the WDIDLE bit in SFR AUXR is used to determine whether the WDT continues to count if enabled. To prevent the WDT from resetting the device while the interrupt pin is held low. To ensure that the WDT does not overflow within a few states of exiting Power-down. It is suggested that the WDT be reset during the interrupt service for the interrupt used to exit Power-down mode. service the WDT. the WDT is not started until the interrupt is pulled high. asynchronous and synchronous. Before going into the IDLE mode. The WDT keeps counting during IDLE WDIDLE bit = 0) as the default state. It is possible to write software to use either of these methods. the WDT will stop to count in IDLE mode and resumes the count upon exit from IDLE.

In this function. such as A. the low byte of Timer 0.B. the TL2 register is incremented every machine cycle. Timer 2 consists of two 8-bit registers. the maximum count rate is 1/24 of the .TH0´ saves TH0 ( high byte of Timer 0) in R5.#4FH´ moves the value 4FH into TL0. the register is incremented in esponse to a 1-to-0 transition at its corresponding external input pin. and baud rate generator. These registers can also be read like any other register. The type of operation is selected by bit C/T2 in the SFR T2CON (shown in Table 2).R2 etc. the external input is sampled during S5P2 of every machine cycle. These registers can be accessed like any other registers . ³MOV R5. In the Counter function. The new count value appears in the register during S3P1 of the cycle following the one in which the transition was detected. the count is incremented. For example. Since a machine cycle consists of 12 oscillator periods. The modes are selected by bits in T2CON. the count rate is 1/12 of the oscillator frequency. T2. as shown in Table 3. When the samples show a high in one cycle and a low in the next cycle. Timer 2 Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter. auto-reload (up or down counting). In the Timer function.R1.byte). Timer1 Timer 1 is also 16 bits and its 16-bit register is split into two bytes.R0. for example the instruction ³MOV TL0. Since two machine cycles (24 oscillator periods) are required to recognize a 1-to-0 transition. TH2 and TL2. These registers are accessible in the same way as the registers of Timer 0. referred to as TL1 (Timer 1 low byte ) and TH1 ( Timer 1 high byte). Timer 2 has three operating modes: capture.

This feature is invoked by the DCEN (Down Counter Enable) bit located in the SFR T2MOD (see Table 4). Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2 in T2CON. To ensure that a given level is sampled at least once before it changes. two options are selected by bit EXEN2 in T2CON. Timer 2 performs the same operation. the level should be held for at least one full machine cycle. The overflow also causes the timer registers to be reloaded with the 16-bit value in RCAP2H and RCAP2L. a 16-bit reload can be Figure 6 shows Timer . If EXEN2 = 1. If EXEN2 = 0. This bit can then be used to generate an interrupt. In addition. When DCEN is set. Upon reset. the DCEN bit is set to 0 so that timer 2 will default to count up. like transition at external input T2EX also causes the current value in TH2 and TL2 to be captured into RCAP2H and RCAP2L. Auto-reload (Up or Down Counter) Timer 2 can be programmed to count up or down when configured in its 16-bit autoreload mode. the transition at T2EX causes bit EXF2 in T2CON to be set. The EXF2 bit. respectively. can generate an interrupt. Timer 2 can count up or down. The capture mode is illustrated in Figure 5. but a 1. If EXEN2 = 1. options are selected by bit EXEN2 in T2CON. Capture Mode In the capture mode.oscillator frequency. depending on the value of the T2EX pin. If EXEN2 = 0. Timer 2 counts up to 0FFFFH and then sets the TF2 bit upon overflow. The values in Timer in Capture ModeRCAP2H and RCAP2L are preset by software.

A logic 1 at T2EX makes Timer 2 count up. two triggered either by an overflow or by a 1-to-0 transition at external input T2EX. . The underflow sets the TF2 bit and causes 0FFFFH to be reloaded into the timer registers . In this operating mode. respectively. as shown in Figure 6. Both the TF2 and EXF2 bits can generate an interrupt if enabled. The timer will overflow at 0FFFFH and set the TF2 bit.The EXF2 bit toggles whenever Timer 2 overflows or underflows and can be used as a 17th bit of resolution. In this mode.2 automatically counting up when DCEN=0. A logic 0 at T2EX makes Timer 2 count down. Setting the DCEN bit enables Timer 2 to count up or down. the T2EX pin controls the direction of the count. This transition also sets the EXF2 bit. This overflow also causes the 16-bit value in RCAP2H and RCAP2L to be reloaded into the timer registers. TH2 and TL2. The timer underflows when TH2 and TL2 equal the values stored in RCAP2H and RCAP2L. EXF2 does not flag an interrupt. In this mode.

The baud rates in Modes 1 and 3 are determined by Timer 2¶s overflow rate according to the following equation. as shown in Figure 8. it increments every machine cycle (at . it is configured for timer operation (CP/T2 = 0). The baud rate generator mode is similar to the auto-reload mode. in that a rollover in TH2 causes the Timer 2 registers to be reloaded with the 16-bit value in registers RCAP2H and RCAP2L. The timer operation is different for Timer 2 when it is used as a baud rate generator. Setting RCLK and/or TCLK puts Timer 2 into its baud rate generator mode. The Timer can be configured for either timer or counter operation. which are preset by software.Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in T2CON (Table 2). as a timer. Normally. 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. In most applications.

The timer should be turned off (clear TR2) before accessing the Timer 2 or RCAP2 registers. since they may be used in future AT89 products. because a write might overlap a reload and cause write and/or reload errors. and that bit will have to be cleared in software.1/12 the oscillator frequency). three timer interrupts (Timers 0.5 is also unimplemented. are set at S5P2 of the cycle in which the timers overflow. Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in Special Function Register IE. TL2). Note that Table 5 shows that bit position IE. that if EXEN2 is set. which disables all interrupts at once. TF0 and TF1. and the serial port interrupt. In fact. and 2). Note that when Timer 2 is running (TR2 = 1) as a timer in the baud rate generator mode. In the AT89S52. when Timer 2 is in use as a baud rate generator. EA. These interrupts are all shown in Figure 10. The Timer 0 and Timer 1 flags. however. Where (RCAP2H. the service routine may have to determine whether it was TF2 or EXF2 that generated the interrupt. Under these conditions. Thus. User software should not write 1s to these bit positions. a 1-to-0 transition in T2EX will set EXF2 but will not cause a reload from (RCAP2H. The baud rate formula is given below. As a baud rate generator. Interrupts The AT89S52 has a total of six interrupt vectors: two external interrupts (INT0 and INT1). T2EX can be used as an extra external interrupt. 1. and the results of a read or write may not be accurate. The values are then polled by the circuitry in the . Note that a rollover in TH2 does not set TF2 and will not generate an interrupt. bit position IE. it increments every state time (at 1/2 the oscillator frequency). RCAP2L) is the content of RCAP2H and RCAP2L taken as a 16-bit unsigned integer. RCAP2L) to (TH2.6 is unimplemented. Note too. The RCAP2 registers may be read but should not be written to. the Timer is incremented every state time. This figure is valid only if RCLK or TCLK = 1 in T2CON. TH2 or TL2 should not be read from or written to. Timer 2 as a baud rate generator is shown in Figure 8. Neither of these flags is cleared by hardware when the service routine is vectored to. Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register T2CON. IE also contains a global disable bit.

as shown in Figure 11. since the input to the internal clocking circuitry is through a divide-by-two flip-flop. However. Either a quartz crystal or ceramic resonator may be used. respectively. of an inverting amplifier that can be configured for use as an on-chip cycle. There are no requirements on the duty cycle of the external clock signal. To drive the device from an external clock source. Oscillator Characteristics XTAL1 and XTAL2 are the input and output. as shown in Figure 12. the Timer 2 flag. TF2. XTAL2 should be left unconnected while XTAL1 is driven. but minimum and maximum voltage high . is set at S2P2 and is polled in the same cycle in which the timer overflows.

Oscillator connections Note: C1. are packed in between a start and stop bits. C2 = 30 pF = 40 pF 10 pF for Crystals 10 pF for Ceramic Resonators Asynchronous serial communication and data framing The data coming in the receiving end of the data line in a serial data transfer is all 0¶s and 1¶s. each character is placed between start and stop bits. the parity bit of the character byte is included in the data frame. In case of odd parity bit the number of data bits of a book of including the parity bit. 4. a protocol.8. the data. This is called the framing. how many bits constitute the character. . The parity bit is odd or even.1 Start and Stop bits Asynchronous serial data communication is widely used for character orientation transmissions.and low time specifications must be observed. it is difficult to make sense of the data unless the sender and receiver agree on a set of rules. Parity Bit In some systems in order to maintain data integrity. such as ASCII characters. The start bit is always one-bit but the stop bit can be one or two bits. In data framing for asynchronous communications. The start bit is always a 0 and the stop bit is 1. This means that for each character we have a single parity bit in addition to start and stop bits. 4. on how the data is packed. In the asynchronous method.8. and when the data begins and ends.2. is even.

3 Data Transfer rate The rate of data transfer in serial data communication is stated in bps or it can be called as baud rate. As far as the conductor wire is concerned.4.10: DATA FRAMING Figure 4. the baud rates as bps are the same. Baud rate is defined as the number of signal changes per second. Figure 4.11: Data Transfer between 89C51 and System .8.

For byte of data to be transfers via TxD line.9. It must be cleared by software.9 Registers used for Communication 4. It must be cleared by software RIReceived interrupts flag.Not widely used RB8. and then placing it in the SBUF.1. 4.SCON (Serial control register): Bit addressable Address location 98H Figure 4.Set or cleared by software to enable or disable reception.4. Similarly when bits are received serially via RxD. SBUF Register: SBUF is an 8 bit register used solely for serial communication in the 8051. it is framed with the start and stop bits and transferred serially via TxD line. the 8051 defames it by eliminating a byte out of the received. The moment a byte is written into SBUF. TB8.2. Set by hardware at the beginning of the stop bit in mode 1. . it must be placed in SBUF register.12: SCON register: REN. Set by hardware halfway through the stop bit mode 1. SBUF also holds the byte of data when it is received by the 8051¶s RxD line.9 .Not widely used TITransmits interrupt flag.

1 stop bit.3V or even lower. 1 start bit. 1 stop bit. +0.. and the negative RS-232 voltage for high can't be grokked at all by computer logic..SM0 0 0 0 1 SM1 Serial mode 0 Synchronous mode 8-bit data. fixed baud rate 9-bit data. too.10. 1 start bit. +5V for high)... Modern low-power logic operates in the range of 0V . and a negative voltage has to be generated. +5V (roughly 0V .. 1 stop bit. +5V <-> high .. So. -3V <-> +2V . +2V .MAX232 Driver/Receiver: This module is primary of interest for people building their own electronics with an RS-232 interface. the maximum RS-232 signal levels are far too high for computer logic electronics.. and there is no need to add the circuitry as described here..24) communication works with voltages (-15V ... variable baud rate 9-bit data. Off-the-shelf computers with RS-232 interfaces already contain the necessary electronics. and the low and high voltage level inverted. Therefore.. 1 start bit. -3V for high [sic]) and +3V . to receive serial data from an RS-232 interface the voltage has to be reduced.. In the other direction (sending data from some logic over RS-232) the low logic voltage has to be "bumped up". On the other hand.13: UART modes 4.. classic TTL computer logic operates between 0V . Serial RS-232 (V.8V for low. +15V for low [sic]) which are not compatible with normal computer logic voltages. variable baud rate 1 0 1 1 Figure 4. RS-232 TTL Logic -----------------------------------------------15V .... +3.

-10V and +10V) internally. and +12V). In fact. +5V. the MAX232A. +15V <-> 0V . However. a particular power supply and a couple of transistors or the once popular 1488 (transmitter) and 1489 (receiver) ICs. It became popular.. +0. It does not generate the necessary RS-232 sequence of marks and spaces with the right timing. but could just provide one +5V power supply. Atmel AVR..g. e. and the MAX232A only needs external capacitors 1/10th the capacity of what the original MAX232 needs.g. however.g. The MAX232 and MAX232A were once rather expensive ICs.14 Voltage levels for RS232 and TTL All this can be done with conventional analog electronics.g. e. the MAX232A is much more often used (and easier to get) than the original MAX232. Sipex)..8V <-> low Figure 4. Circuitry designers no longer need to design and build a power supply with three voltages (e. The ICs are almost identical. by a 16550 UART or one of these small micro controllers (e. The MAX232 from Maxim was the first IC which in one package contains the necessary drivers (two) and receivers (also two).g. The MAX232 has a successor. This greatly simplified the design of circuitry. it does not provide a serial/parallel conversion.. it does not decode the RS232 signal. Microchip PIC) getting more and more popular. but today they are cheap. to adapt the RS-232 signal voltage levels to TTL logic. since more than a decade it has become standard in amateur electronics to do the necessary signal level conversion with an integrated circuit (IC) from the MAX232 family (typically a MAX232A or some clone).+3V . 12V. All it does is to convert signal voltage levels. it is hard to find some RS-232 circuitry in amateur electronics without a MAX232A or some clone. Generating serial data with the right timing and decoding serial data has to be done by additional circuitry. It has also helped that many companies now produce clones (ie. with the help of a simple 78x05 voltage converter. e. These clones sometimes need . because it just needs one voltage (+5V) and generates the necessary RS-232 voltage levels (approx. It should be noted that the MAX232(A) is just a driver/receiver.

g. or some other IC from the MAX232 family can be used (if it can be found in consumer electronic shops at all).Maxim's data sheet explains the MAX232 family in great detail. If the DTE really requires these signals either a second MAX232 is needed.A similar IC. E. This means only two of the RS-232 signals can be converted in each direction. the MAX3232 is nowadays available for low-power 3V logic. The MAX233 is also between three and ten times more expensive in electronic shops than the MAX232A because of its internal capacitors. Exactly to connect the RS-232 signals to the IC. DSR. An alternative for DTR/DSR is also given below. So here is one possible example: MAX232 Pin Nbr. Usually these signals can be omitted when e. The MAX232 and MAX232A need external capacitors for the internal voltage pump. e. communicating with a PC's serial interface. while the MAX233 has these capacitors built-in. It is recommended to check the data sheet of the particular manufacturer of an IC instead of relying on Maxim's original data sheet. and DCD signals. MAX232 Pin Name Signal Voltage DB9 Pin .11 MAX232Application: The MAX232(A) has two receivers (converts from RS-232 to TTL voltage levels) and two drivers (converts from TTL logic to RS-232 voltage levels). The original manufacturer (and now some clone manufacturers.different external circuitry. with different numbers of receivers and drivers. Typically a pair of a driver/receiver of the MAX232 is used for TX and RX and the second one for CTS and RTS.g. including the pin configuration and how to connect such an IC to external circuitry. too) offers a large series of similar ICs.g. built-in or external capacitors. voltages. There are not enough drivers/receivers in the MAX232 to also connect the DTR. The old MC1488/1498 combo provided four drivers and receivers. etc. the capacities of the external capacitors vary. It is also more difficult to get the MAX233 than the garden variety MAX232A. 4.

The ability to display numbers. which are limited to numbers and a few characters.7 8 9 10 11 12 13 14 15 T2out R2in R2out T2in T1in R1out R1in T1out GND CTS RTS RTS CTS TX RX RX TX GND RS-232 7 RS-232 8 TTL TTL TTL TTL n/a n/a n/a n/a RS-232 2 RS-232 3 0 5 Figure 4.15 RS232-DB9 pin Diagram 5. 2. . The declining prices of LCDs. characters and graphics. This is in contrast to LEDs. LIQUID CRYSTAL DISPLAY: LCD stands for Liquid Crystal Display. LCD is finding wide spread use replacing LEDs (seven segment LEDs or other multi segment LEDs) because of the following reasons: 1.

mathematical symbols etc. Pins Functions . Incorporation of a refreshing controller into the LCD. backlight etc. thereby relieving the CPU of the task of refreshing the LCD. It is based on the HD44780 microcontroller (Hitachi) and can display messages in two lines with 16 characters each . In contrast. Ease of programming for characters and graphics. Greek letters. It displays all the alphabets. They are used for writing different messages on a miniature LCD. In addition. which means that they cannot be activated by standard IC circuits. These components are ³specialized´ for being used with the microcontrollers. the LED must be refreshed by the CPU to keep displaying the data. appearance of the pointer. Automatic shifting message on display (shift left and right). are considered as useful characteristics. punctuation marks. A model described here is for its low price and great possibilities most frequently used in practice. 4.3. it is possible to display symbols that user makes up on its own.

Their function is described in the table below: Function Ground Power supply Contrast Pin Number 1 2 3 Name Vss Vdd Vee Logic State Description 0V +5V 0 .There are pins along one side of the small printed board used for connection to the microcontroller. There are total of 14 pins marked with numbers (16 in case the background light is built in).Vdd D0 ± D7 are interpreted as commands D0 ± D7 are interpreted as data Write data (from controller to LCD) Read data (from LCD to controller) Access to LCD disabled Normal operating Data/commands are transferred to LCD Bit 0 LSB Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 4 RS 0 1 Control of operating 5 R/W 0 1 0 6 E 1 From 1 to 0 7 8 9 Data / commands 10 11 12 D0 D1 D2 D3 D4 D5 0/1 0/1 0/1 0/1 0/1 0/1 .

. a resistor for current limitation should be used (like with any LE diode). This address is either previously defined or the address of previously transferred character is automatically incremented.D7 are addresses of characters that should be displayed. Contrast on display depends on the power supply voltage and whether messages are displayed in one or two lines. Displaying position is determined by DDRAM address. When used during operating. Some versions of displays have built in backlight (blue or green diodes). Built in processor addresses built in ³map of characters´ and displays corresponding symbols.Bits D0 . which depends on logic state on pin RS: RS = 1 . variable voltage 0-Vdd is applied on pin marked as Vee. Each character consists of 5x7 dot matrix. Trimmer potentiometer is usually used for that purpose. LCD Basic Commands All data transferred to LCD through outputs D0-D7 will be interpreted as commands or as data.13 14 LCD screen: D6 D7 0/1 0/1 Bit 6 Bit 7 MSB LCD screen consists of two lines with 16 characters each. For that reason.

64mS 1.RS = 0 . List of commands which LCD recognizes are given in the table below: Execution Time 1.64mS 40uS 40uS 40uS 40uS 40uS 40uS - Command RS RW D7 D6 D5 D4 D3 D2 D1 D0 Clear display Cursor home Entry mode set Display on/off control Cursor/Display Shift Function set Set CGRAM address Set DDRAM address Read ³BUSY´ flag (BF) Write to CGRAM or DDRAM Read from CGRAM or DDRAM 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 x 1 I/D S D U B x x 1 D/C R/L x F x 0 0 1 DL N 0 1 1 CGRAM address DDRAM address DDRAM address 1 BF 1 0 D7 D6 D5 D4 D3 D2 D1 D0 40uS 1 1 D7 D6 D5 D4 D3 D2 D1 D0 40uS I/D 1 = Increment (by 1) 0 = Decrement (by 1) R/L 1 = Shift right 0 = Shift left .Bits D0 .D7 are commands which determine display mode.

four lower bits are sent afterwards. for the sake of saving valuable I/O pins of the microcontroller. LCD Initialization . LCD will correctly connect and interpret each data received. In the first case. there are 8bit and 4-bit LCD modes. with regards to the fact that data are rarely read from LCD (data mainly are transferred from microcontroller to LCD) one more I/O pin may be saved by simple connecting R/W pin to the Ground. Besides. the data are transferred through outputs D0-D7 as it has been already explained. Consequently. Even though message displaying will be normally performed. there are only 4 higher bits (D4-D7) used for communication. With the help of initialization. In case of 4-bit LED mode. each data is sent to LCD in two steps: four higher bits are sent first (that normally would be sent through lines D4-D7). The appropriate mode is determined at the beginning of the process in a phase called ³initialization´. while other may be left unconnected.S 1 = Display shift on 0 = Display shift off D 1 = Display on 0 = Display off U 1 = Cursor on 0 = Cursor off B 1 = Cursor blink on 0 = Cursor blink off LCD Connection DL 1 = 8-bit interface 0 = 4-bit interface N 1 = Display in two lines 0 = Display in one line F 1 = Character format 5x10 dots 0 = Character format 5x7 dots D/C 1 = Display shift 0 = Cursor shift Depending on how many lines are used for connection to the microcontroller. Such saving has its price. it will not be possible to read from busy flag since it is not possible to read from display.

Display/Cursor on/off D = 0 Display off U = 0 Cursor off B = 0 Cursor blink off 4. Display is cleared 2.Once the power supply is turned on. After that. Mode DL = 1 Communication through 8-bit interface N = 0 Messages are displayed in one line F = 0 Character font 5 x 8 dots 3. Mainly but not always! If for any reason power supply voltage does not reach full value in the course of 10mS. Character entry ID = 1 Addresses on display are automatically incremented by 1 S = 0 Display shift off Automatic reset is mainly performed without any problems. If voltage supply unit can not meet this condition or if it is needed to provide completely safe operating. This process lasts for approximately 15mS. display will start perform completely unpredictably. This means that: 1. The mode of operating is set by default. display is ready to operate. . the process of initialization by which a new reset enabling display to operate normally must be applied. LCD is automatically cleared.

All left over to be done after that is to give basic commands and of course. a preset is used which can behave like a variable voltage display messages. For this. .Algorithm according to the initialization is being performed depends on whether connection to the microcontroller is through 4. the voltage should be varied. To adjust the contrast. the contrast of the LCD can be adjusted. Potentiometer Variable resistors used as potentiometers have all three terminals connected. CONTRAST CONTROL: To have a clear view of the characters on the LCD.or 8-bit interface. Fig: Procedure on 8-bit initialization. As the voltage of this preset is varied. contrast should be adjusted.

for example to set the switching point of a circuit with a sensor. Presets are much cheaper than standard variable resistors so they are sometimes used in projects where a standard variable resistor would normally be used. Potentiometer Symbol Presets These are miniature versions of the standard variable resistor. giving very fine control. They are designed to be mounted directly onto the circuit board and adjusted only when the circuit is built. A small screwdriver or similar tool is required to adjust presets. If the terminals at the ends of the track are connected across the power supply. Preset Symbol LCD INTERFACING WITH THE MICROCONTROLLER: . then the wiper terminal will provide a voltage which can be varied from zero up to the maximum of the supply.This arrangement is normally used to vary voltage. The screw must be turned many times (10+) to move the slider from one end of the track to the other. or control the volume (loudness) in an amplifier circuit. For example to set the frequency of an alarm tone or the sensitivity of a light-sensitive circuit. Multiturn presets are used where very precise adjustments must be made.

0 P2.1 P2.2 4 (RS) 5 (R/W) 6(EN) 1 Gnd 2 3 PRESET (CONTRAST CONTROL) LCD Vcc Gnd FOR BACKLIGHT PURPOSE D0 Infrared LED (IR LED) .Vcc P2.

End of the IR sensor we have to connect a NOT gate for the inverting purpose means low input have corresponding low outputInfra-Red actually is normal light with a particular colour.IR sensor is the combination of IR LED with PHOTO DIODE. After this combination we are connecting the DARLINGTON PAIR TRANSISTOR. they can form images on a jumbo television screen or illuminate a traffic light. and therefore can be very cheap. transmit information from remote controls. They do dozens of different jobs and are found in all kinds of devices. they form the numbers on digital clocks.3. We humans can't see this colour because its wave length of 950nm is below the visible spectrum. point your remote to it. Collected together. Another reason is because IR LEDs are quite easy to make. press any button and you'll see the LED flicker. light up watches and tell you when your appliances are turned on. Among other things. If you own a web cam. we want to use it but we're not interested in seeing it.1 IR LED USED IN REMOTE CONTROL DARLINGTON PAIR: . That's one of the reasons why IR is chosen for remote control purposes. Although we humans can't see the Infra-Red light emitted from a remote control doesn't mean we can't make it visible. FIG. A video camera or digital photo camera can "see" the Infra-Red light as you can see in this picture.

This Darlington pair basically consists of two transistors cascaded in cc configuration. We humans also notice the blinking of yellow lights at construction sites instantly. In the figure shown below the input impedance of the second transistor Constitutes the load impedance of the first.An emitter follower offers high impedance of 500Kohms. we may use what is called Darlington in place of conventional transistor. You can think of this blinking as attracting the receiver's attention. so it can ignore everything else. even in bright daylight. The IR receiver will be tuned to that frequency. Fig: Modulation Darlington Pair Modulation is the answer to make our signal stand out above the noise. With modulation we make the IR light source blink in a particular frequency. We thus conclude that in comparison with a conventional single transistor emitter follower has in higher current gain. For applications requiring still higher input impedance. higher input impedance and almost the same voltage gain lower out put impedances. .

Please note that the 'marks' and 'spaces' are not the 1-s and 0-s we want to transmit. More information about that can be found on the pages that describe the protocols.2 IR TRANSMITTER The transmitter usually is a battery powered handset. The real relationship between the 'marks' and 'spaces' and the 1-s and 0-s depends on the protocol that's being used.3. Preferably it should be shock proof as well. No light is emitted during the 'space' state. TRANSMITTER: In the picture below we can see a modulated signal driving the IR LED of the transmitter on the left side. During the 'mark' state of the signal the IR light is pulsed on and off at a particular frequency. Frequencies between 30kHz and 60kHz are commonly used in consumer electronics. The detected signal is coming out of the receiver at the other side. and the IR signal should also be as strong as possible to achieve an acceptable control distance. . : FIG.In the picture above you can see a modulated signal driving the IR LED of the transmitter on the left side. A 'mark' is then automatically represented by a low level. In serial communication we usually speak of 'marks' and 'spaces'. The 'space' is the default signal. At the receiver side a 'space' is represented by a high level of the receiver's output. The detected signal is coming out of the receiver at the other side. which is the off state in the transmitter case. It should consume as little power as possible.

because they can withstand larger physical shocks. LED currents can be that high because the pulses driving the LEDs are very short.3 TRANSISTOR CIRCUIT USED TO DRIVE IR LED Quartz crystals are seldom used in such handsets. Ceramic resonators are much more suitable here. Average power dissipation of the LED should not exceed the maximum value though. The current through the LED (or LEDs) can vary from 100mA to well over 1A! In order to get an acceptable control distance the LED currents have to be as high as possible. When no button is pressed they are in a very low power sleep mode. You should also see to it . The fact that they are a little less accurate is not important. A trade-off should be made between LED parameters. in which hardly any current is consumed. The processor when wakes up to transmit the appropriate IR command only a key is pressed FIG. They are very fragile and tend to break easily when the handset is dropped. battery lifetime and maximum control distance.3. The older chips were dedicated to only one of the many protocols that were invented. Nowadays very low power microcontrollers are used in IR transmitters for the simple reason that they are more flexible in their use.Many chips are designed to be used as IR transmitters.

In fact everything that radiates heat.6V at the emitter. has one disadvantage. Calculating the current through the LED is simply applying ohm¶ law. or IR.2V. As the battery voltage drops. radiation-sensitive junction formed in a semiconductor material in which the . Photodiodes are a two-electrode. Therefore we have to take some precautions to guarantee that our IR message gets across to the receiver with out errors. also radiates Infrared light. A simple transistor circuit can be used to drive the LED. The photodiode spectral response can be measured in X-ray. The normal driver. This will result in a shorter control distance that can be covered. gamma ray. but there are many others. Photodiodes are used for the detection of optical power (UV.6V from that. The 2 diodes in series will limit the pulses on the base of the transistor to 1. An emitter follower circuit can avoid this. X-ray photodiodes are optimized for X-ray. The sun is the brightest source of all. and even our body radiates Infrared light. central heating system. described above. the current through the LED will decrease as well. and beta radiation detection. Visible. All these parameters can be found in the LED's data sheet. and IR) and for the conversion of optical power to electrical power. A transistor with a suitable hfe and switching speed should be selected for this purpose.1V. Remember that the nominal voltage drop over an IR LED is approximately 1. candles. resulting in constant amplitude of 0.that the maximum peek current for the LED is not exceeded. UV. The base-emitter voltage of the transistor subtracts 0. This constant amplitude across a constant resistor results in current pulses of a constant magnitude. UV enhanced photodiodes are optimized for the UV and blue spectral regions. PHOTODIODES: Unfortunately for us there are many more sources of Infrared light. The resistor values can simply be calculated using Ohm's law. like: light bulbs. visible.

radiation-sensitive PN junction formed in a semiconductor material in which the reverse current varies with illumination. or avalanche. Photons absorbed in this region create electron-hole pairs that are then separated by an electric field. PIN photodiodes are diodes with a large intrinsic region sandwiched between P-doped and N-doped semiconducting regions. thus generating an electric current in a load circuit .reverse current varies with illumination. Photodiodes can be PN. PIN. PN photodiodes feature a two-electrode. Photodiodes are used for the detection of optical power and for the conversion of optical power to electrical power.

visible. . X rays. As the frequency is increased beyond that of the RF spectrum. to thousands of gigahertz(GHz). extending from nine kilohertz (9 kHz). and two-way radio services all operate in the RF spectrum. and a few wireless hi-fi stereo headsets. At 9 kHz. EM energy takes the form of infrared (IR). the free-space wavelength is approximately 33 kilometers (km) or 21 miles (mi). Examples include most television-set remote-control boxes Some cordless computer keyboards and mice. When an RF current is supplied to an antenna. At the highest radio frequencies. and gamma rays. radio and television broadcast stations. the EM wavelengths measure approximately one millimeter (1 mm). Some wireless devices operate at IR or visible-light frequencies.the lowest allocated wireless communications frequency (it's within the range of human hearing). satellite communications systems. an electromagnetic (EM) field is generated suitable for wireless broadcasting and/or communications. if the current is input to an antenna. if f is the frequency in megahertz and sis the wavelength in meters. Many types of wireless devices make use of RF fields. These frequencies cover a significant portion of the electromagnetic radiation spectrum. This field is sometimes called an RF field. ultraviolet (UV)." Any RF field has a wavelength that is inversely proportional to the frequency.12 RF Module: Radio frequency (abbreviated RF) is a term that refers to alternating current (AC) having characteristics such that. then s = 300/f The frequency of an RF signal is inversely proportional to the wavelength of the EM field to which it corresponds.4. In the atmosphere or in outer space. it gives rise to an electromagnetic field that propagates through space. in less technical jargon it is a "radio wave. Cordless and cellular telephone. whose electromagnetic wavelengths are shorter than those of RF fields.

each band represents an increase of frequency corresponding to an order of magnitude (power of 10). Features: y y 433.92 MHz Frequency Low Cost . y The manufacturing-friendly SIP style package and low-cost make the STT-433 suitable for high volume applications. With the exception of the lowestfrequency segment. showing frequency and bandwidth ranges. The SHF and EHF bands are often referred to as the microwave The main requirements for the communication using RF are: y y y RF Transmitter RF Receiver Encoder and Decoder RF TRANSMITTER STT-433MHz: y The STT-433 is ideal for remote control applications where low cost and longer range is required.5-12V supply. The table depicts the eight bands in the RF spectrum. y The transmitter operates from a1.The RF spectrum is divided into several ranges. making it ideal for battery-powered applications. y The transmitter employs a SAW-stabilized oscillator. ensuring accurate frequency control for best range performance. or bands.

Noise on the power supply will degrade transmitter noise performance.01uF ceramic capacitor and filtered with a 4. This input is CMOS compatible and should be driven with CMOS level inputs.y y 1.5-12V operation Small size PIN DESCRIPTION: GND Transmitter ground. ANT 50 ohm antenna output. VCC should be bypassed with a . Antenna can be single core wire of approximately 17cm length or PCB trace antenna. The antenna port impedance affects output power and harmonic emissions. Connect to ground plane DATA Digital data input.7uF tantalum capacitor. VCC Operating voltage for the transmitter. CONNECTION: .

. whatever the microcontroller sends the data to the transmitter.The typical connection shown in the above figure cannot work exactly at all times because there will be no proper synchronization between the transmitter and the microcontroller unit. Thus.e. ENCODER HT640: PIN DESCRIPTION: . the transmitter is not able to accept this data as this will be not in the radio frequency range. process it in the range of radio frequency range and then send it to the transmitter. Thus. an encoder is used. i. we need an intermediate device which can accept the input from the microcontroller. The encoder used here is HT640 from HOLTEK SEMICONDUCTORS INC.

the encoder scans and transmits the status of the 18 bits of address/data serially in the order A0 to AD17. Once the transmission enable falls low. active high). This cycle will repeat itself as long as the transmission enable (TE or D12~D17) is held high. . If a transmission enable signal is applied. the encoder output completes its final cycle and then stops as shown below.The 318 (3 power of 18) series of encoders begins a three-word transmission cycle upon receipt of a transmission enable (TE for the HT600/HT640/HT680 or D12~D17 for the HT6187/HT6207/HT6247. logic low. Address/data programming (preset) The status of each address/data pin can be individually preset to logic high. or floating.

. transmission is enabled by applying a high signal to the TE pin. The data is transmitted on the antenna pin.Transmission enable For the TE trigger type of encoders. ASIC APPLICATION CIRCUIT OF HT640 ENCODER: DEMO CIRCUIT: Transmission Circuit The data sent from the microcontroller is encoded and sent to RF transmitter. this data should be received on the destination i. on RF receiver. But for the Data trigger type of encoders. it is enabled by applying a high signal to one of the data pins D12~D17. Thus.e.

Thus. Two Data pins are provided in the receiver module. VCC should be bypassed with a . this data can be used for further applications . Connect to ground plane. DATA Digital data output. This output is capable of driving one TTL or CMOS load. GND Receiver Ground. .1 F ceramic capacitor. PINOUT: ANT Antenna input. VCC can be applied to either or both.RF RECEIVER STR-433 MHz: The data is received by the RF receiver from the antenna pin and this data is available on the data pins. VCC (5V) VCC pins are electrically connected and provide operating voltage for the receiver. It is a CMOS compatible output. Noise on the power supply will degrade receiver sensitivity.


. Low power and high noise immunity CMOS technology. y The 3^18 decoders are a series of CMOS LSIs for remote control system applications. 8~18 address pins.PIN DESCRIPTION: Features y y y y y y y Operating voltage: 2. y The 3^18 series of decoders receives serial address and data from that series of encoders that are transmitted by a carrier using an RF medium. incoming y It then compares the serial input data twice continuously with its local address. 0~8 data pins. They are paired with the 3^18 series of encoders. Capable of decoding 18 bits of information. Low standby current.4V~12V. y For proper operation. y A signal on the DIN pin then activates the oscillator which in turns decodes the address and data. a pair of encoder/decoder pair with the same number of address and data format should be selected. Pairs with HOLTEK s 318 series of encoders.


If no errors or unmatched codes are encountered, the input data codes are decoded and then transferred to the output pins.


The VT pin also goes high to indicate a valid transmission. That will last until the address code is incorrect or no signal has been received.


The 3^18 decoders are capable of decoding 18 bits of information that consists of N bits of address and 18 N bits of data.


DEMO CIRCUIT: Reception circuit

The data transmitted into the air is received by the receiver. The received data is taken from the data line of the receiver and is fed to the decoder .The output of decoder is given to microcontroller and then data is processed according to the applications.

This AT command tutorial is written to support our Teltonika T-ModemUSB, a USB2.0 GSM modem based on the Nokia 12i GSM module - fast EDGE technology is supported. Some of the most popular applications are SMS based telemetry, security and news broadcasting. Steps using AT commands to send and receive SMS using a GSM modem from a computer 1. Setting up GSM modem 2. Using the HyperTerminal 3. Initial setup AT commands 4. Sending SMS using using AT commands 5. Receiving SMS using using AT commands 6. Using a computer program to send and receive SMS After succesfully sending and receiving SMS using AT commands via the HyperTerminal, developers can 'port' the ASCII instructions over to their programming environment, eg. Visual Basic, C/C++ or Java and also programmically parse ASCII messages from modem. 1. Setting up your GSM modem Most GSM modems comes with a simple manual and necessary drivers. To setup your TModemUSB, 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. Most GSM modems comes with a simple manual and necessary drivers. To setup your TModemUSB, 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. 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 connection, eg. "My USB GSM Modem". Suggested settings :: - COM Port :: As indicated in the T-Modem Control Tool - Bits per second :: 230400 ( or slower ) - Data Bits : 8 - Parity : None - Stop Bits : 1 - Flow Control : Hardware You 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. The Initial setup AT commands are

GSM AT Commands:


Returns a "OK" to confirm that modem is working To enter the PIN for your SIM ( if enabled ) Reply confirms your modem is connected to GSM network Indicates the signal strength, 31.99 is maximum. To format SMS as a TEXT message

AT+CSCA="+xxxxx" Set your SMS center's number. Check with your provider. AT+CMGS="+yyyyy" <Enter> > Your SMS text message here <Ctrl-Z>

The "+yyyyy" is your receipent's mobile number. AT+CNMI=1,2,0,0,0 Set how the modem will response when a SMS is 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 AT+CMGR=3 <Enter> AT command to send read the received SMS from modem at 3rd slot.

+CMGR: "REC READ","+61xxxxxx",,"04/08/28,22:26:29+40" This is the new SMS received by the GSM modem AT+CMGD=3 <Enter> To clear the SMS receive memory location in the GSM modem.


The power supplies are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronic circuits and other devices. A RPS (Regulated Power Supply) is the Power Supply with Rectification, Filtering and Regulation being done on the AC mains to get a Regulated power supply for Microcontroller and for the other devices being interfaced to it.

instead they are linked by . Transformers work only with AC and this is one of the reasons why mains electricity is AC. Transformers convert AC electricity from one voltage to another with little loss of power. each of which performs a particular function. A d. Step-up transformers increase in output voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains voltage to a safer low voltage.A power supply can by broken down into a series of blocks. step-down transformers decrease in output voltage.c mains fluctuations or load variations is known as ³Regulated D.c power supply which maintains the output voltage constant irrespective of a.C Power Supply´ For example a 5V regulated power supply system as shown below: Transformer: A transformer is an electrical device which is used to convert electrical power from one Electrical circuit to another without change in frequency. There is no electrical connection between the two coils. The input coil is called the primary and the output coil is called the secondary.

The ratio of the number of turns on each coil. Note that as voltage is stepped down current is stepped up. called the turn¶s ratio. An Electrical Transformer Turns ratio = Vp/ VS = Np/NS Power Out= Power In VS X IS=VP X IP Vp = primary (input) voltage Np = number of turns on primary coil Ip = primary (input) current . and a small number of turns on its secondary (output) coil to give a low output alternating magnetic field created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent the core. determines the ratio of the voltages. A step-down transformer has a large number of turns on its primary (input) coil which is connected to the high voltage mains supply. Transformers waste very little power so the power out is (almost) equal to the power in.

The process of conversion ac to dc is called ³rectification´ TYPES OF RECTIFIERS: y y Half wave Rectifier Full wave Rectifier 1. .RECTIFIER: A circuit which is used to convert ac to dc is known as RECTIFIER. Bridge type full bridge rectifier. Centre tap full wave rectifier. 2.

the diodes D2 and D3 are in forward biased while D1 and D4 are in reverse biased as shown in the fig(b). This is a widely used configuration. Bridge Rectifier: A bridge rectifier makes use of four diodes in a bridge arrangement to achieve fullwave rectification. both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally.Full-wave Rectifier: From the above comparison we came to know that full wave bridge rectifier as more advantages than the other two rectifiers. A bridge rectifier makes use of four diodes in a bridge arrangement as shown in fig (a) to achieve full-wave rectification. . The current flow direction is shown in the fig (b) with dotted arrows. Fig (A) Operation: During positive half cycle of secondary. This is a widely used configuration. both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally. in our project we are using full wave bridge rectifier circuit. So.

Fig(C) Filter: A Filter is a device which removes the ac component of rectifier output but allows the dc component to reach the load. The current flow direction is shown in the fig (c) with dotted arrows. the diodes D1 and D4 are in forward biased while D2 and D3 are in reverse biased as shown in the fig(c).Fig (B) During negative half cycle of secondary voltage. Capacitor Filter: .

(b) An inductor. r = ripple factor. provides an easier by ±pass for the ripples voltage though it due to low impedance. Filtering is performed by a large value electrolytic capacitor connected across the DC supply to act as a reservoir. one applied on half wave rectifier and another with full wave rectifier.We have seen that the ripple content in the rectified output of half wave rectifier is 121% or that of full-wave or bridge rectifier or bridge rectifier is 48% such high percentages of ripples is not acceptable for most of the applications. Filtering significantly increases the average DC voltage to almost the peak value (1. in parallel to the load. multiple section filter etc. Regulator: Voltage regulator ICs is available with fixed (typically 5. (a) A capacitor.4 × RMS value). (c) Various combinations of capacitor and inductor. and then discharges as it supplies current to the output. The maximum current they can pass also rates them. C = ¼*¥3*f*r*Rl Where. 12 and 15V) or variable output voltages. To calculate the value of capacitor(C). which make use of both the properties mentioned in (a) and (b) above. Two cases of capacitor filter. in series with the load. prevents the passage of the ripple current (due to high impedance at ripple frequency) while allowing the dc (due to low resistance to dc). f = supply frequency. supplying current to the output when the varying DC voltage from the rectifier is falling. Ripples can be removed by one of the following methods of filtering. to appear at the load. Negative voltage regulators .C. Rl = load resistance Note: In our circuit we are using 1000 F hence large value of capacitor is placed to reduce ripples and to improve the DC component. At ripple frequency and leave the D. such as L-section filter section filter. The capacitor charges quickly near the peak of the varying DC.

When used as a zener diode/resistor combination replacement. 12V. . Fig 6. 9V. You simply connect the positive lead of your unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin. Most regulators include some automatic protection from excessive current ('overload protection') and overheating ('thermal protection'). Many of the fixed voltage regulators ICs have 3 leads and look like power transistors. the LM78XX usually results in an effective output impedance improvement of two orders of magnitude.0V. 6V. Features: ‡ Output Current of 1.1. The LM78XX offer several fixed output voltages making them useful in wide range of applications. 24V.5A ‡ Output Voltage Tolerance of 5% ‡ Internal thermal overload protection ‡ Internal Short-Circuit Limited ‡ Output Voltage 5. connect the negative lead to the Common pin and then when you turn on the power.6 A Three Terminal Voltage Regulator 78XX: The Bay Linear LM78XX is integrated linear positive regulator with three terminals. TO-220 & TO-263packages. The LM78XX is available in the TO-252. The LM7805 is simple to use. 10V. such as the 7805 +5V 1A regulator shown on the right. 15V. 8V. you get a 5 volt supply from the output pin. mainly for use in dual supplies.are available. lower quiescent current. 18V.


To the ambulance system. which shall be used to control the traffic signals.CHAPTER 5 System Design Designing of this system is possible when you select the specific controller to suite. When ambulance comes nearby (for example 100 mts) the traffic post. the IR transmitter sents a signal to ambulance indicating that ambulance is nearby the traffic post. For this we selected 89S52 controller. Immediately traffic post system receives the signal by using RF receiver. intelligent ambulance which will reach the hospitals without any problem in heavy traffics. With the help of 89S52 controller. give green signal to ambulance to cross the traffic post. IR receiver receives that signals and amubalance system shall send the signal to traffic post system mentioning that ambulance has arrived at the post using Rf transmitter. RF and GSM technology. And at traffic post. we shall connect IR receiver to receive the signal from IR transmitter which shall be connected near to the traffic post. GSM modem is used to communicate with hospital for informing the status of the patient in ambulance.The system can be implemented successfully with the help IR. And also connect the RF transmitter and GSM modem to ambulance system. . we shall connect another system.

1.3 P1.0/AD0 P0.2 P1.1/A9 P2.4/AD4 P0.7/RD XTAL2 P1.7 RST EA/VPP ALE/PROG PSEN P2. July 15.6/AD6 P0.7/AD7 40 39 38 37 36 35 34 33 32 1 2 3 4 5 6 7 8 J2 POT gnd vcc 3 RS W EN P0.1/AD1 P0.1 P0.3/A11 P2.7/A15 P2.5/T1 P3.0 P1.0 P0.2/AD2 P0.1 Hardware Design: 5.6/A14 P2.0/RXD P3.6 P1.6/WR P3. 2010 Sheet 1 of 1 Rev <Rev Code> .3 P0.2/A10 P2.3/AD3 P0.4 P0.4/A12 P2.2 P0.4 P1.4/T0 P3.7 VCC GND TXD RXD SW1 C1 C CON8 R4 R MAX232 1 2 1 U6 t/f 4pin)   1 3 4 2 2 C9 = 1000UF/25V C LM7805/TO 3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 VCC C3 Title <Title> LED D5 Size A Date: Document Number <Doc> Thursday .5/AD5 P0.1 P1.5.0/A8 31 30 29 J2 28 27 26 25 24 23 22 21 1 2 3 4 5 6 7 8 CON8 U1 VCC P0.3/INT1 P3.1 Schematic J3 LCD VCC R6 CAP C7 U3 C4 2 6 P2 5 9 4 8 3 7 2 6 1 CONNECTOR DB9 J7 CON2 CAP 14 13 7 8 T1OUT R1IN T2OUT R2IN V+ VC2+ C2T1IN R1OUT T2IN R2OUT C1+ C11 3 4 5 11 12 10 9 CAP C5 VCC CAP C6 J3 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 9 J4 1 2 3 4 5 6 7 8 CON8 CAP Y1 CRY STAL C2 19 CAP D1 DIODE D2 DIODE D4 DIODE D6 DIODE U5 +5V VIN GND 1 VOUT 2 C8 104 R5 R AT89S52 20 3 4 XTAL1 GND CON8 RXD TXD 10 11 12 13 14 15 16 17 18 P3.5 P0.5 P1.2/INT0 P3.5/A13 P2.1/TXD P3.6 P0.

Let us see the pin connections of each and every device with the microcontroller in detail.2. This schematic explanation includes the detailed pin connections of every device with the microcontroller. Microcontroller: The microcontroller AT89S52 with Pull up resistors at Port0 and crystal oscillator of 11. Power Supply: In this process we are using a step down transformer. Schematic Description The main aim of this power supply is to convert the 230V AC into 5V DC in order to give supply for the TTL.0592 MHz crystal in conjunction with couple of capacitors of is placed at 18th & 19th pins of 89S51 to make it work (execute) properly. EN are connected to pin2. respectively This is connected to the port P2 of the Microcontroller through the decoder and encoder for transmitter and receiver circuit LCD: The LCD data lines are connected to port 0 of the microcontroller in the schematic and the control signals like RS.1.3 of port 1.5. The secondary is connected to the opposite terminals of the Bridge rectifier as the input. . This schematic explanation includes the detailed pin connections of every device with the microcontroller. The bridge rectifier converts the AC coming from the secondary of the transformer into pulsating DC. From other set of opposite terminals we are taking the output to the rectifier. a bridge rectifier. a smoothing circuit and the RPS. RF Module: The RF transmitter and receiver are input and output devices. The RPS regulates the voltage as per our requirement. The output of this rectifier is further given to the smoother circuit which is capacitor in our project. The smoothing circuit eliminates the ripples from the pulsating DC and gives the pure DC to the RPS to get a constant output DC voltage. At the primary of the transformer we are giving the 230V AC supply.

Single-board computers and emulators support all avr derive--atives and help you to get more projects completed on engineer to the student just learning about embedded software . Keil development tools for the MC architecture support every level of software developer from the professional applications development. GSM module: Here the modem is connected to microcontroller by using serial port of 89S52. Tool configuration.e. Tx and Rx signals (pin 10. compile. It encapsulates the following components: y y y y y A project manager. A make facility. and debug embedded programs. This is connected to the port P3 of the Microcontroller. macro assemblers. i. The industry-standard keil C compilers.SOFTWARE Components 5.2. time Kernels. This software is used for execution of microcontroller programs.real. debuggers.IR Module: The IR transmitter and receiver are input and output devices.1. Editor.. A powerful debugger. ABOUT SOFTWARE Software used is: *Keil software for C programming *Express PCB for lay out design *Express SCH for schematic design KEIL µVision3 µVision3 is an IDE (Integrated Development Environment) that helps you write. 11) 5.2.

I/O ports. Version 5. SPI. One can learn almost everything you need to know about Express PCB from the help topics included with the programs given. you can write and test applications before target h/w is available.Interrupts. and memory options for you. This software enables the user to draw the Schematics with drag and drop options. MONADI. Details: Express PCB. The Embedded C Programming Language forms the user friendly language with access over Port addresses. use the MON51. The keil software development tools are designed to solve the complex problems facing embedded software developers.6. the ISD51 In-System Debugger. SFR Register addresses etc. UART. with simulation.6. Express PCB Express PCB is a Circuit Design Software and PCB manufacturing service. A/D converter. This Embedded C Language is different from the generic C language in few things like a) Data types b) Access over the architecture addresses.schedule. A Quick Start Guide is provided by which the user can learn how to use it. Simulation helps you understand h/w configurations and avoids time wasted on setup problems. y Numerous example programs are included to help you get started with the most popular embedded avr devices. Version 5. CAN.0 EMBEDDED C: The programming Language used here in this project is an Embedded C Language. y The keil µ Vision debugger accurately simulates on-chip peripherals(PC. linker. assembler. Details: Express SCH. or flash MON51 target monitors. y When you are ready to begin testing your s/w application with target h/w. y When starting a new project. simply select the microcontroller you the device database and the µvision IDE sets all compiler. D/A converter and PWM modules)of your avr device. . or the ULINK USBJTAG adapter to download and test program code on your target system. MON390.0 Express SCH The Express SCH schematic design program is very easy to use. Additionally.

we have only 7 bits for the magnitude of the signed number. As a result.Signed char: o o Used to represent the or + values.767 SFR bit addressable only RAM bit addressable only RAM addresses 80-FFH only .768 to +32. Embedded C Data types: Data Types unsigned char signed char unsigned int signed int sbit Bit sfr Size in Bits 8-bit 8-bit 16-bit 16-bit 1-bit 1-bit 8-bit Data Range/Usage 0-255 -128 to +127 0 to 65535 -32. giving us values from 128 to +127.

and links the files in your project. and debug embedded programs.Rebuild all target files or Build target. several example programs (located in the \C51\Examples. assemble. A make facility. assembles. and link) an application in µVision2.UV2). To help you get started. \C166\Examples.  HELLO is a simple program that prints the string "Hello World" using the Serial Interface. you must: 1. you must: . Select Project . µVision2 compiles.\Examples) are provided. 166\EXAMPLES\HELLO\HELLO. SOFTWARE µVision3 µVision3 is an IDE (Integrated Development Environment) that helps you write. Editor. Building an Application in µVision2: To build (compile. and \ARM\. It encapsulates the following components: y y y y y A project manager. A powerful debugger.. Creating Your Own Application in µVision2 To create a new project in µVision2. 2. Select Project .CHAPTER 6 Implementation The applications as discussed in the design are implemented and the source code related to the current work is pasted in the appendix.. Tool configuration.(for example. compile. \C251\Examples.

Files. main in the Output Window to execute to the main C function. Debug your program using standard options like Step. you must: 1.e. Select Project . You can see these names in the Project New Project . Add/Files. Break.New Project. Note when you select the target device from the Device Database all special options are set automatically. 2. You may enter G. You can simply use the icon Create New Folder in this dialog to get a new empty folder.Start/Stop Debug Session. Create source files to add to the project.1. and add the source files to the project.Options and set the tool options. Select Debug . or C16x/ST10 device from the Device Database . 6. We suggest that you use a separate folder for each project. µVision2 creates a new project file with the name PROJECT1. Use the Step toolbar buttons to single-step through your program.UV2 which contains a default target and file group name. 2. Select Project . Select Project . Then select this folder and enter the file name for the new project. Select Project . Open the Serial Window using the Serial #1 button on the toolbar.Rebuild all target files or Build target. 5. 4. This opens a standard Windows dialog that asks you for the new project file . Project1.Select Device and select an 8051. 3. 3.Targets. Go. Groups. select Source Group1. To create a new project file select from the µVision2 menu Project name. Select a directory and enter the name of the project file. i. You typically only need to configure the memory map of your target hardware. 251. Debugging an Application in µVision2 To debug an application created using µVision2. 7. and so on. Starting µVision2 and creating a Project µVision2 is a standard Windows application and started by clicking on the program icon. Default memory model settings are optimal for most applications. Select Project .

We are using for our examples the Philips 80C51RD+ CPU. write. Once you have successfully generated your application you can start debugging. You may start your PROM programming utility after the make process when you specify the program under the option Run User Program #1. or code execution access. This selection sets necessary tool options for the 80C51RD+ device and simplifies in this way the tool Configuration Building Projects and Creating a HEX Files Typical. CPU Simulation µVision2 simulates up to 16 Mbytes of memory from which areas can be mapped for read.Window Files. Just select the microcontroller you use. After you have tested your application. the tool settings under Options Target are all you need to start a new application. A double click on a message line opens the source file on the correct location in a µVision2 editor window. The µVision2 simulator traps and reports illegal memory accesses being done. . it is required to create an Intel HEX file to download the software into an EPROM programmer or simulator. µVision2 will display errors and warning messages in the Output Window Build page. The Select Device dialog box shows the µVision2 device database. µVision2 creates HEX files with each build process when Create HEX files under Options for Target Output is enabled. When you build an application with syntax errors. Now use from the menu Project Select Device for Target and select a CPU for your project. You may translate all source files and line the application with a click on the Build Target toolbar icon.

Start Debugging You start the debug mode of µVision2 with the Debug Depending on the Options for Target Start/Stop Debug Session command. Disassembly Window The Disassembly window shows your target program as mixed source and assembly program or just assembly code. µVision2 opens an editor window with the source text or shows CPU instructions in the disassembly window. set Debug Enable/Disable Trace Recording.In addition to memory mapping. The next executable statement is marked with a yellow arrow. . µVision2 will load the application program and run the startup code µVision2 saves the editor screen layout and restores the screen layout of the last debug session. The on-chip peripherals of the CPU you have selected are configured from the Device Database selection You have made when you create your project target. To enable the trace history. For example. If the program execution stops. You may select and display the on-chip peripheral components using the Debug menu. A trace history of previously executed instructions may be displayed with Debug View Trace Records. _ The project structure or tool parameters cannot be modified. During debugging. the simulator also provides support for the integrated peripherals of the various 8051 derivatives. Program source text of your application is shown in the same windows. You can also change the aspects of each peripheral using the controls in the dialog boxes. Debug Configuration. The µVision2 debug mode differs from the edit mode in the following aspects: _ The Debug Menu and Debug Commands described on page 28 are Available. you can use the find command or correct program errors. most editor features are still available. All build Commands are disabled. The additional debug windows are discussed in the following. Refer to page 58 for more Information about selecting a device.

First we shall write diagnostic code to test the basic functionality of the each device connected to the system.In all low end applications now a days we are using 8051 controllers like industrial automation and data acquisition. Then we write our application and test its very easy to use for any applications with the help of 8051 controller. RF encoder and decoders we will connect to port pins at transmitting and receiving sides. . That allows you to correct mistakes or to make temporary changes to the target program you are debugging. CHAPTER 8 Results and Evaluation This chpater lists down the results realized from the practical work and examines whether ideas/solution approaches recommended in research are met by the practical implementation. You may use the dialog Debug Inline Assembly to modify the CPU instructions. CHAPTER 7 System Testing The system can be tested with the use of KEIL compiler. This one we are using to write programs for 8051 controller. Because now a days IR.If you select the Disassembly Window as the active window all program step commands work on CPU instruction level rather than program source lines. You can select a text line and set or modify code breakpoints using toolbar buttons or the context menu commands. RF and GSM technology became very popular. After writing programs using 8051 programmer we can dump code in to the controller. .

For low end applications this controller is very easy to use and at the same time RF also widely accepted protocol for mobile communication.h> #include"lcd. Traffic post system #include<reg51.128B RAM and 4kB on-chip Flash Program Memory.h" sbit gl= P3^4.CHAPTER 9 Conclusion With this we can conclude that the system which has developed by using controller having the following features like 8 bit 8051 architecture in a tiny 40 pin DIP package. . But there may be some limitations and constraits which we have to look into it. References [1] 8051 Architecture and Programming by Mazidi [2] 8051 Programming by Ayala [3] MAX232 user guide by MAXIM semiconductors [4] Wikipedia [5] RF Technology [6] GSM AT commands user manual Appendix Source code. can be really used in real time environment.

while(rf==0). lcd_init().sbit rl= P3^5. msgdisplay(" INTELLIGENT AMBULANCE "). if(ch=='A') { // wait to rceive data (VT monitor) lcdcmd(0x80). void main() { unsigned char ch. . lcdcmd(0x80). delay(600). msgdisplay(" NO AMBULANCE "). delay(600). while(1) { lcdcmd(0x01). ch=P2. while(rf==1). sbit rf=P3^7.

rl=0. rl=1. delay(100). . delay(100). } if(ch=='*') { ARRIVED ").gl=1. msgdisplay(" AMBULANCE gl=0. lcdcmd(0x80). msgdisplay(" NO AMBULANCE gl=1.. } if(ch=='B') { lcdcmd(0x80). rl=0. delay(100). ").

void Modem_send(unsigned char *). ARRIVED "). } } } Ambulance system: #include<reg51. delay(100).unsigned char *)..} if(ch=='#') { lcdcmd(0x80). rl=1. void GSM_Init(void). . msgdisplay(" AMBULANCE gl=0.h" void Enter(void). void send_sms(unsigned char *.h> #include"lcd.

1 stop bit. sbit rf=P3^7. ld=0..1 start bit TMOD = 0x20. void main() { SCON = 0x50. while(1) { .8 bit Auto Reload //Baud Rate 9600 delay(500).. ld=1. lcd_init()... delay(500). //Timer 1. GSM_Init().8 bit data.. TR1 = 1. ld=1. sbit ld= P3^3.. ld=0..void Delay1(unsigned int). msgdisplay(" INTELLIGENT AMBULANCE "). //Mode 1. delay(500). TH1 = 0xFD.Mode 2... sbit ir= P3^4..

P2='*'. delay(50). msgdisplay(" NO AMBULANCE ld=1. } while(ir==0) //ambulance arrived . rf=0. delay(50). rf=1. lcdcmd(0x80). P2='A'. rf=0.while(ir==1) // no ambulance { lcdcmd(0x01). rf=1. ").

rf=0. rf=0. send_sms("AT+CMGS=\"8142154992\"". rf=1. P2='B'.{ lcdcmd(0x01). } . delay(50)."PATIENT UNDER CRICITAL CONDITION"). ARRIVED ")."PATIENT UNDER CRICITAL CONDITION"). P2='#'. //send_sms("AT+CMGS=\"8978987877\"". delay(50). delay(50). rf=1. msgdisplay(" AMBULANCE ld=0. lcdcmd(0x80).

Delay1(100). Delay1(100). lcdcmd(0x01). Modem_send("AT+IPR=9600").0"). msgdisplay("GSM Initializing"). } void Modem_send(unsigned char *ch) . Modem_send("AT+CNMI=2. Modem_send("AT").} } void GSM_Init(void) { lcdcmd(0x01).0. Modem_send("ATE0").0. Modem_send("AT+CMGF=1"). msgdisplay("GSM Initialized"). Modem_send("AT&W").1. Modem_send("AT+CSMS=0").

{ unsigned char cha; while(*ch) { SBUF = *ch; while(TI == 0); TI = 0; ch++; } Enter(); TI = 0; RI = 0; while(1) { while(RI == 0); RI = 0; cha = SBUF; if(cha == 'O'); while(RI == 0); RI = 0; cha = SBUF; if(cha == 'K') break;

SBUF = 'A'; while(TI == 0); TI = 0; SBUF = '/'; while(TI == 0); TI = 0; } TI = 0; RI = 0; }

void send_sms(unsigned char *No,unsigned char *v) { unsigned char ch1='X'; while(*No) { SBUF=*No; while(TI==0); TI=0; No++; } Enter(); while(ch1!='>')

{ while(RI==0); ch1=SBUF; RI=0; } while(*v) { SBUF=*v; while(TI==0); TI=0; v++; }

RI=0; TI=0; SBUF=0x1A; while(TI==0); TI=0; RI=0; } void Delay1(unsigned int itime)

{ unsigned int i. } .k=0.i<itime.k<1000.i++) for(k=0.k++). for(i=0.