Professional Documents
Culture Documents
ABSTRACT
AIM:
The main aim of this project is to detect drunken driver
LDR
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
information
Sensor is the device which converts
Then
anyBreak
physical quantity to its
OFF
Equivalent electrical signal. There
These
operations
are different
types of sensor are
Microcontroller.
available there are: Temperature
sensor, Light sensor, Voltage sensor,
Smoke Sensor, Gas sensor, Fire
sensor, Alcohol Sensors, etc.
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
ALP
Processor
Peripherals
VB
memory
Etc.,
Construction industry
Transport
Domestic service
Communications
ALU
CU
Memory
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.
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.
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:
CHAPTER-3
Hardware Explanation
Block Diagram For Power Supply
(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.
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.
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.
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.
...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.
...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.
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.
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:
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
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
Bit
6
TR1
Bit
TF0
TR0
IE1
IT1
IE0
IT0
Description
Number Mnemonics
7
TF1
TR1
TF0
TR0
IE1
IT1
IE0
IT0
GATE1
C/T 1
M11
M01
GATE0
C/T 0
M10
M00
Bit
Bit Mnemonics
Description
GATE1
Number
7
C/T 1
M11
M01
M11
0
M01
0
operating mode
Mode0: 8 bit timer/counter (TH1) with 5 bit
prescaler (TL1).
GATE 0
C/T 0
clock.
Set for counter operation: timer0 counts negative transition on external
pin T0.
1
M10
M00
operating mode
Mode0: 8 bit timer/counter (TH1) with 5 bit
pre-scaler (TL1).
0
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:
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.
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
Microphone
Seismometer
Accelerometer
2] Automotive, transportation
Crank sensor
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
Mass flow sensor, or mass airflow (MAF) sensor, used to tell the ECU the mass of air
entering the engine
Parking sensors, used to alert the driver of unseen obstacles during parking manoeuvres
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
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
Electronic nose
Electrolyteinsulatorsemiconductor sensor
Hydrogen sensor
Ion-selective electrode
Olfactometer
Optode
Oxygen sensor
Pellistor
pH glass electrode
Potentiometric sensor
Redox electrode
Smoke detector
Ammeter
Current sensor
Galvanometer
Hall probe
Leaf electroscope
Magnetometer
Metal detector
Multi-meter
Ohmmeter
Telescope
Voltmeter
Voltage detector
Watt-hour meter
Bedwetting alarm
Dew warning
Fish counter
Gas detector
Hygrometer
Leaf sensor
Pyranometer
Pyrgeometer
Psychrometer
Rain gauge
Rain sensor
Seismometers
Snow gauge
Stream gauge
Tide gauge
Anemometer
Flow sensor
Gas meter
Water meter
Bubble chamber
Cloud chamber
Geiger counter
Neutron detection
Particle detector
Scintillation counter
Scintillator
Wire chamber
8] Navigation instruments
Altimeter
Attitude indicator
Depth gauge
Fluxgate compass
Gyroscope
Magnetic compass
MHD sensor
Turn coordinator
Variometer
Accelerometer
Gravimeter
Inclinometer
Laser rangefinder
Linear encoder
Odometer
Piezoelectric accelerometer
Position sensor
Rotary encoder
Selsyn
Tilt sensor
Tachometer
Charge-coupled device
Colorimeter
Electro-optical sensor
Flame detector
Infra-red sensor
Nichols radiometer
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
Ionization gauge
McLeod gauge
Oscillating U-tube
Pirani gauge
Pressure sensor
Pressure gauge
Tactile sensor
Bhangmeter
Hydrometer
Force gauge
Level sensor
Load cell
Piezoelectric sensor
Strain gauge
Torque sensor
Viscometer
Alarm sensor
Motion detector
Occupancy sensor
Reed switch
Stud finder
Triangulation sensor
Touch switch
Wired glove
Doppler radar
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.
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
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, = 0.00385 or 0.385 %/C. This T coefficient
should not be confused with the 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:
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.
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.
ADC
The ADC0808 data acquisition component is a monolithic CMOS device with an 8-bit analog-todigital converter, 8-channel multiplexer and microprocessor compatible control logic. The 8-bit
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.
Operates ratio metrically or with 5 VDC or analog span adjusted voltage reference.
3.
4.
5.
6.
7.
8.
9.
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.
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 10-bit
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.
Latching Relay
2.
Reed Relay
3.
4.
5.
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.
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.
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.
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.
Symbol
Level
VSS
Power, GND
VDD
Power, 5V
Vo
Pin
Function
RS
R/W
7-14 DB0-DB7
LCD
the
H/L
H,H->L Enable
H/L Data Bus; Software selectable 4- or 8-bit mode
15
NC
NOT CONNECTED
16
NC
NOT CONNECTED
line
consist
three
control
(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
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.
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.
3.
4.
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.
9.
10.
Then Click on OK
11.
12.
13.
14.
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.
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.
Now select as per your file extension given while saving the file
22.
23.
Now Press function key F7 to compile. Any error will appear if so happen.
24.
25.
26.
Then Click OK
27.
Now Click on the Peripherals from menu bar, and check your required port as shown
in fig below
28.
29.
30.
SCHEMATIC DIAGRAM
Schematic Explanation