Você está na página 1de 99

AUTOMATIC DRUNKEN DRIVE AVOIDING SYSTEM FOR AUTOMABILES

ABSTRACT

AIM: The main aim of this project is to detect drunken driver automatically to avoid accidents for automobiles.

DESCRIPTION: In this project we have to detect that there are drunken driver or is there any high temperature while driving in automobiles. For this we are using LM35 (Temperature sensor), Alcohol sensor, ADC 0808 (Analog to Digital Converter), LDR, Break Indicator, Relay, LCD (Liquid Crystal Display). LM35 is precision integrated circuit temperature sensor. Its output voltage is linearly proportional to temperature (in Celsius).

LDR A photo resistor or light dependent resistor (LDR) or cadmium sulfide (CdS) cell is resistor whose resistance decrease s with increasing incident light intensity. It can also be referred to as a photoconductor

The LM35 thus has an advantage over linear temperature sensors calibrated in Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling. AD converters are used virtually everywhere where an analog signal has to be processed, stored, or transported in digital form. For example drunken driver driving the car, then SENSOR Sensor is the device which converts any physical quantity to its Equivalent electrical signal. There are different types of sensor are available there are: Temperature sensor, Light sensor, Voltage sensor, Smoke Sensor, Gas sensor, Fire sensor, Alcohol Sensors, etc. alcohol sensor detects it and passes the information through ADC to Microcontroller. Then Break Indicator stops the car and bulb will OFF automatically and displays LCD. These operations are controlled by Microcontroller.

CHAPTER-1

