Escolar Documentos
Profissional Documentos
Cultura Documentos
INTRODUCTION
This project explains about a simple low cost circuit which can be mainly used
in large scale industries to detect the high temperature and take immediate
measures. This circuit is used to sense the temperature at a place. It indicates
the temperature on the LCD with the help of microcontroller. This circuit
makes use of LM35 which is a 3 pin centigrade temperature sensor IC. It
directly senses the temperature and sends the data to the controller.
The complete project is built around the 8051 micro controller. PCB Wizard
Schematic generation software is employed to prepare the schematic for
development of project. Hardware is built according to schematic prepared by
soldering each component on the general purpose PCB. Source code is
developed using Keil micro vision software. µVision is an IDE (Integrated
Development Environment) that helps you write, compile, and debug
embedded programs. The written source code is dumped into the
microcontroller IC using a Programmer. To dump the code into microcontroller
micro C Flash software is used.
1
BLOCK DIAGRAM
TEMPERATURE
SENSOR
8051 LCD DISPLAY
MICRO
CONTROLLER
ADC0804
1.1 DESCRIPTION:
2
SCHEMATIC
3
2. HARDWARE DESCRIPTION
Most digital logic circuits and processors need a 5 volt power supply. To
use these parts we need to build a regulated 5 volt source. Usually you start
with an unregulated power supply ranging from 9 volts to 24 volts DC (A 12
volt power supply is included with the Beginner Kit and the Microcontroller
Beginner Kit.). To make a 5 volt power supply, we use a LM7805 voltage
regulator IC (Integrated Circuit). The IC is shown below
CIRCUIT FEATURES
Brief description of operation: Gives out well regulated +5V output, output
current capability of 100 mA
4
Availability of components: Easy to get, uses only very common basic
components
Design testing: Based on datasheet example circuit, I have used this circuit
successfully as part of many electronics projects
Component costs: Few dollars for the electronics components + the input
transformer cost
BLOCK DIAGRAM:
5
POWER SUPPLY CIRCUIT DIAGRAM:
6
The principal advantage of a bridge rectifier is you do not need a centre
tap on the secondary of the transformer. A further but significant advantage is
that the ripple frequency at the output is twice the line frequency (i.e. 50 Hz or
60 Hz) and makes filtering somewhat easier.
This means that Vsec = [13V + 1.4V] / 1.414 which equals about 10.2V.
Depending on the VA rating of your transformer, the secondary voltage will
vary considerably in accordance with the applied load. The secondary voltage
on a transformer advertised as say 20VA will be much greater if the secondary
is only lightly loaded.
If we accept the 2.5% ripple as adequate for our purposes then at 13V
this becomes 13 * 0.025 = 0.325 Vrms. The peak to peak value is 2.828 times
this value. Vrip = 0.325V X 2.828 = 0.92 V and this value is required to
calculate the value of C1. Also required for this calculation is the time interval
for charging pulses. If you are on a 60Hz system it it 1/ (2 * 60) = 0.008333
which is 8.33 milliseconds. For a 50Hz system it is 0.01 sec or 10
milliseconds.
Remember the tolerance of the type of capacitor used here is very loose.
The important thing to be aware of is the voltage rating should be at least 13V
X 1.414 or 18.33. Here you would use at least the standard 25V or higher
(absolutely not 16V).With our rectifier diodes or bridge they should have a
PIV rating of 2.828 times the Vsec or at least 29V. Don't search for this rating
because it doesn't exist. Use the next highest standard or even higher. The
7
current rating should be at least twice the load current maximum i.e. 2 X 0.5A
or 1A. A good type to use would be 1N4004, 1N4006 or 1N4008 types.
TRANSFORMER RATING:
In our example above we were taking 0.5A out of the Vsec of 10V. The
VA required is 10 X 0.5A = 5VA. This is a small PCB mount transformer
available in Australia and probably elsewhere.
The two capacitors in the primary side are small value types and if you
don't know precisely and I mean precisely what you are doing then OMIT
them. Their loss won't cause you heartache or terrible problems.
The fuse F1 must be able to carry the primary current but blow under excessive
current; in this case we use the formula from the diagram. Here N = 240V /
10V or perhaps 120V / 10V. The fuse calculates in the first instance to [ 2 X
0.5A ] / [240 / 10] or .04A or 40 ma. In the second case .08A or 80 ma. The
difficulty here is to find suitable fuses of that low a current and voltage rating.
In practice you use the closest you can get (often 100 ma). Don't take that too
literal and use 1A or 5A fuses.
2.1.2 LM 7805:
DESCRIPTION:
The LM7804 series of three terminal positive regulators are available in
the TO-220/D-PAK package and with several fixed output voltages, making
them useful in a wide range of applications. Each type employs internal current
limiting, thermal shut down and safe operating area protection, making it
essentially indestructible. If adequate heat sinking is provided, they can deliver
8
over 1A output current. Although designed primarily as fixed voltage
regulators, these devices can be used with external components to obtain
adjustable voltages and currents.
WORKING:
Voltage regulator limits the voltage that passes through it. Each
regulator has a voltage rating; For example, the 7805 IC (these regulators are
often considered to be ICs) is a 5-volt voltage regulator. What that means is
that no matter how many volts you put into it, it will output only 5 volts. This
means that you can connect a 9-volt battery, a 12-volt power supply, or
virtually anything else that's over 5 volts, and have the 7805 give you a nice
supply of 5 volts out. There are also 7812 (12-volt) and 7815 (15-volt) three-
pin regulators in common use.
1.Voltage-in
2.Ground
3.Voltage out
9
For example, with a 9-volt battery, you'd connect the positive end to pin 1 and
the negative (or ground) end to pin 2. A 7805 would then give you +5 volts on
pin 3.Voltage regulators are simple and useful. There are only two important
drawbacks to them: First, the input voltage must be higher than the output
voltage. For example, you cannot give a 7805 only 2 or 3 volts and expect it to
give you 5 volts in return. Generally, the input voltage must be at least 2 volts
higher than the desired output voltage, so a 7805 would require about 7 volts to
work properly. The other problem: The excess voltage is dissipated as heat. At
low voltages (such as using a 9-volt battery with a 7805), this is not a problem.
At higher voltages, however, it becomes a very real problem and you must
have some way of controlling the temperature so you don't melt your regulator.
This is why most voltage regulators have a metal plate with a hole in it; That
plate is intended for attaching a heat sink to-Do not confuse three-pin voltage
regulators with a device known as a TRIAC (short for triode AC switch). It is
easy to associate them with each other, since they look similar (both have three
pins) and they both regulate power. However, the 78XX types of regulators are
used for regulating DC current, while TRIACs are used for AC current.
10
Figure 2.6 LED Symbol
LED’s must be connected the correct way round, the diagram may be labeled a
or + for anode and k or - for cathode. The negative side of an LED lead is
indicated in two ways:
If you can see inside the LED the cathode is the larger electrode (but
this is not an official identification method). The negative lead should be
connected to the negative terminal of a battery. LED's operate at relative low
voltages between about 1 and 4 volts, and draw currents between about 10 and
40 mille amperes. Voltages and currents substantially about these values can
melt a LED chip. The most important part of light emitting diode (LED) is the
semi-conductor chip located in the center of the bulb as shown below. The chip
has two regions separated by a junction. The p region is dominated by positive
electric charges, and the n region is dominated by negative electric charges.
The junction acts as a barrier to the flow of electrons between the p and n
regions. Only when sufficient voltage is applied to the semi-conductor chip,
can the current flow and the electron cross the junction into the p region? In
the absence of the large enough electric potential difference (voltage) across
the LED leads, the junction presents an electric potential barrier to the flow of
electrons.
11
2.2 General Description of LM35:
2.2.1 Features:
12
• Low impedance output, 0.1 Ω for 1 mA load
2.2.2 Applications
The LM35 can be applied easily in the same way as other integrated-
circuit temperature sensors. It can be glued or cemented to a surface and its
temperature will be within about 0.01˚C of the surface temperature. This
presumes that the ambient air temperature is almost the same as the surface
temperature; if the air temperature were much higher or lower than the surface
temperature, the actual temperature of the LM35 die would be at an
intermediate temperature between the surface temperature and the air
temperature. This is especially true for the TO-92 plastic package, where the
copper leads are the principal thermal path to carry heat into the device, so its
temperature might be closer to the air temperature than to the surface
temperature. To minimize this problem, be sure that the wiring to the LM35,
as it leaves the device, is held at the same temperature as the surface of
interest. The easiest way to do this is to cover up these wires with a bead of
epoxy which will insure that the leads and wires are all at the same
temperature as the surface, and that the LM35 die’s temperature will not be
affected by the air temperature. The TO-46 metal package can also be soldered
to a metal surface or pipe without damage. Of course, in that case the V−
terminal of the circuit will be grounded to that metal. Alternatively, the LM35
can be mounted inside a sealed-end metal tube, and can then be dipped into a
bath or screwed into a threaded hole in a tank. As with any IC, the LM35 and
accompanying wiring and circuits must be kept insulated and dry, to avoid
leakage and corrosion. This is especially true if the circuit may operate at cold
temperatures where condensation can occur. Printed-circuit coatings and
varnishes such as Hum seal and epoxy paints or dips are often used to insure
13
that moisture cannot corrode the LM35 or its connections. These devices are
sometimes soldered to a small light-weight heat fin, to decrease the thermal
time constant and speed up the response in slowly-moving air. On the other
hand, a small thermal mass may be added to the sensor, to give the steadiest
reading despite small deviations in the air temperature.
Features:
14
• Operates ratio metrically or with 5 VDC, 2.5 VDC, or analog span
adjusted voltage reference
15
RAM con- tents but freezes the oscillator, disabling all other chip functions
until the next interrupt or hardware reset.
2.4.1 FEATURES:
16
PIN CONFIGURATION:
•
•
17
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:
Port 1 is an 8-bit bidirectional 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. As
inputs, Port 1 pins that are externally being pulled low will source current (IIL)
because of the internal pull-ups. 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:
Port 2 is an 8-bit bidirectional 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.
As inputs, Port 2 pins that are externally being pulled low will source current
18
(IIL) because of the internal pull-ups. 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 uses 8-bit addresses (MOVX @ RI),
Port 2 emits the contents of the P2 Special Function Register. Port 2 also
receives the high-order address bits and some control signals during Flash
programming and verification.
Port 3:
Port 3 is an 8-bit bidirectional I/O port with internal pullups. The Port 3 output
buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins,
they are pulled high by the internal pullups and can be used as inputs. As
inputs, Port 3 pins that are externally being pulled low will source current (IIL)
because of the pullups. 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 pro-gramming and verification.
RST:
19
Reset input. A high on this pin for two machine cycles while the oscillator is
running resets the device. This pin drives High for 96 oscillator periods after
the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be
used to disable this feature. In the default state of bit DISRTO, the RESET
HIGH out feature is enabled.
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 of 1/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
microcontroller is in external execution mode. Weakly pulled high. Setting the
ALE-disable bit has no effect if the microcontroller 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 pro-gram memory, PSEN
is activated twice each machine cycle, except that two PSEN activations are
skipped during each access to external data memory. Program Store Enable
(PSEN) is the read strobe to external program memory. When the AT89S52 is
executing code from external pro- gram memory, PSEN is activated twice
each machine cycle, except that two PSEN activations are skipped during each
access to external data memory. Note, however, that if lock bit 1 is
programmed, EA w internally latched on reset. EA should be strapped to VCC
20
for internal programming. This pin also receives the 12-volt programming
enable age (VPP) during Flash programming.
XTAL1:
Input to the inverting oscillator amplifier and input internal clock operating
circuit.
XTAL2:
A map of the on-chip memory area called the Special Function Register (SFR)
space is. Note that not all of the addresses are occupied, and unoccupied
addresses may not be implemented on the chip. Read accesses to these
addresses will in general return random data, and write accesses will have an
indeterminate effect. User software should not write 1s to these unlisted
locations, since they may be used in future products to invoke new features. In
that case, the reset or inactive values of the new bits will always be 0. Timer 2
Registers: Control and status bits are contained in registers T2CON (shown in
Table 2) and T2MOD (shown in Table 3) for Timer 2. The register pair
(RCAP2H, RCAP2L) are the Capture/Reload registers for Timer 2 in 16-bit
capture mode or 16-bit auto-reload mode. Interrupt Registers: The individual
interrupt enable bits are in the IE register. Two priorities can be set for each of
the six interrupt sources in the IP register.
To facilitate accessing both internal and external data memory, two banks of
16-bit Data Pointer Registers are provided: DP0 at SFR address locations
82H-83H and DP1 at 84H-85H. Bit DPS = 0 in SFR AUXR1 selects DP0 and
21
DPS = 1 selects DP1. The user should always initialize the DPS bit to the
appropriate value before accessing the respective Data Pointer Register.
The Power off Flag (POF) is located at bit 4 (PCON.4) in the PCON SFR.
POF is set to “1” during power up. It can be set and rest under software
control and is not affected by reset.
Memory Organization:
MCS-51 devices have a separate address space for Program and Data Memory.
Up to 64K bytes each of external Program and Data Memory can be addressed.
Program Memory:
If the EA pin is connected to GND, all program fetches are directed to external
memory. On the AT89S52, if EA is connected to VCC, program fetches to
addresses 0000H through 1FFFH are directed to internal memory and fetches
to addresses 2000H through FFFFH are to external memory.
Data Memory:
The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes
occupy a parallel address space to the Special Function Registers. This means
that the upper 128 bytes have the same addresses as the SFR space but are
physically separate from SFR space. When an instruction accesses an internal
location above address 7FH, the address mode used in the instruction specifies
whether the CPU accesses the upper 128 bytes of RAM or the SFR space.
Instructions which use direct addressing access of the SFR space. For example,
the following direct addressing instruction accesses the SFR at location 0A0H
(which is P2).
22
Instructions that use indirect addressing access the upper 128 bytes of RAM.
For example, the following indirect addressing instruction, where R0 contains
0A0H, accesses the data byte at address 0A0H, rather than P2 (whose address
is 0A0H).
Note that stack operations are examples of indirect addressing, so the upper
128 bytes of data RAM are available as stack space.
Watchdog Timer:
To enable the WDT, a user must write 01EH and 0E1H in sequence to the
WDTRST register (SFR location 0A6H). When the WDT is enabled, the user
needs to service it by writing 01EH and 0E1H to WDTRST to avoid a WDT
over-flow. The 13-bit counter overflows when it reaches 8191 (1FFFH), and
this will reset the device. When the WDT is enabled, it will increment every
machine cycle while the oscillator is running. This means the user must reset
the WDT at least every 8191 machine cycles. To reset the WDT the user must
write 01EH and 0E1H to WDTRST. WDTRST is a write-only register. The
WDT counter cannot be read or written. When WDT overflows, it will
23
generate an output RESET pulse at the RST pin. The RESET pulse duration is
96xTOSC, where TOSC=1/FOSC. To make the best use of the WDT, it should
be serviced in those sections of code that will periodically be executed within
the time required to prevent a WDT reset. WDT during Power-down and Idle
In Power-down mode the oscillator stops, which means the WDT also stops.
While in Power-down mode, the user does not need to service the WDT. There
are two methods of exiting Power-down mode: by a hardware reset or via a
level-activated external interrupt which is enabled prior to entering Power-
down mode. When Power-down is exited with hardware reset, servicing the
WDT should occur as it normally does whenever the AT89S52 is reset. Exiting
Power-down with an interrupt is significantly different. The interrupt is held
low long enough for the oscillator to stabilize. When the interrupt is brought
high, the interrupt is serviced. To prevent the WDT from resetting the device
while the interrupt pin is held low, the WDT is not started until the interrupt is
pulled high. It is suggested that the WDT be reset during the interrupt service
for the interrupt used to exit Power-down mode. To ensure that the WDT does
not overflow within a few states of exiting Power-down, it is best to reset the
WDT just before entering Power-down mode. Before going into the IDLE
mode, the WDIDLE bit in SFR AUXR is used to determine whether the WDT
continues to count if enabled. The WDT keeps counting during IDLE
(WDIDLE bit = 0) as the default state. To prevent the WDT from resetting the
AT89S52 while in IDLE mode, the user should always set up a timer that will
periodically exit IDLE, service the WDT, and reenter IDLE mode. With
WDIDLE bit enabled, the WDT will stop to count in IDLE mode and resumes
the count upon exit from IDLE.
UART:
The UART in the AT89S52 operates the same way as the UART in the
AT89C51 and AT89C52. For further information on the UART operation, refer
to the ATMEL Web site (http://www.atmel.com). From the home page, select
‘Products’, then ‘8051-Architecture Flash Microcontroller’, then ‘Product
Overview’.
Timer 0 and 1:
24
Timer 0 and Timer 1 in the AT89S52 operate the same way as Timer 0 and
Timer 1 in the AT89C51 and AT89C52. For further information on the timers’
operation, refer to the ATMEL Web site (http://www.atmel.com). From the
home page, select ‘Products’, then ‘8051-Architecture Flash Microcontroller’,
then ‘Product Overview’.
Timer 2:
25
2.4.3 MICROPROCESSORS Vs MICROCONTROLLERS:
An example:
8085 chip needs: An Address latch for separating address from multiplex
address and data.32-KB RAM and 32-KB ROM to be able to satisfy most
applications. As also Timer / Counter, Parallel programmable port, Serial port,
and Interrupt controller are needed for its efficient applications. In comparison
a typical Micro controller 8051 chip has all that the 8051 board has except a
reduced memory as follows.
4K bytes of ROM as compared to 32-KB, 128 Bytes of RAM as compared to
32-KB.
Bulky: On comparing a board full of chips (Microprocessors) with one chip
with all components in it (Micro controller).
Debugging:
Lots of Micro-processor circuitry and program to debug. In Micro controller
there is no Microprocessor circuitry to debug. Slower Development time: As
we have observed Microprocessors need a lot of debugging at board level and
26
at program level, where as, Micro controller do not have the excessive circuitry
and the built-in peripheral chips are easier to program for operation.
So peripheral devices like Timer/Counter, Parallel programmable port, Serial
Communication Port, Interrupt controller and so on, which were most often
used were integrated with the Microprocessor to present the Micro controller
RAM and ROM also were integrated in the same chip. The ROM size was
anything from 256 bytes to 32Kb or more. RAM was optimized to minimum of
64 bytes to 256 bytes or more.
Typical Microcontroller Features:
8/16/32 CPU
Instruction set rich in I/O & bit operations.
One or more I/O ports.
One or more timer/counters.
One or more interrupt inputs and an interrupt controller
One or more serial communication ports.
Analog to Digital /Digital to Analog converter
One or more PWM output
Network controlled interface
27
Figure 2.11 Block diagram of 8051 Microcontroller
The 8051 have three general types of memory. They are on-chip
memory, external Code memory and external Ram. On-Chip memory refers to
physically existing memory on the micro controller itself. External code
memory is the code memory that resides off chip. This is often in the form of
an external EPROM. External RAM is the Ram that resides off chip. This often
is in the form of standard static RAM or flash RAM.
a) Code memory:
Code memory is the memory that holds the actual 8051 programs that
is to be run. This memory is limited to 64K. Code memory may be found on-
28
chip or off-chip. It is possible to have 4K of code memory on-chip and 60K off
chip memory simultaneously. If only off-chip memory is available then there
can be 64K of off chip ROM. This is controlled by pin provided as EA
b) Internal RAM:
The 8051 have a bank of 128 bytes of internal RAM. The internal RAM is
found on-chip. So it is the fastest Ram available. And also it is most flexible in
terms of reading and writing. Internal Ram is volatile, so when 8051 is reset,
this memory is cleared. 128 bytes of internal memory are subdivided.
The first 32 bytes are divided into 4 register banks. Each bank contains 8
registers. Internal RAM also contains 128 bits, which are addressed from 20h
to 2Fh. These bits are bit addressed i.e. each individual bit of a byte can be
addressed by the user. They are numbered 00h to 7Fh. The user may make use
of these variables with commands such as SETB and CLR
2.4.5 INTERRUPTS:
Interrupts are hardware signals that are used to determine conditions that exist
in external and internal circuits. Any interrupt can cause the 8051 to perform a
hardware call to an interrupt –handling subroutine that is located at a
predetermined absolute address in the program memory.
Five interrupts are provided in the 8051. Three of these are generated
automatically by the internal operations: Timer flag 0, Timer Flag 1, and the
serial port interrupt (RI or TI) Two interrupts are triggered by external signals
provided by the circuitry that is connected to the pins INTO 0 and INTO1. The
interrupts maybe enable or disabled, given priority or otherwise controlled by
altering the bits in the Interrupt Enabled (IE) register, Interrupt Priority (IP)
register, and the Timer Control (TCON) register. . These interrupts are mask
able i.e. they can be disabled. Reset is a non maskable interrupt which has the
highest priority. It is generated when a high is applied to the reset pin. Upon
reset, the registers are loaded with the default values.
Each interrupt source causes the program to do store the address in PC onto the
stack and causes a hardware call to one of the dedicated addresses in the
29
program memory. The appropriate memory locations for each for each
interrupt are as follows:
Interrupt Address
RESET 0000
IE0 (External interrupt 0) 0003
TF0 (Timer 0 interrupt) 000B
IE1 (External interrupt 1) 0013
TF1 (Timer 1 interrupt) 001B
SERIAL 0023
30
Figure 2.12 Liquid Crystal Display
31
Table 2.4 Pin Assignment
This is the first interfacing example for the Parallel Port. We will start
with something simple. This example doesn't use the Bi-directional feature
found on newer ports, thus it should work with most, if no all Parallel Ports. It
however doesn't show the use of the Status Port as an input. So what are we
interfacing? A 16 Character x 2 Line LCD Module to the Parallel Port. These
LCD Modules are very common these days, and are quite simple to work with,
as all the logic required running them is on board.
Schematic:
32
Figure 2.14 Schematic of LCD
Circuit Description:
Above is the quite simple schematic. The LCD panel's Enable and
Register Select is connected to the Control Port. The Control Port is an open
collector / open drain output. While most Parallel Ports have internal pull-up
resistors, there are a few which don't. Therefore by incorporating the two 10K
external pull up resistors, the circuit is more portable for a wider range of
computers, some of which may have no internal pull up resistors.
We make no effort to place the Data bus into reverse direction. Therefore we
hard wire the R/W line of the LCD panel, into write mode. This will cause no
bus conflicts on the data lines. As a result we cannot read back the LCD's
internal Busy Flag which tells us if the LCD has accepted and finished
processing the last instruction. This problem is overcome by inserting known
delays into our program.
33
with the HD44780. The one I used to test this circuit was a Power trip PC-
1602F and an old Philips LTN211F-10 which was extracted from a Poker
Machine! The diagram to the right shows the pin numbers for these devices.
When viewed from the front, the left pin is pin 14 and the right pin is pin
After we place a data byte on the data lines, we must then signal to the
LCD module to read the data. This is done using the Enable line. Data is
clocked into the LCD module on the high to low transition. The Strobe is
hardware inverted, thus by setting bit 0 of the Control Register we get a high to
low transition on the Strobe line. We then wait for a delay, and return the line
to a high state ready for the next byte.
34
The delays should be suitable for most machines. If the LCD panel is
not initializing properly, you can try increasing the delays. Likewise if the
panel is skipping characters, e.g. Test, 2. On the other hand, if the LCD module
is repeating characters e.g. testing then you may have a faulting Enable
connection. Check your Enable to Strobe connection.
3. SOFTWARE DESCRIPTION
3.1 TEST PLAN:
35
• Check the power supply connections
• Insert smart card in to the smart card reader
• Check LEDs
• Check Microcontroller minimum requirements
• Welcome message will be printed on LCD
• Consumed units and available units are displayed on LCD
• A message will be displayed if there is no smart card
µVision3 adds many new features to the Editor like Text Templates, Quick
Function Navigation, Syntax Coloring with brace highlighting 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?
36
• 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.
37
Debugging an Application in µVision2
38
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 file
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:
39
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.
40
4. RESULT
41
5. CONCLUSION& FUTURE SCOPE:
This project explains about a simple low cost circuit which can be
mainly used in large scale industries to detect the high temperature and take
immediate measures. This circuit is used to sense the temperature at a place. It
indicates the temperature on the LCD with the help of microcontroller.
This circuit makes use of LM35 which is a 3 pin centigrade
temperature sensor IC. It directly senses the temperature and sends the data to
the controller. This has been successfully completed under the guidance.
FUTURE SCOPE:
42
6. REFERENCES
Books:
Websites:
1. www.futurlec.com
2. www.wikipedia.org/ADC 0804/Analog-to-digita.htm
3. http://www.electronicsforu.com/efyhome/cover/home.htm
4. http://en.wikipedia.org/wiki/Diode_bridge#column-one
5. http://www.allaboutcircuits.com/vol_6/chpt_5/index.html
6. http://www.beyondlogic.org/serial/serial.htm#1
7. http://geocities.com/SiliconValley/2072/electron.htm
8. http://www.national.com/opf/LM/LM7805C.html#Datasheet
43
7. APPENDIX
#include<reg51.h>
sbit LCD_RS = P2^7;
sbit LCD_RW = P2^6;
sbit LCD_CS = P2^5;
void delay(int k)
{
int l;
while(k)
{
for(l = 0; l<115; l++);
k--;
}
}
44
LCD_CS = 0;
delay(10);
}
void Initialise_Lcd()
{
command_Lcd(0x38);
delay(10);
command_Lcd(0x01);
delay(10);
command_Lcd(0x0e);
delay(10);
command_Lcd(0x06);
delay(10);
command_Lcd(0x84);
delay(10);
}
45
for(i = 0; i<p[i]; i++)
{
display_lcd(p[i]);
}
}
INTR = 1;
WRITE = 0;
delay(2);
WRITE = 1;
while( INTR == 1 );
READ = 0;
adVal = P1;
READ = 1;
return(adVal);
}
46
Temp = Temp /10; //12-------->Temp = 1
T3 = Temp ; //1--------->T3 = 1
command_Lcd(0x84);
delay(10);
void main()
{
Initialise_Lcd();
47
printl("06S41A0437");
delay(3000);
command_Lcd(0x01);
delay(10);
command_Lcd(0x83);
delay(10);
printl("RAVI TEJA");
command_Lcd(0xC3);
delay(10);
printl("06S41A0411");
delay(3000);
command_Lcd(0x01);
delay(10);
command_Lcd(0x82);
delay(10);
printl("HARI KRISHNA");
command_Lcd(0xC3);
delay(10);
printl("06S41A0417");
delay(3000);
command_Lcd(0x01);
delay(10);
command_Lcd(0x84);
delay(10);
printl("SRIDHAR");
command_Lcd(0xC3);
delay(10);
printl("06S41A0445");
delay(3000);
command_Lcd(0x01);
delay(10);
while(1) Process(readadc());}
48
7.2 LIST OF TABLES PAGE NO’S
49