EMBEDDED SYSTEMS Introduction: An embedded system is a system which is going to do a predefined specified task is the embedded system and is even defined as combination of both software and hardware. A generalpurpose definition of embedded systems is that they are devices used to control, monitor or assist the operation of equipment, machinery or plant. "Embedded" reflects the fact that they are an integral part of the system. At the other extreme a general-purpose computer may be used to control the operation of a large complex processing plant, and its presence will be obvious. All embedded systems are including computers or microprocessors. Some of these computers are however very simple systems as compared with a personal computer. The very simplest embedded systems are capable of performing only a single function or set of functions to meet a single predetermined purpose. In more complex systems an application program that enables the embedded system to be used for a particular purpose in a specific application determines the functioning of the embedded system. The ability to have programs means that the same embedded system can be used for a variety of different purposes. In some cases a microprocessor may be designed in such a way that application software for a particular purpose can be added to the basic software in a second process, after which it is not possible to make further changes. The applications software on such processors is sometimes referred to as firmware. The simplest devices consist of a single microprocessor (often called a "chip), which may itself be packaged with other chips in a hybrid system or Application Specific Integrated Circuit (ASIC). Its input comes from a detector or sensor and its output goes to a switch or activator which (for example) may start or stop the operation of a machine or, by operating a valve, may control the flow of fuel to an engine. As the embedded system is the combination of both software and hardware

Embedded System

Software

Hardware

o o o

ALP C VB Etc.,

o o o

Processor Peripherals memory

Figure: Block diagram of Embedded System Software deals with the languages like ALP, C, and VB etc., and Hardware deals with Processors, Peripherals, and Memory. Memory: It is used to store data or address. Peripherals: These are the external devices connected Processor: It is an IC which is used to perform some task Applications of embedded systems y y y y y y y y y y Manufacturing and process control Construction industry Transport Buildings and premises Domestic service Communications Office systems and mobile equipment Banking, finance and commercial Medical diagnostics, monitoring and life support Testing, monitoring and diagnostic systems

Processors are classified into four types like:  Micro Processor (p)  Micro controller (c)  Digital Signal Processor (DSP)  Application Specific Integrated Circuits (ASIC) Micro Processor (p): A silicon chip that contains a CPU. In the world of personal computers, the terms microprocessor and CPU are used interchangeably. At the heart of all personal computers and most workstations sits a microprocessor. Microprocessors also control the logic of almost all digital devices, from clock radios to fuel-injection systems for automobiles. Three basic characteristics differentiate microprocessors:  Instruction set: The set of instructions that the microprocessor can execute.  Bandwidth : The number of bits processed in a single instruction.  Clock speed : Given in megahertz (MHz), the clock speed determines how many instructions per second the processor can execute. In both cases, the higher the value, the more powerful the CPU. For example, a 32-bit microprocessor that runs at 50MHz is more powerful than a 16-bit microprocessor that runs at 25MHz. In addition to bandwidth and clock speed, microprocessors are classified as being either RISC (reduced instruction set computer) or CISC (complex instruction set computer). A microprocessor has three basic elements, as shown above. The ALU performs all arithmetic computations, such as addition, subtraction and logic operations (AND, OR, etc). It is controlled by the Control Unit and receives its data from the Register Array. The Register Array is a set of registers used for storing data. These registers can be accessed by the ALU very quickly. Some registers have specific functions - we will deal with these later. The Control Unit controls the entire process. It provides the timing and a control signal for getting data into and out of the registers and the ALU and it synchronizes the execution of instructions (we will deal with instruction execution at a later date).

Three Basic Elements of a Microprocessor Micro Controller (c): A microcontroller is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications.

ALU CU Memory

Timer, Counter, serial communication ROM,

Figure: Block Diagram of Micro Controller (c)

Digital Signal Processors (DSPs): Digital Signal Processors is one which performs scientific and mathematical operation. Digital Signal Processor chips - specialized microprocessors with architectures designed specifically for the types of operations required in digital signal processing. Like a generalpurpose microprocessor, a DSP is a programmable device, with its own native instruction code. DSP chips are capable of carrying out millions of floating point operations per second, and like their better-known general-purpose cousins, faster and more powerful versions are continually being introduced. DSPs can also be embedded within complex "system-on-chip" devices, often containing both analog and digital circuitry. Application Specific Integrated Circuit (ASIC) ASIC is a combination of digital and analog circuits packed into an IC to achieve the desired control/computation function ASIC typically contains  CPU cores for computation and control  Peripherals to control timing critical functions  Memories to store data and program  Analog circuits to provide clocks and interface to the real world which is analog in nature  I/Os to connect to external components like LEDs, memories, monitors etc. Computer Instruction Set There are two different types of computer instruction set there are: 1. RISC (Reduced Instruction Set Computer) and 2. CISC (Complex Instruction Set computer) Reduced Instruction Set Computer (RISC) A RISC (reduced instruction set computer) is a microprocessor that is designed to perform a smaller number of types of computer instruction so that it can operate at a higher speed (perform more million instructions per second, or millions of instructions per second). Since each instruction type that a computer must perform requires additional transistors and circuitry, a larger list or set of computer instructions tends to make the microprocessor more complicated and slower in operation. Besides performance improvement, some advantages of RISC and related design improvements are:

 A new microprocessor can be developed and tested more quickly if one of its aims is to be less complicated.  Operating system and application programmers who use the microprocessor's instructions will find it easier to develop code with a smaller instruction set.  The simplicity of RISC allows more freedom to choose how to use the space on a microprocessor. Higher-level language compilers produce more efficient code than formerly because they have always tended to use the smaller set of instructions to be found in a RISC computer. RISC characteristics  Simple instruction set: In a RISC machine, the instruction set contains simple, basic instructions, from which more complex instructions can be composed.  Same length instructions. Each instruction is the same length, so that it may be fetched in a single operation.  1 machine-cycle instructions. Most instructions complete in one machine cycle, which allows the processor to handle several instructions at the same time. This pipelining is a key technique used to speed up RISC machines. Complex Instruction Set Computer (CISC) CISC, which stands for Complex Instruction Set Computer, is a philosophy for designing chips that are easy to program and which make efficient use of memory. Each instruction in a CISC instruction set might perform a series of operations inside the processor. This reduces the number of instructions required to implement a given program, and allows the programmer to learn a small but flexible set of instructions. The advantages of CISC At the time of their initial development, CISC machines used available technologies to optimize computer performance.  Microprogramming is as easy as assembly language to implement, and much less expensive than hardwiring a control unit.  The ease of micro-coding new instructions allowed designers to make CISC machines upwardly compatible: a new computer could run the same programs as earlier computers because the new computer would contain a superset of the instructions of the earlier computers.

 As each instruction became more capable, fewer instructions could be used to implement a given task. This made more efficient use of the relatively slow main memory.  Because micro program instruction sets can be written to match the constructs of high-level languages, the compiler does not have to be as complicated. The disadvantages of CISC Still, designers soon realized that the CISC philosophy had its own problems, including:  Earlier generations of a processor family generally were contained as a subset in every new version --- so instruction set & chip hardware become more complex with each generation of computers.  So that as many instructions as possible could be stored in memory with the least possible wasted space, individual instructions could be of almost any length---this means that different instructions will take different amounts of clock time to execute, slowing down the overall performance of the machine.  Many specialized instructions aren't used frequently enough to justify their existence --approximately 20% of the available instructions are used in a typical program.  CISC instructions typically set the condition codes as a side effect of the instruction. Not only does setting the condition codes take time, but programmers have to remember to examine the condition code bits before a subsequent instruction changes them. Memory Architecture There two different types memory architectures there are:  Harvard Architecture  Von-Neumann Architecture Harvard Architecture Computers have separate memory areas for program instructions and data. There are two or more internal data buses, which allow simultaneous access to both instructions and data. The CPU fetches program instructions on the program memory bus. The Harvard architecture is a computer architecture with physically separate storage and signal pathways for instructions and data. The term originated from the Harvard Mark I relay-based computer, which stored instructions on punched tape (24 bits wide) and data in electromechanical counters. These early machines had limited data storage, entirely contained within the central processing unit, and provided no access to the instruction storage as data. Programs needed to be loaded by an operator, the processor could not boot itself.

Figure: Harvard Architecture

Modern uses of the Harvard architecture


The principal advantage of the pure Harvard architecture - simultaneous access to more than one memory system - has been reduced by modified Harvard processors using modern CPU cache systems. Relatively pure Harvard architecture machines are used mostly in applications where tradeoffs, such as the cost and power savings from omitting caches, outweigh the programming penalties from having distinct code and data address spaces.  Digital signal processors (DSPs) generally execute small, highly-optimized audio or video processing algorithms. They avoid caches because their behavior must be extremely reproducible. The difficulties of coping with multiple address spaces are of secondary concern to speed of execution. As a result, some DSPs have multiple data memories in distinct address spaces to facilitate SIMD and VLIW processing. Texas Instruments TMS320 C55x processors, as one example, have multiple parallel data busses (two write, three read) and one instruction bus.  Microcontrollers are characterized by having small amounts of program (flash memory) and data (SRAM) memory, with no cache, and take advantage of the Harvard architecture to speed processing by concurrent instruction and data access. The separate storage means the program and data memories can have different bit depths, for example using 16-bit wide instructions and 8-bit wide data. They also mean that instruction pre-fetch can be performed in parallel with other activities. Examples include, the AVR by Atmel Corp, the PIC by Microchip Technology, Inc. and the ARM Cortex-M3 processor (not all ARM chips have Harvard architecture). Even in these cases, it is common to have special instructions to access program memory as data for read-only tables, or for reprogramming.

Von-Neumann Architecture A computer has a single, common memory space in which both program instructions and data are stored. There is a single internal data bus that fetches both instructions and data. They cannot be performed at the same time The Von Neumann architecture is a design model for a stored-program digital computer that uses a central processing unit (CPU) and a single separate storage structure ("memory") to hold both instructions and data. It is named after the mathematician and early computer scientist John von Neumann. Such computers implement a universal Turing machine and have a sequential architecture. A stored-program digital computer is one that keeps its programmed instructions, as well as its data, in read-write, random-access memory (RAM). Stored-program computers were advancement over the program-controlled computers of the 1940s, such as the Colossus and the ENIAC, which were programmed by setting switches and inserting patch leads to route data and to control signals between various functional units. In the vast majority of modern computers, the same memory is used for both data and program instructions. The mechanisms for transferring the data and instructions between the CPU and memory are, however, considerably more complex than the original von Neumann architecture. The terms "von Neumann architecture" and "stored-program computer" are generally used interchangeably, and that usage is followed in this article.

Figure: Schematic of the Von-Neumann Architecture.

Basic Difference between Harvard and Von-Neumann Architecture  The primary difference between Harvard architecture and the Von Neumann architecture is in the Von Neumann architecture data and programs are stored in the same memory and managed by the same information handling system.  Whereas the Harvard architecture stores data and programs in separate memory devices and they are handled by different subsystems.  In a computer using the Von-Neumann architecture without cache; the central processing unit (CPU) can either be reading and instruction or writing/reading data to/from the memory. Both of these operations cannot occur simultaneously as the data and instructions use the same system bus.  In a computer using the Harvard architecture the CPU can both read an instruction and access data memory at the same time without cache. This means that a computer with Harvard architecture can potentially be faster for a given circuit complexity because data access and instruction fetches do not contend for use of a single memory pathway.  Today, the vast majority of computers are designed and built using the Von Neumann architecture template primarily because of the dynamic capabilities and efficiencies gained in designing, implementing, operating one memory system as opposed to two. Von Neumann architecture may be somewhat slower than the contrasting Harvard Architecture for certain specific tasks, but it is much more flexible and allows for many concepts unavailable to Harvard architecture such as self programming, word processing and so on.  Harvard architectures are typically only used in either specialized systems or for very specific uses. It is used in specialized digital signal processing (DSP), typically for video and audio processing products. It is also used in many small microcontrollers used in electronics applications such as Advanced RISK Machine (ARM) based products for many vendors.

CHAPTER-2

Introduction to Project
There many different types of accidents are occurred in day to day life time system. In order to accidents we implement project. Accidents may cause due to many regions it may a break failed system; it may any regions most offen accidents are occurred due to over drunken person. Most of accidents are due to over drunken drivers. Due to that consumption of alcohol in order to avoid these accidents we implemented a one proto types project in these project we place an alcohol sensor. This sensor used to sense the drunken person from 200ppm onwards. If the person is drunk, Initally we check the person weather person is dunked are not .This module inserted in cars or any vehicles. If the driver is dunked then sensor will sense the amount of alcohol consumed by the person and it will intimate by buzzing with the help of buzzer. In these vehicle automations also consider whenever under night times we need to ON the your vehicle headlights instead of ONing headlight with the a key we placed a LDR in the module. On night times with the help of LDR headlight will be automatically we can ONed.Similary, we consider the one more parameter engine temperature here we controlling the engine, by placing the thermistor sensor we continuously monitoring the engine, whenever over heat is occurred we automatically the cooling section in this way we are controlling the engine from damages.

BLOCK DIAGRAM:

Break Indicator

POWER SUPPLY:

Block Diagram Explanation In this project we interface the alcohol sensors to ADC 0804.Output of LDR is in digital form so we can directly interface to microcontroller (AT 89S52) and we interface the LCD to microcontroller port pins here we operating the LCD in the 4-bit mode .We can operate the LCD in two modes it may be 8-bit mode and 4-bit mode. Accidents may cause due to many regions it may a break failed system; it may any regions most offen accidents are occurred due to over drunken person. Most of accidents are due to over drunken drivers. Due to that consumption of alcohol in order to avoid these accidents we implemented a one proto types project in these project we place a alcohol sensor. This sensor used to sense the drunken person from 200ppm onwards. We are taking inputs from sensor i.e., MQ3 this is one type of alcohol sensor is given to ADC whenever some amount is alcohol detected ADC will take that analog data and converted into its equivalent digital format, these data will given to microcontroller. If maximum amount alcohol is detected then it will give intimate by buzzer sound. During in night condition we automatically controlling the headlight with the help of LDR. Similarly , we controlling and protecting the engine from over heat. If engine is over heated then we need to cool the engine in that case we providing a cooling section with the help of normal DC fan.

CHAPTER-3

Hardware Explanation Block Diagram For Power Supply

Figure: Power Supply Description Transformer A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled conductorsthe transformer's coils. A varying current in the first or primary winding creates a varying magnetic flux in the transformer's core, and thus a varying magnetic field through the secondary winding. This varying magnetic field induces a varying electromotive force (EMF) or "voltage" in the secondary winding. This effect is called mutual induction.

Figure: Transformer Symbol (or) Transformer is a device that converts the one form energy to another form of energy like a transducer.

Figure: Transformer Basic Principle A transformer makes use of Faraday's law and the ferromagnetic properties of an iron core to efficiently raise or lower AC voltages. It of course cannot increase power so that if the voltage is raised, the current is proportionally lowered and vice versa.

Figure: Basic Principle Transformer Working A transformer consists of two coils (often called 'windings') linked by an iron core, as shown in figure below. There is no electrical connection between the coils; instead they are linked by a magnetic field created in the core.

Figure: Basic Transformer

Transformers are used to convert electricity from one voltage to another with minimal loss of power. They only work with AC (alternating current) because they require a changing magnetic field to be created in their core. Transformers can increase voltage (step-up) as well as reduce voltage (step-down). Alternating current flowing in the primary (input) coil creates a continually changing magnetic field in the iron core. This field also passes through the secondary (output) coil and the changing strength of the magnetic field induces an alternating voltage in the secondary coil. If the secondary coil is connected to a load the induced voltage will make an induced current flow. The correct term for the induced voltage is 'induced electromotive force' which is usually abbreviated to induced e.m.f. The iron core is laminated to prevent 'eddy currents' flowing in the core. These are currents produced by the alternating magnetic field inducing a small voltage in the core, just like that induced in the secondary coil. Eddy currents waste power by needlessly heating up the core but they are reduced to a negligible amount by laminating the iron because this increases the electrical resistance of the core without affecting its magnetic properties. Transformers have two great advantages over other methods of changing voltage: 1. They provide total electrical isolation between the input and output, so they can be safely used to reduce the high voltage of the mains supply. 2. Almost no power is wasted in a transformer. They have a high efficiency (power out / power in) of 95% or more. Classification of Transformer  Step-Up Transformer  Step-Down Transformer Step-Down Transformer Step down transformers are designed to reduce electrical voltage. Their primary voltage is greater than their secondary voltage. This kind of transformer "steps down" the voltage applied

to it. For instance, a step down transformer is needed to use a 110v product in a country with a 220v supply. Step down transformers convert electrical voltage from one level or phase configuration usually down to a lower level. They can include features for electrical isolation, power distribution, and control and instrumentation applications. Step down transformers typically rely on the principle of magnetic induction between coils to convert voltage and/or current levels. Step down transformers are made from two or more coils of insulated wire wound around a core made of iron. When voltage is applied to one coil (frequently called the primary or input) it magnetizes the iron core, which induces a voltage in the other coil, (frequently called the secondary or output). The turns ratio of the two sets of windings determines the amount of voltage transformation.

Figure: Step-Down Transformer An example of this would be: 100 turns on the primary and 50 turns on the secondary, a ratio of 2 to 1. Step down transformers can be considered nothing more than a voltage ratio device. With step down transformers the voltage ratio between primary and secondary will mirror the "turns ratio" (except for single phase smaller than 1 kva which have compensated secondary). A practical application of this 2 to 1 turns ratio would be a 480 to 240 voltage step down. Note that if the input were 440 volts then the output would be 220 volts. The ratio between input and output voltage will stay constant. Transformers should not be operated at voltages higher than

the nameplate rating, but may be operated at lower voltages than rated. Because of this it is possible to do some non-standard applications using standard transformers. Single phase step down transformers 1 kva and larger may also be reverse connected to stepdown or step-up voltages. (Note: single phase step up or step down transformers sized less than 1 KVA should not be reverse connected because the secondary windings have additional turns to overcome a voltage drop when the load is applied. If reverse connected, the output voltage will be less than desired.) Step-Up Transformer A step up transformer has more turns of wire on the secondary coil, which makes a larger induced voltage in the secondary coil. It is called a step up transformer because the voltage output is larger than the voltage input. Step-up transformer 110v 220v design is one whose secondary voltage is greater than its primary voltage. This kind of transformer "steps up" the voltage applied to it. For instance, a step up transformer is needed to use a 220v product in a country with a 110v supply. A step up transformer 110v 220v converts alternating current (AC) from one voltage to another voltage. It has no moving parts and works on a magnetic induction principle; it can be designed to "step-up" or "step-down" voltage. So a step up transformer increases the voltage and a step down transformer decreases the voltage. The primary components for voltage transformation are the step up transformer core and coil. The insulation is placed between the turns of wire to prevent shorting to one another or to ground. This is typically comprised of Mylar, nomex, Kraft paper, varnish, or other materials. As a transformer has no moving parts, it will typically have a life expectancy between 20 and 25 years.

Figure: Step-Up Transformer Applications Generally these Step-Up Transformers are used in industries applications only. Types of Transformer Mains Transformers Mains transformers are the most common type. They are designed to reduce the AC mains supply voltage (230-240V in the UK or 115-120V in some countries) to a safer low voltage. The standard mains supply voltages are officially 115V and 230V, but 120V and 240V are the values usually quoted and the difference is of no significance in most cases.

Figure: Main Transformer To allow for the two supply voltages mains transformers usually have two separate primary coils (windings) labeled 0-120V and 0-120V. The two coils are connected in series for 240V (figure 2a) and in parallel for 120V (figure 2b). They must be wired the correct way round as shown in the diagrams because the coils must be connected in the correct sense (direction):

Most mains transformers have two separate secondary coils (e.g. labeled 0-9V, 0-9V) which may be used separately to give two independent supplies, or connected in series to create a centretapped coil (see below) or one coil with double the voltage. Some mains transformers have a centre-tap halfway through the secondary coil and they are labeled 9-0-9V for example. They can be used to produce full-wave rectified DC with just two diodes, unlike a standard secondary coil which requires four diodes to produce full-wave rectified DC.

A mains transformer is specified by: 1. Its secondary (output) voltages Vs. 2. Its maximum power, Pmax, which the transformer can pass, quoted in VA (volt-amp). This determines the maximum output (secondary) current, Imax...

...where Vs is the secondary voltage. If there are two secondary coils the maximum power should be halved to give the maximum for each coil.

3. Its construction - it may be PCB-mounting, chassis mounting (with solder tag connections) or toroidal (a high quality design). Audio Transformers Audio transformers are used to convert the moderate voltage, low current output of an audio amplifier to the low voltage, high current required by a loudspeaker. This use is called 'impedance matching' because it is matching the high impedance output of the amplifier to the low impedance of the loudspeaker.

Figure: Audio transformer Radio Transformers Radio transformers are used in tuning circuits. They are smaller than mains and audio transformers and they have adjustable ferrite cores made of iron dust. The ferrite cores can be adjusted with a non-magnetic plastic tool like a small screwdriver. The whole transformer is enclosed in an aluminum can which acts as a shield, preventing the transformer radiating too much electrical noise to other parts of the circuit.

Figure: Radio Transformer

Turns Ratio and Voltage The ratio of the number of turns on the primary and secondary coils determines the ratio of the voltages...

...where Vp is the primary (input) voltage, Vs is the secondary (output) voltage, Np is the number of turns on the primary coil, and Ns is the number of turns on the secondary coil. Diodes Diodes allow electricity to flow in only one direction. The arrow of the circuit symbol shows the direction in which the current can flow. Diodes are the electrical version of a valve and early diodes were actually called valves.

Figure: Diode Symbol A diode is a device which only allows current to flow through it in one direction. In this direction, the diode is said to be 'forward-biased' and the only effect on the signal is that there will be a voltage loss of around 0.7V. In the opposite direction, the diode is said to be 'reversebiased' and no current will flow through it.

Rectifier The purpose of a rectifier is to convert an AC waveform into a DC waveform (OR) Rectifier converts AC current or voltages into DC current or voltage. There are two different rectification circuits, known as 'half-wave' and 'full-wave' rectifiers. Both use components called diodes to convert AC into DC. The Half-wave Rectifier The half-wave rectifier is the simplest type of rectifier since it only uses one diode, as shown in figure.

Figure: Half Wave Rectifier Figure 2 shows the AC input waveform to this circuit and the resulting output. As you can see, when the AC input is positive, the diode is forward-biased and lets the current through. When the AC input is negative, the diode is reverse-biased and the diode does not let any current through, meaning the output is 0V. Because there is a 0.7V voltage loss across the diode, the peak output voltage will be 0.7V less than Vs.

Figure: Half-Wave Rectification While the output of the half-wave rectifier is DC (it is all positive), it would not be suitable as a power supply for a circuit. Firstly, the output voltage continually varies between 0V and Vs0.7V, and secondly, for half the time there is no output at all. The Full-wave Rectifier The circuit in figure 3 addresses the second of these problems since at no time is the output voltage 0V. This time four diodes are arranged so that both the positive and negative parts of the AC waveform are converted to DC. The resulting waveform is shown in figure 4.

Figure: Full-Wave Rectifier

Figure: Full-Wave Rectification When the AC input is positive, diodes A and B are forward-biased, while diodes C and D are reverse-biased. When the AC input is negative, the opposite is true - diodes C and D are forward-biased, while diodes A and B are reverse-biased. While the full-wave rectifier is an improvement on the half-wave rectifier, its output still isn't suitable as a power supply for most circuits since the output voltage still varies between 0V and Vs-1.4V. So, if you put 12V AC in, you will 10.6V DC out. Capacitor Filter The capacitor-input filter, also called "Pi" filter due to its shape that looks like the Greek letter pi, is a type of electronic filter. Filter circuits are used to remove unwanted or undesired frequencies from a signal.

Figure: Capacitor Filter A typical capacitor input filter consists of a filter capacitor C1, connected across the rectifier output, an inductor L, in series and another filter capacitor connected across the load. 1. The capacitor C1 offers low reactance to the AC component of the rectifier output while it offers infinite reactance to the DC component. As a result the capacitor shunts an appreciable amount of the AC component while the DC component continues its journey to the inductor L 2. The inductor L offers high reactance to the AC component but it offers almost zero reactance to the DC component. As a result the DC component flows through the inductor while the AC component is blocked. 3. The capacitor C2 bypasses the AC component which the inductor had failed to block. As a result only the DC component appears across the load RL.

Figure: Centered Tapped Full-Wave Rectifier with a Capacitor Filter

Voltage Regulator A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. It may use an electromechanical mechanism, or passive or active electronic components. Depending on the design, it may be used to regulate one or more AC or DC voltages. There are two types of regulator are they.  Positive Voltage Series (78xx) and  Negative Voltage Series (79xx) 78xx: 78 indicate the positive series and xxindicates the voltage rating. Suppose 7805 produces the maximum 5V.05indicates the regulator output is 5V. 79xx: 78 indicate the negative series and xxindicates the voltage rating. Suppose 7905 produces the maximum -5V.05indicates the regulator output is -5V. These regulators consists the three pins there are Pin1: It is used for input pin. Pin2: This is ground pin for regulator Pin3: It is used for output pin. Through this pin we get the output.

Figure: Regulator

CHAPTER-4

Microcontroller (AT89S52): Description of Microcontroller 89S52: The AT89S52 is a low-power, high-performance CMOS 8-bit micro controller with 8Kbytes of in-system programmable flash memory. The device is manufactured Atmels highdensity nonvolatile memory technology and is compatible with the industry-standard 80C51 micro controller. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable flash one monolithic http; the Atmel AT89S52 is a powerful micro controller, which provides a highly flexible and cost effective solution to any cost effective solution to any embedded control applications to any embedded control applications. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next interrupt Or hardware reset. Architecture of 8052C:

Figure: Microcontroller Architecture

Features: Compatible with MCS-51 Products 8K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 1000 Write/Erase Cycles 4.0V to 5.5V Operating Range Fully Static Operation: 0 Hz to 33 MHz Three-level Program Memory Lock 256K Internal RAM 32 Programmable I/O Lines 3 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 Pin Diagram:

Pin Description: VCC 40 Supply voltage. GND 20 Ground. Port 0 (32-39): Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs. Port 0 can also be configured to be the multiplexed low order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash Programming and outputs the code bytes during program verification. External pull-ups are required during program verification Port 1 (1-8): Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 Output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input P1.1/T2EX),

respectively, as shown in the following table. Port 1 also receives the low-order address bytes during Flash programming and verification.

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

RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. ALE/PROG Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the micro controller is in external execution mode. PSEN Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory. EA/VPP: External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. A should be strapped to VCC for internal program executions. This pin also receives the 12-voltProgramming enables voltage (VPP) during Flash programming.

XTAL1: Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2: Output from the inverting oscillator amplifier. Oscillator Characteristics: XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or ceramic resonator may be used. To drive the device from an External clock source, XTAL2 should be left unconnected while XTAL1 is driven.

Oscillator Connections Special Function Register (SFR) Memory: Special Function Registers (SFR s) are areas of memory that control specific functionality of the 8051 processor. For example, four SFRs permit access to the 8051s 32 input/output lines. Another SFR allows the user to set the serial baud rate, control and access timers, and configure the 8051s interrupt system. Accumulator: The Accumulator, as its name suggests is used as a general register to accumulate the results of a large number of instructions. It can hold 8-bit (1-byte) value and is the most versatile register. The R registers: The R registers are a set of eight registers that are named R0, R1. Etc. up to R7. These registers are used as auxiliary registers in many operations.

The B registers: The B register is very similar to the accumulator in the sense that it may hold an 8-bit (1-byte) value. Two only uses the B register 8051 instructions: MUL AB and DIV AB. Data Pointer: The Data pointer (DPTR) is the 8051s only user accessible 16-bit (2Bytes) register. The accumulator, R registers are all 1-Byte values. DPTR, as the name suggests, is used to point to data. It is used by a number of commands, which allow the 8051 to access external memory. Programs counter & Stack pointer: The program counter (PC) is a 2-byte address, which tells the 8051 where the next instruction to execute is found in memory. The stack pointer like all registers except DPTR and PC may hold an 8-bit (1-Byte) value. Memory: Special Function Registers (SFRs) are areas of memory that control specific functionality of the 8051 processor. For example, four SFRs permit access to the 8051s 32 input/output lines. Another SFR allows the user to set the serial baud rate, control and access timers, and configure the 8051s interrupt system. Interrupt Registers: The individual interrupt enable bits are in the IE register . Two priorities can be set for each of the six interrupt sources in the IP register.

Timer 0: Timer 0 functions as either a timer or event counter in four modes of operation . Timer 0 is controlled by the four lower bits of the TMOD register and bits 0, 1, 4 and 5 of the TCON register. Mode 0 ( 13-bit Timer) Mode 0 configures timer 0 as a 13-bit timer which is set up as an 8-bit timer (TH0 register) with a modulo 32 pre-scale

implemented with the lower five bits of the TL0 register . The upper three bits of TL0 register are indeterminate and should be ignored. Pre-scale overflow increments the TH0 register. Mode 1 ( 16-bit Timer )Mode 1 is the same as Mode 0, except that the Timer register is being run with all 16 bits . Mode 1 configures timer 0 as a 16-bit timer with the TH0 and TL0 registers connected in cascade. The selected input increments the TL0 register. Mode 2 (8-bit Timer with Auto-Reload)Mode 2 configures timer 0 as an 8-bit timer ( TL0 register ) that automatically reloads from the TH0 register . TL0 overflow sets TF0 flag in the TCON register and reloads TL0 with the contents of TH0, which is preset by software. Mode 3 ( Two 8-bit Timers )Mode 3 configures timer 0 so that registers TL0 and TH0 operate as separate 8-bit timers. This mode is provided for applications requiring an additional 8-bit timer or counter. Timer 1: Timer 1 is identical to timer 0, except for mode 3, which is a hold-count mode. Mode 3 (Halt) Placing Timer 1 in mode 3 causes it to halt and hold its count. This can be used to halt Timer 1 when TR1 run control bit is not available i.e., when Timer 0 is in mode 3. Baud Rates: The baud rate in Mode 0 is fixed. The baud rate in Mode 2 depends on the value of bit SMOD in Special Function Register PCON. If SMOD = 0 (which is its value on reset), the baud rate is 1/64 the oscillator frequency. If SMOD = 1, the baud rate is 1/32 the oscillator frequency. In the 89S52, the baud rates in Modes 1 and 3 are determined by the Timer 1 overflow rate. In case of Timer 2 , these baud rates can be determined by Timer 1 , or by Timer 2 , or by both (one for transmit and the other for receive ). TCON REGISTER: Timer/counter Control Register 7 TF1 6 TR1 5 TF0 4 TR0 3 IE1 2 IT1 1 IE0 0 IT0

Bit

Bit

Description

Number Mnemonics 7 TF1 Timer 1 overflow flag

Cleared by hardware when processor vectors to interrupt routien. Set by hardware on timer/counter overflow, when the imer 1 register overflows. 6 TR1 Timer 1 run control bit Clear to turn off timer/counter 1. Set to turn on timer/counter 1. 5 TF0 Timer 1 overflow flag Cleared by hardware when processor vectors to interrupt routien. Set by hardware on timer/counter overflow, when the timer0 register overflows. 4 TR0 Timer 1 run control bit Clear to turn off timer/counter 0. Set to turn on timer/counter 0. 3 IE1 Interrupt 1 Edge flag Cleared by hardware when interrupt is processed if edge-triggered (IT1) Set by hardware when external interrupt is detected on INT1 pin. 2 IT1 Interrupt 1 type control bit Clear to select low level active (level triggered) for external interrupt 1. Set to select falling edge active (edge triggered) for external interrupt 1. 1 IE0 Interrupt 0 Edge flag Cleared by hardware when interrupt is processed if edge-triggered (IT0) Set by hardware when external interrupt is detected on INT0 pin. 0 IT0 Interrupt 0 type control bit Clear to select low level active (level triggered) for external interrupt 0. Set to select falling edge active (edge triggered) for external interrupt 0.

TMOD REGISTER: Timer/Counter 0 and 1 Modes 7 GATE1 6 C/T 1 5 M11 4 M01 3 GATE0 2 C/T 0 1 M10 0 M00

Bit Number 7

Bit Mnemonics

Description

GATE1

Timer 1 Gate Control Bit Clear to enable timer 1 whenever the TR1 bit is set. Set to enable timer 1 only while the INT1 pin is high & TR1 bit is set.

C/T 1

Timer1 counter/timer select bit Clear for timer operation: timer1 counts the divided down system clock. Set for counter operation: timer1 counts negative transition on external pin T1.

5 4

M11 M01

Timer 1 mode select bits M11 0 0 M01 operating mode Mode0: 8 bit timer/counter (TH1) with 5 bit prescaler (TL1). 0 1 1 1 0 Mode1: 16 bit timer/counter. Mode2: 8 bit auto reload timer/counter (TL1). 1 Mode3: timer 1 halted. Retains count.

GATE 0

Timer 0 Gate Control Bit Clear to enable timer 0 whenever the TR0 bit is set. Set to enable timer 0 only while the INT0 pin is high & TR0 bit is set.

C/T 0

Timer0 counter/timer select bit Clear for timer operation: timer0 counts the divided down system clock. Set for counter operation: timer0 counts negative transition on external pin T0.

M10

Timer 0 mode select bits M10 1 0 M00 operating mode Mode0: 8 bit timer/counter (TH1) with 5 bit pre-scaler (TL1). 0 1 1 1 0 1 Mode1: 16 bit timer/counter. Mode2: 8 bit auto reload timer/counter (TL1). Mode3: timer 1 halted. Retains count.

TH0 is an 8 bit timer using timer1s TR0 & TF0 bits.

CHAPTER-5

Sensor
Definition: A sensor is a device that measures a physical quantity and converts it into a signal which can be read by an observer or by an instrument. For example, a mercury-in-glass thermometer converts the measured temperature into expansion and contraction of a liquid which can be read on a calibrated glass tube. A thermocouple converts temperature to an output voltage which can be read by a voltmeter. For accuracy, all sensors need to be calibrated against known standards (OR) Sensor is the device which converts any physical quantity to its equivalent electrical signal. There are different types of sensor are available there are: Temperature sensor, Light sensor, Voltage sensor, Smoke Sensor, Gas sensor, Fire sensor, Magnetic Sensors, etc. Classification of measurement errors A good sensor obeys the following rules:
y y y

Is sensitive to the measured property Is insensitive to any other property likely to be encountered in its application Does not influence the measured property

Ideal sensors are designed to be linear or linear to some simple mathematical function of the measurement, typically logarithmic. The output signal of such a sensor is linearly proportional to the value or simple function of the measured property. The sensitivity is then defined as the ratio between output signal and measured property. For example, if a sensor measures temperature and has a voltage output, the sensitivity is a constant with the unit [V/K]; this sensor is linear because the ratio is constant at all points of measurement

Sensor deviations
If the sensor is not ideal, several types of deviations can be observed:
 The sensitivity may in practice differ from the value specified. This is called a sensitivity

error, but the sensor is still linear.

 Since the range of the output signal is always limited, the output signal will eventually

reach a minimum or maximum when the measured property exceeds the limits. The full scale range defines the maximum and minimum values of the measured property.
 If the output signal is not zero when the measured property is zero, the sensor has an

offset or bias. This is defined as the output of the sensor at zero input.
 If the sensitivity is not constant over the range of the sensor, this is called nonlinearity.

Usually this is defined by the amount the output differs from ideal behavior over the full range of the sensor, often noted as a percentage of the full range.
 If the deviation is caused by a rapid change of the measured property over time, there is a

dynamic error. Often, this behavior is described with a bode plot showing sensitivity error and phase shift as function of the frequency of a periodic input signal.
 If the output signal slowly changes independent of the measured property, this is defined

as drift (telecommunication).
 Long term drift usually indicates a slow degradation of sensor properties over a long

period of time.
 Noise is a random deviation of the signal that varies in time.  Hysteresis is an error caused by when the measured property reverses direction, but there

is some finite lag in time for the sensor to respond, creating a different offset error in one direction than in the other.
 If the sensor has a digital output, the output is essentially an approximation of the

measured property. The approximation error is also called digitization error.


 If the signal is monitored digitally, limitation of the sampling frequency also can cause a

dynamic error, or if the variable or added noise noise changes periodically at a frequency near a multiple of the sampling rate may induce aliasing errors.
 The sensor may to some extent be sensitive to properties other than the property being

measured. For example, most sensors are influenced by the temperature of their environment. All these deviations can be classified as systematic errors or random errors. Systematic errors can sometimes be compensated for by means of some kind of calibration strategy. Noise is a

random error that can be reduced by signal processing, such as filtering, usually at the expense of the dynamic behavior of the sensor.

Resolution
The resolution of a sensor is the smallest change it can detect in the quantity that it is measuring. Often in a digital display, the least significant digit will fluctuate, indicating that changes of that magnitude are only just resolved. The resolution is related to the precision with which the measurement is made. For example, a scanning tunneling probe (a fine tip near a surface collects an electron tunneling current) can resolve atoms and molecules. Different Types Sensor: 1] Acoustic, sound, vibration
 Geophone  Hydrophone  Lace Sensor a guitar pickup  Microphone  Seismometer  Accelerometer

2] Automotive, transportation
 Air-fuel ratio meter  Crank sensor  Curb feeler, used to warn driver of curbs  Defect detector, used on railroads to detect axle and signal problems in passing trains  Engine coolant temperature sensor, or ECT sensor, used to measure the engine

temperature
 Hall effect sensor, used to time the speed of wheels and shafts  MAP sensor, Manifold Absolute Pressure, used in regulating fuel metering.  Mass flow sensor, or mass airflow (MAF) sensor, used to tell the ECU the mass of air

entering the engine

 Oxygen sensor, used to monitor the amount of oxygen in the exhaust  Parking sensors, used to alert the driver of unseen obstacles during parking manoeuvres  Radar gun, used to detect the speed of other objects  Speedometer, used measure the instantaneous speed of a land vehicle  Speed sensor, used to detect the speed of an object  Throttle position sensor, used to monitor the position of the throttle in an internal

combustion engine
 Tire-pressure monitoring sensor, used to monitor the air pressure inside the tires  Transmission fluid temperature sensor, used to measure the temperature of the

transmission fluid
 Turbine speed sensor (TSS), or input speed sensor (ISS), used to measure the rotational

speed of the input shaft or torque converter


 Variable reluctance sensor, used to measure position and speed of moving metal

components
 Vehicle speed sensor (VSS), used to measure the speed of the vehicle  Water sensor or water-in-fuel sensor, used to indicate the presence of water in fuel  Wheel speed sensor, used for reading the speed of a vehicle's wheel rotation

3] Chemical
 Breathalyzer and Alcohol Sensor  Carbon dioxide sensor  Carbon monoxide detector  Catalytic bead sensor  Chemical field-effect transistor  Electrochemical gas sensor  Electronic nose  Electrolyteinsulatorsemiconductor sensor  Hydrogen sensor  Hydrogen sulfide sensor  Infrared point sensor  Ion-selective electrode

 Nondispersive infrared sensor  Microwave chemistry sensor  Nitrogen oxide sensor  Olfactometer  Optode  Oxygen sensor  Pellistor  pH glass electrode  Potentiometric sensor  Redox electrode  Smoke detector  Zinc oxide nanorod sensor

4] Electric current, electric potential, magnetic, radio


 Ammeter  Current sensor  Galvanometer  Hall effect sensor  Hall probe  Leaf electroscope  Magnetic anomaly detector  Magnetometer  Metal detector  Multi-meter  Ohmmeter  Radio direction finder  Telescope  Voltmeter  Voltage detector  Watt-hour meter

5] Environment, weather, moisture, humidity


 Bedwetting alarm  Dew warning  Fish counter  Gas detector  Hook gauge evaporimeter  Hygrometer  Leaf sensor  Pyranometer  Pyrgeometer  Psychrometer  Rain gauge  Rain sensor  Seismometers  Snow gauge  Soil moisture sensor  Stream gauge  Tide gauge

6] Flow, fluid velocity


 Air flow meter  Anemometer  Flow sensor  Gas meter  Mass flow sensor  Water meter

7] Ionizing radiation, subatomic particles


 Bubble chamber  Cloud chamber  Geiger counter

 Neutron detection  Particle detector  Scintillation counter  Scintillator  Wire chamber

8] Navigation instruments
 Air speed indicator  Altimeter  Attitude indicator  Depth gauge  Fluxgate compass  Gyroscope  Inertial reference unit  Magnetic compass  MHD sensor  Ring laser gyroscope  Turn coordinator  Variometer  Vibrating structure gyroscope  Yaw rate sensor

9] Position, angle, displacement, distance, speed, acceleration


 Accelerometer  Capacitive displacement sensor  Free fall sensor

 Gravimeter  Inclinometer  Laser rangefinder  Linear encoder  Linear variable differential transformer (LVDT)  Liquid capacitive inclinometers  Odometer  Piezoelectric accelerometer  Position sensor  Rotary encoder  Rotary variable differential transformer  Selsyn  Sudden Motion Sensor  Tilt sensor  Tachometer  Ultrasonic thickness gauge

10] Optical, light, imaging


 Charge-coupled device  Colorimeter  Contact image sensor  Electro-optical sensor  Flame detector  Infra-red sensor  LED as light sensor  Nichols radiometer  Fiber optic sensors  Photodetector  Photodiode  Photomultiplier tubes  Phototransistor

 Photoelectric sensor  Photoionization detector  Photomultiplier  Photoresistor  Photoswitch  Phototube  Proximity sensor  Scintillometer  Shack-Hartmann  Wavefront sensor

11] Pressure
 Barograph  Barometer  Boost gauge  Bourdon gauge  Hot filament ionization gauge  Ionization gauge  McLeod gauge  Oscillating U-tube  Permanent Downhole Gauge  Pirani gauge  Pressure sensor  Pressure gauge  Tactile sensor  Time pressure gauge

12] Force, density, level


 Bhangmeter  Hydrometer  Force gauge

 Level sensor  Load cell  Magnetic level gauge  Nuclear density gauge  Piezoelectric sensor  Strain gauge  Torque sensor  Viscometer

13] Thermal, heat, temperature  Bolometer  Calorimeter  Exhaust gas temperature gauge  Gardon gauge  Heat flux sensor  Infrared thermometer  Microbolometer  Microwave radiometer  Net radiometer  Resistance temperature detector  Resistance thermometer  Silicon bandgap temperature sensor  Temperature gauge  Thermistor  Thermocouple  Thermometer 14] Proximity, presence
 Alarm sensor  Motion detector  Occupancy sensor

 Passive infrared sensor  Reed switch  Stud finder  Triangulation sensor  Touch switch  Wired glove  Doppler radar

Alcohol Sensor (MQ 3) Features  High sensitivity to alcohol and small sensitivity to Benzene.  Fast response and High sensitivity.  Stable and long life.  Simple drive circuit. Application  They are suitable for alcohol checker, Breathalyzer. Basic Operation Structure and configuration of MQ-3 gas sensor is shown as Fig. 1 (Configuration A or B), sensor composed by micro AL2O3 ceramic tube, Tin Dioxide (SnO2) sensitive layer, measuring electrode and heater are fixed into a crust made by plastic and stainless steel net. The heater provides necessary work conditions for work of sensitive components. The enveloped MQ-3 have 6 pin, 4 of them are used to fetch signals, and other 2 are used for providing heating current. Electric parameter measurement circuit is shown as Fig.2 E. Sensitivity characteristic curve

Sensitivity Adjustment Resistance value of MQ-3 is difference to various kinds and various concentration gases. So, when using these components, sensitivity adjustment is very necessary. we recommend that you calibrate the detector for 0.4mg/L ( approximately 200ppm ) of Alcohol concentration in air and use value of Load resistance that( RL) about 200 K (100K to 470 K ).When accurately

measuring, the proper alarm point for the gas detector should be determined after considering the temperature and humidity influence.

Temperature Sensor (LM 35): The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage over linear temperature sensors calibrated in Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling. The LM35 does not require any external calibration or trimming to provide typical accuracies of 14C at room temperature and 34C over a full 55 to +150C temperature range. Low cost is assured by trimming and calibration at the wafer level. The LM35s low output impedance, linear output, and precise inherent calibration make interfacing to readout or control circuitry especially easy. It can be used with single power supplies, or with plus and minus supplies. As it draws only 60 A from its supply, it has very low self-heating, less than 0.1C in still air. The

LM35 is rated to operate over a 55 to +150C temperature range,while the LM35C is rated for a 40 to +110C range (10 with improved accuracy). The LM35 series is available packaged in hermetic TO-46 transistor packages, while the LM35C, LM35CA, and LM35D are also available in the plastic TO-92 transistor package. The LM35D is also available in an 8-lead surface mount small outline package and a plastic TO-220 package. Features  Calibrated directly in Celsius (Centigrade)  Linear + 10.0 mV/C scale factor  0.5C accuracy guaranteeable (at +25C)  Rated for full 55 to +150C range  Suitable for remote applications  Low cost due to wafer-level trimming  Operates from 4 to 30 volts  Less than 60 A current drain  Low self-heating, 0.08C in still air  Nonlinearity only 14C typical  Low impedance output, 0.1 W for 1 mA load

Typical Application

LM35 interface with the ADC 0804:

Thermistor A thermistor is a type of resistor whose resistance varies significantly with temperature, more so than in standard resistors. The word is a portmanteau of thermal and resistor. Thermistors are widely used as inrush current limiters, temperature sensors, self-resetting over current protectors, and self-regulating heating elements. Thermistors differ from resistance temperature detectors (RTD) in that the material used in a thermistor is generally a ceramic or polymer, while RTDs use pure metals. The temperature response is also different; RTDs are useful over larger temperature ranges, while thermistors typically achieve a higher precision within a limited temperature range [usually 90 C to 130 C].

Thermistor symbol Assuming, as a first-order approximation, that the relationship between resistance and temperature is linear, then:

where

R = change in resistance T = change in temperature k = first-order temperature coefficient of resistance Thermistors can be classified into two types, depending on the sign of k. If k is positive, the resistance increases with increasing temperature, and the device is called a positive temperature coefficient (PTC) thermistor, or posistor. If k is negative, the resistance decreases with increasing temperature, and the device is called a negative temperature coefficient (NTC) thermistor. Resistors that are not thermistors are designed to have a k as close to zero as possible (smallest possible k), so that their resistance remains nearly constant over a wide temperature range. Instead of the temperature coefficient k, sometimes the temperature coefficient of resistance (alpha) or
T

is used. It is defined as.

For example, for the common PT100 sensor, should not be confused with the

= 0.00385 or 0.385 %/C. This

coefficient

parameter below.

Thermistor, a word formed by combining thermal with resistor, refers to a device whose electrical resistance, or ability to conduct electricity, is controlled by temperature. Thermistors come in two varieties; NTC, negative thermal coefficient, and PTC, positive thermal coefficient, sometimes called posisitors. The resistance of NTC thermistors decreases proportionally with increases in temperature. They are most commonly made from the oxides of metals such as manganese, cobalt, nickel and copper. The metals are oxidized through a chemical reaction, ground to a fine powder, then compressed and subject to very high heat. Some NTC thermistors are crystallized from semiconducting material such as silicon and germanium.

NTC thermistors The RS range of NTC thermistors includes standard tolerance negative temperature coefficient thermistors, a range of small close tolerance R/T curve matched thermistors and a range of DO35 package devices. Standard tolerance thermistors A range of 13 negative temperature coefficient bead thermistors and 4 disc thermistors constructed from a compound of nickel magnetite. Of the 13 bead thermistors, ten types are sealed in glass and three are incorporated into stainless steel probe assemblies. This range was designed primarily for temperature measurement and control, flow measurement and liquid level detection. The four NTC disc thermistors are intended for use in temperature compensation, measurement and control applications. Disc diameter in all cases is 10mm with a lead pitch of 5mm (nominal).

The range of DO-35 packaged NTC thermistors is designed for temperature measurement and control in applications which demand cost effective reliability. Typical applications include domestic appliances, automotive systems, data processing equipment and heating/ventilating/air conditioning control. The hermetically-sealed construction combines the advantages of high temperature operation and high reliability of glass bead types with the closer tolerances associated with chip devices. The glass encapsulation offers the additional benefit of high voltage insulation. Basic formulae The temperature coefficient at any temperature within the operating range may be obtained from the Formula:

To determine the resistance at any temperature within the operating range may be obtained from the formula:

B = characteristic temperature constant (K) T = bead temperature in (K) R1 = resistance of thermistor at temperature t1 () R2 = resistance of thermistor at temperature t2 () e = 2.7183 (Temperature in K = temperature in C +273). Application notes Typical applications include temperature control of ovens, deep freezers, rooms and for process control, etc. Can also be used to drive high and low temperature alarms. In the basic circuit below, calibration should be carried out by comparison with a known standard (e.g. a thermometer or thermocouple). In the case of 0C, a mixture of ice and water can be used and for +100C, use boiling water. Note: That non-linearity should be expected at extended temperatures.

Light Dependent Resistor (LDR) A photo-resistor or light dependent resistor or cadmium sulfide (CdS) cell is a resistor whose resistance decreases with increasing incident light intensity. It can also be referred to as a photoconductor. A photo resistor is made of a high resistance semiconductor. If light falling on the device is of high enough frequency, photons absorbed by the semiconductor give bound electrons enough energy to jump into the conduction band. The resulting free electron (and its hole partner) conduct electricity, there by lowering resistance. A photoelectric device can be either intrinsic or extrinsic. An intrinsic semiconductor has its own charge carriers and is not an efficient semiconductor, e.g. silicon. In intrinsic devices the only available electrons are in the valence band, and hence the photon must have enough energy to excite the electron across the entire bandgap. Extrinsic devices have impurities, also

called dopants, added whose ground state energy is closer to the conduction band; since the electrons do not have as far to jump, lower energy photons (i.e., longer wavelengths and lower frequencies) are sufficient to trigger the device. If a sample of silicon has some of its atoms replaced by phosphorus atoms (impurities), there will be extra electrons available for conduction. This is an example of an extrinsic semiconductor.

The symbol for a photo-resistor

Applications: Photo-resistors come in many different types. Inexpensive cadmium sulfide cells can be found in many consumer items such as camera light meters, street lights, clock radios, alarms, and outdoor clocks. They are also used in some dynamic compressors together with a small incandescent lamp or light emitting diode to control gain reduction.Lead sulfide (PbS) and indium antimonide (InSb) LDRs (light dependent resistor) are used for the mid infrared spectral region. Ge:Cu photoconductors are among the best far-infrared detectors available, and are used for infrared astronomy and infrared spectroscopy.Transducers are used for changing energy types.

A Light Dependent Resistor

ADC
The ADC0808 data acquisition component is a monolithic CMOS device with an 8-bit analogto-digital converter, 8-channel multiplexer and microprocessor compatible control logic. The 8bit A/D converter uses successive approximation as the conversion technique. The converter features a high impedance chopper stabilized comparator, a 256R voltage divider with analog switch tree and a successive approximation register. The 8-channel multiplexer can directly access any of 8-single-ended analog signals. The device eliminates the need for external zero and full-scale adjustments. Easy interfacing to microprocessors is provided by the latched and decoded multiplexer address inputs and latched TTL tri-state outputs. The design of the ADC0808 has been optimized by incorporating the most desirable aspects of several A/D conversion techniques. The ADC0808 offers high speed, high accuracy, minimal temperature dependence, excellent long-term accuracy and repeatability, and consumes minimal power. These features make this device ideally suited to applications from process and machine control to consumer and automotive applications. Features: 1. 2. 3. 4. 5. 6. 7. 8. 9. Easy interface to all microprocessors. Operates ratio metrically or with 5 VDC or analog span adjusted voltage reference. No zero or full-scale adjust required. 8-channel multiplexer with address logic. 0V to 5V input range with single 5V power supply. Outputs meet TTL voltage level specifications. Standard hermetic or molded 28-pin DIP package. 28-pin molded chip carrier package. ADC0808 equivalent to MM74C949.

Key Specifications: 1. Resolution 8 Bits 2. Total Unadjusted Error 1/2 LSB and 1 LSB 3. Single Supply 5 VDC 4. Low Power 15 mW 5. Conversion Time 100 s Pin diagram:

Types of ADC:  Digital-Ramp ADC.  Successive Approximation ADC.  Flash ADC. Digital-Ramp ADC: Conversion from analog to digital form inherently involves comparator action where the value of the analog voltage at some point in time is compared with some standard. A common way to do that is to apply the analog voltage to one terminal of a comparator and trigger a binary counter which drives a DAC. The output of the DAC is applied to the other terminal of the comparator. Since the output of the DAC is increasing with the counter, it will trigger the comparator at some point when its voltage exceeds the analog input. The transition of the comparator stops the binary counter, which at that point holds the digital value corresponding to the analog voltage.

Successive Approximation ADC: The successive approximation ADC is much faster than the digital ramp ADC because it uses digital logic to converge on the value closest to the input voltage. A comparator and a DAC are used in the process. A flowchart explaining the working is shown in the figure below.

Flash ADC:

Illustrated is a 3-bit flash ADC with resolution 1 volt (after Tocci). The resistor net and comparators provide an input to the combinational logic circuit, so the conversion time is just the propagation delay through the network - it is not limited by the clock rate or some convergence sequence. It is the fastest type of ADC available, but requires a comparator for each value of output (63 for 6-bit, 255 for 8-bit, etc.) Such ADCs are available in IC form up to 8-bit and 10bit flash ADCs (1023 comparators) are planned. The encoder logic executes a truth table to convert the ladder of inputs to the binary number output. Applications: AD converters are used virtually everywhere where an analog signal has to be processed, stored, or transported in digital form. Fast video ADCs are used, for example, in TV tuner cards. Slow on-chip 8, 10, 12, or 16 bit ADCs are common in microcontrollers. Very fast ADCs are needed in digital oscilloscopes, and are crucial for new applications like software defined radio and in music recording. ADC's dynamic range is also important.

Relays A relay is used to isolate one electrical circuit from another. It allows a low current control circuit to make or break an electrically isolated high current circuit path. The basic relay consists of a coil and a set of contacts. The most common relay coil is a length of magnet wire wrapped around a metal core. When voltage is applied to the coil, current passes through the wire and creates a magnetic field. This magnetic field pulls the contacts together and holds them there until the current flow in the coil has stopped. The diagram below shows the parts of a simple relay.

Figure: Relay Operation: When a current flows through the coil, the resulting magnetic field attracts an armature that is mechanically linked to a moving contact. The movement either makes or breaks a connection with a fixed contact. When the current is switched off, the armature is usually returned by a spring to its resting position shown in figure 6.6(b). Latching relays exist that require operation of a second coil to reset the contact position. By analogy with the functions of the original electromagnetic device, a solid-state relay operates a thyristor or other solid-state switching device with a transformer or light-emitting diode to trigger it.

Pole and throw SPST SPST relay stands for Single Pole Single Throw relay. Current will only flow through the contacts when the relay coil is energized.

Figure: SPST Relay SPDT Relay SPDT Relay stands for Single Pole Double Throw relay. Current will flow between the movable contact and one fixed contact when the coil is De-energized and between the movable contact and the alternate fixed contact when the relay coil is energized. The most commonly used relay in car audio, the Bosch relay, is a SPDT relay.

Figure: SPDT Relay DPST Relay DPST relay stands for Double Pole Single Throw relay. When the relay coil is energized, two separate and electrically isolated sets of contacts are pulled down to make contact with their stationary counterparts. There is no complete circuit path when the relay is De-energized.

Figure: DPST Relay DPDT Relay DPDT relay stands for Double Pole Double Throw relay. It operates like the SPDT relay but has twice as many contacts. There are two completely isolated sets of contacts.

Figure: DPDT Relay This is a 4 Pole Double Throw relay. It operates like the SPDT relay but it has 4 sets of isolated contacts.

Figure: 4 Pole Double Throw relay Types of relay: 1. Latching Relay 2. Reed Relay 3. Mercury Wetted Relay 4. Machine Tool Relay 5. Solid State Relay (SSR) Latching relay Latching relay, dust cover removed, showing pawl and ratchet mechanism. The ratchet operates a cam, which raises and lowers the moving contact arm, seen edge-on just below it. The moving and fixed contacts are visible at the left side of the image. A latching relay has two relaxed states (bi-stable). These are also called "impulse", "keep", or "stay" relays. When the current is switched off, the relay remains in its last state. This is achieved with a solenoid operating a ratchet and cam mechanism, or by having two opposing coils with an over-center spring or permanent magnet to hold the armature and contacts in position while the coil is relaxed, or with a remanent core. In the ratchet and cam example, the first pulse to the coil turns the relay on and the second pulse turns it off. In the two coil example, a pulse to one coil turns the relay on and a pulse to the opposite coil turns the relay off. This type of relay has the advantage that it consumes power only for an instant, while it is being switched, and it retains its

last setting across a power outage. A remanent core latching relay requires a current pulse of opposite polarity to make it change state.

Figure: Latching relay Reed relay A reed relay has a set of contacts inside a vacuum or inert gas filled glass tube, which protects the contacts against atmospheric corrosion. The contacts are closed by a magnetic field generated when current passes through a coil around the glass tube. Reed relays are capable of faster switching speeds than larger types of relays, but have low switch current and voltage ratings.

Mercury-wetted Relay
A mercury-wetted reed relay is a form of reed relay in which the contacts are wetted with mercury. Such relays are used to switch low-voltage signals (one volt or less) because of their low contact resistance, or for high-speed counting and timing applications where the mercury eliminates contact bounce. Mercury wetted relays are position-sensitive and must be mounted vertically to work properly. Because of the toxicity and expense of liquid mercury, these relays are rarely specified for new equipment. See also mercury switch.

Machine tool relay


A machine tool relay is a type standardized for industrial control of machine tools, transfer machines, and other sequential control. They are characterized by a large number of contacts (sometimes extendable in the field) which are easily converted from normally-open to normallyclosed status, easily replaceable coils, and a form factor that allows compactly installing many

relays in a control panel. Although such relays once were the backbone of automation in such industries as automobile assembly, the programmable logic controller (PLC) mostly displaced the machine tool relay from sequential control applications. Solid-state relay A solid state relay (SSR) is a solid state electronic component that provides a similar function to an electromechanical relay but does not have any moving components, increasing long-term reliability. With early SSR's, the tradeoff came from the fact that every transistor has a small voltage drop across it. This voltage drop limited the amount of current a given SSR could handle. As transistors improved, higher current SSR's, able to handle 100 to 1,200 Amperes, have become commercially available. Compared to electromagnetic relays, they may be falsely triggered by transients.

Figure: Solid relay, which has no moving parts Specification


 Number and type of contacts normally open, normally closed, (double-throw)  Contact sequence "Make before Break" or "Break before Make". For example, the old

style telephone exchanges required Make-before-break so that the connection didn't get dropped while dialing the number.
 Rating of contacts small relays switch a few amperes, large contactors are rated for up

to 3000 amperes, alternating or direct current


 Voltage rating of contacts typical control relays rated 300 VAC or 600 VAC,

automotive types to 50 VDC, special high-voltage relays to about 15 000 V

 Coil voltage machine-tool relays usually 24 VAC, 120 or 250 VAC, relays for

switchgear may have 125 V or 250 VDC coils, "sensitive" relays operate on a few milliamperes Applications: Relays are used:  To control a high-voltage circuit with a low-voltage signal, as in some types of modems,  To control a high-current circuit with a low-current signal, as in the starter solenoid of an automobile,  To detect and isolate faults on transmission and distribution lines by opening and closing circuit breakers (protection relays),  To isolate the controlling circuit from the controlled circuit when the two are at different potentials, for example when controlling a mains-powered device from a low-voltage switch. The latter is often applied to control office lighting as the low voltage wires are easily installed in partitions, which may be often moved as needs change. They may also be controlled by room occupancy detectors in an effort to conserve energy,  To perform logic functions. For example, the boolean AND function is realized by connecting relay contacts in series, the OR function by connecting contacts in parallel. Due to the failure modes of a relay compared with a semiconductor, they are widely used in safety critical logic, such as the control panels of radioactive waste handling machinery.  As oscillators, also called vibrators. The coil is wired in series with the normally closed contacts. When a current is passed through the relay coil, the relay operates and opens the contacts that carry the supply current. This stops the current and causes the contacts to close again. The cycle repeats continuously, causing the relay to open and close rapidly. Vibrators are used to generate pulsed current.  To generate sound. A vibrator, described above, creates a buzzing sound because of the rapid oscillation of the armature. This is the basis of the electric bell, which consists of a vibrator with a hammer attached to the armature so it can repeatedly strike a bell.

 To perform time delay functions. Relays can be used to act as an mechanical time delay device by controlling the release time by using the effect of residual magnetism by means of a inserting copper disk between the armature and moving blade assembly.

LCD(Liqiud Crystal Display ) One of the most common devices attached to an controller is an LCD display. Some of the most common LCDs connected to the controllers are 16X1, 16x2 and 20x2 displays. This means 16 characters per line by 1 line 16 characters per line by 2 lines and 20 characters per line by 2 lines, respectively. But in this project we are interfacing the 16*2 LCD it consists a 16 pins. Schematic Diagram:

Figure: Schematic Diagram Pin Description

Symbol Pin 1 2 3 VSS VDD Vo

Level

Function

Power, GND Power, 5V Power, for LCD Drive

Register Select Signal 4 RS H/L H: Data Input L: Instruction Input H: Data Read (LCD->MPU) L: Data Write (MPU->LCD)

R/W

H/L

H,H->L Enable H/L Data Bus; Software selectable 4- or 8-bit mode NOT CONNECTED NOT CONNECTED

7-14 DB0-DB7 15 16 NC NC

LCD consist the three control line (RS, R/W,&En), eight data lines (D0-D7), Supply Voltage (Vcc), Contrast control (Vee) and ground (Vss). Control Pins Description EN (Enable) Line is called "Enable." This control line is used to tell the LCD that you are sending it data. To send data to the LCD, your program should make sure this line is low (0) and then set the other two control lines and/or put data on the data bus. When the other lines are completely ready, bring EN high (1) and wait for the minimum amount of time required by the LCD datasheet (this varies from LCD to LCD), and end by bringing it low (0) again. RS (Register Select) Line is the "Register Select" line. When RS is low (0), the data is to be treated as a command or special instruction (such as clear screen, position cursor, etc.). When RS is high (1), the data

being sent is text data which should be displayed on the screen. For example, to display the letter "T" on the screen you would set RS high. R/W (Read write) Line is the "Read/Write" control line. When RW is low (0), the information on the data bus is being written to the LCD. When RW is high (1), the program is effectively querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read command. All others are write commands, so RW will almost always be low. Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation selected by the user). In the case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2, DB3, DB4, DB5, DB6, and DB7. Logic status on control lines: E - 0 Access to LCD disabled - 1 Access to LCD enabled R/W - 0 Writing data to LCD - 1 Reading data from LCD RS - 0 Instructions 1 Character

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

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

CHAPTER-6

Software Components: ABOUT SOFTWARE Softwares used are:  Keil software for c programming  Express PCB for lay out design  Express SCH for schematic design. What's New in Vision3? Vision3 adds many new features to the Editor like Text Templates, Quick Function Navigation, and Syntax Coloring with brace high lighting Configuration Wizard for dialog based startup and debugger setup. Vision3 is fully compatible to Vision2 and can be used in parallel with Vision2. What is Vision3? Vision3 is an IDE (Integrated Development Environment) that helps you write, compile, and debug embedded programs. It encapsulates the following components:  A project manager.  A make facility.  Tool configuration.  Editor.  A powerful debugger. To help you get started, several example programs (located in the \C51\Examples, \C251\Examples, \C166\Examples, and \ARM\...\Examples) are provided.  HELLO is a simple program that prints the string "Hello World" using the Serial Interface.  MEASURE is a data acquisition system for analog and digital systems.  TRAFFIC is a traffic light controller with the RTX Tiny operating system.  SIEVE is the SIEVE Benchmark.  DHRY is the Dhrystone Benchmark.

 WHET is the Single-Precision Whetstone Benchmark. Additional example programs not listed here are provided for each device architecture. Building an Application in Vision2 To build (compile, assemble, and link) an application in Vision2, you must: 1. 2. Select Project -(forexample,166\EXAMPLES\HELLO\HELLO.UV2). Select Project - Rebuild all target files or Build target. Vision2 compiles, assembles, and links the files in your project. Creating Your Own Application in Vision2 To create a new project in Vision2, you must: 1. Select Project - New Project. 2. Select a directory and enter the name of the project file. 3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the Device Database. 4. Create source files to add to the project. 5. Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the source files to the project. 6. Select Project - Options and set the tool options. Note when you select the target device from the Device Database all special options are set automatically. You typically only need to configure the memory map of your target hardware. Default memory model settings are optimal for most applications. 7. Select Project - Rebuild all target files or Build target. Debugging an Application in Vision2 To debug an application created using Vision2, you must: 1. Select Debug - Start/Stop Debug Session. 2. Use the Step toolbar buttons to single-step through your program. You may enter G, main in the Output Window to execute to the main C function. 3. Open the Serial Window using the Serial #1 button on the toolbar. Debug your program using standard options like Step, Go, Break, and so on.

Starting Vision2 and creating a Project Vision2 is a standard Windows application and started by clicking on the program icon. To create a new project file select from the Vision2 menu. Project New Project. This opens a standard Windows dialog that asks you for the new project file name. We suggest that you use a separate folder for each project. You can simply use the icon Create New Folder in this dialog to get a new empty folder. Then select this folder and enter the file name for the new project, i.e. Project1. Vision2 creates a new project file with the name PROJECT1.UV2 which contains a default target and file group name. You can see these names in the Project. Window Files. Now use from the menu Project Select Device for Target and select a CPU for your project. The Select Device dialog box shows the Vision2 device database. Just select the micro controller you use. We are using for our examples the Philips 80C51RD+ CPU. 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, the tool settings under Options Target are all you need to start a new application. You may translate all source files and line the application with a click on the Build Target toolbar icon. When you build an application with syntax errors, Vision2 will display errors and warning messages in the Output Window Build page. A double click on a message line opens the source file on the correct location in a Vision2 editor window. Once you have successfully generated your application you can start debugging. After you have tested your application, it is required to create an Intel HEX file to download the software into an EPROM programmer or simulator. Vision2 creates HEX files with each build process when Create HEX files under Options for Target Output is enabled. You may start

your PROM programming utility after the make process when you specify the program under the option Run User Program #1. CPU Simulation Vision2 simulates up to 16 Mbytes of memory from which areas can be mapped for read, write, or code execution access. The Vision2 simulator traps and reports illegal memory accesses. In addition to memory mapping, the simulator also provides support for the integrated peripherals of the various 8051 derivatives. 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. Refer to page 58 for more Information about selecting a device. You may select and display the on-chip peripheral components using the Debug menu. You can also change the aspects of each peripheral using the controls in the dialog boxes. Start Debugging You start the debug mode of Vision2 with the Debug Start/Stop Debug Session command. Depending on the Options for Target Debug Configuration, 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. If the program execution stops, Vision2 opens an editor window with the source text or shows CPU instructions in the disassembly window. The next executable statement is marked with a yellow arrow. During debugging, most editor features are still available. For example, you can use the find command or correct program errors. Program source text of your application is shown in the same windows. 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. The additional debug windows are discussed in the following.

_ The project structure or tool parameters cannot be modified. All build Commands are disabled. Disassembly Window The Disassembly window shows your target program as mixed source and assembly program or just assembly code. A trace history of previously executed instructions may be displayed with Debug View Trace Records. To enable the trace history, set Debug Enable/Disable Trace Recording. 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. You may use the dialog Debug Inline Assembly to modify the CPU instructions. That allows you to correct mistakes or to make temporary changes to the target program you are debugging. Steps for executing the Keil programs:

1. 2.

Click on the Keil uVision Icon on Desktop The following fig will appear

3. 4.

Click on the Project menu from the title bar Then Click on New Project

5.

Save the Project by typing suitable project name with no extension in u r own folder sited in either C:\ or D:\

6. 7. 8.

Then Click on save button above. Select the component for u r project. i.e. Atmel Click on the + Symbol beside of Atmel

9.

Select AT89C51 as shown below

10.

Then Click on OK

11.

The Following fig will appear

12. 13. 14.

Then Click either YES or NOmostly NO Now your project is ready to USE Now double click on the Target1, you would get another option Source group 1 as shown in next page.

15.

Click on the file option from menu bar and select new

16.

The next screen will be as shown in next page, and just maximize it by double clicking on its blue boarder.

17. 18.

Now start writing program in either in C or ASM For a program written in Assembly, then save it with extension . asm and for C based program save it with extension .C

19.

Now right click on Source group 1 and click on Add files to Group Source

20.

Now you will get another window, on which by default C files will appear.

21. 22. 23.

Now select as per your file extension given while saving the file Click only one time on option ADD Now Press function key F7 to compile. Any error will appear if so happen.

24.

If the file contains no error, then press Control+F5 simultaneously.

25.

The new window is as follows

26. 27.

Then Click OK Now Click on the Peripherals from menu bar, and check your required port as shown in fig below

28.

Drag the port a side and click in the program file.

29. 30.

Now keep Pressing function key F11 slowly and observe. You are running your program successfully

SCHEMATIC DIAGRAM

Schematic Explanation

Você também pode gostar