Temperature Monitoring System Final

71
1. 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 block diagram of temperature monitoring system consists of temperature sensor, ADC, microcontroller and LCD. LM35 is used as temperature sensor it senses the temperature. The output of Temperature sensor is in the form of analog signal. ADC0804 is used to convert this analog signal to digital. The output of ADC is given to the Microcontroller. The output of controller will be displayed on the LCD 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 1

Transcript of Temperature Monitoring System Final

Page 1: Temperature Monitoring System Final

1. 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 block diagram of temperature monitoring system consists of

temperature sensor, ADC, microcontroller and LCD. LM35 is used as

temperature sensor it senses the temperature. The output of Temperature

sensor is in the form of analog signal. ADC0804 is used to convert this

analog signal to digital. The output of ADC is given to the

Microcontroller. The output of controller will be displayed on the LCD

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

Page 2: Temperature Monitoring System Final

BLOCK DIAGRAM

Figure 1.1: Block diagram of temperature monitoring system

1.1 DESCRIPTION:

The block diagram of temperature monitoring system consists of

temperature sensor, ADC, microcontroller and LCD. LM35 is used as

temperature sensor it senses the temperature. The output of Temperature

sensor is in the form of analog signal. ADC0804 is used to convert this

analog signal to digital. The output of ADC is given to the

Microcontroller. The output of controller will be displayed on the LCD.

2

LCD DISPLAY

8051

MICRO CONTROLLER

ADC0804

TEMPERATURE SENSOR

Page 3: Temperature Monitoring System Final

SCHEMATIC

Figure 1.2: Schematic of temperature monitoring system

3

Page 4: Temperature Monitoring System Final

2. HARDWARE DESCRIPTION

2.1 REGULATED POWERSUPPLY:

A variable regulated power supply, also called a variable bench power

supply, is one where you can continuously adjust the output voltage to your

requirements. Varying the output of the power supply is the recommended way

to test a project after having double checked parts placement against circuit

drawings and the parts placement guide.

This type of regulation is ideal for having a simple variable bench

power supply. Actually this is quite important because one of the first projects

a hobbyist should undertake is the construction of a variable regulated power

supply. While a dedicated supply is quite handy e.g. 5V or 12V, it's much

handier to have a variable supply on hand, especially for testing.

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

Circuit protection: Built-in overheating protection shuts down output when

regulator IC gets too hot

Circuit complexity: Very simple and easy to build

Circuit performance: Very stable +5V output voltage, reliable operation

4

Page 5: Temperature Monitoring System Final

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

Applications: Part of electronics devices, small laboratory power supply

Power supply voltage: Unregulated DC 8-18V power supply

Power supply current: Needed output current + 5 mA

Component costs: Few dollars for the electronics components + the input

transformer cost

BLOCK DIAGRAM:

Figure 2.1: Block diagram of power supply

5

Page 6: Temperature Monitoring System Final

POWER SUPPLY CIRCUIT DIAGRAM:

Figure 2.2: Circuit diagram of power supply

POWER SUPPLY REQUIREMENTS:

Figure 2.3: Power Supply Requirements

2.1.1 POWER SUPPLY CIRCUIT DESCRIPTION:

Above is the circuit of a basic unregulated dc power supply. A bridge

rectifier D1 to D4 rectifies the ac from the transformer secondary, which may

also be a block rectifier such as WO4 or even four individual diodes such as

1N4004 types. (See later re rectifier ratings).

6

Page 7: Temperature Monitoring System Final

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.

As a design example consider we wanted a small unregulated bench

supply for our projects. Here we will go for a voltage of about 12 - 13V at a

maximum output current (IL) of 500ma (0.5A). Maximum ripple will be 2.5%

and load regulation is 5%.

Now the RMS secondary voltage (primary is whatever is consistent with

your area) for our power transformer T1 must be our desired output Vo PLUS

the voltage drops across D2 and D4 (2 * 0.7V) divided by 1.414.

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

Page 8: Temperature Monitoring System Final

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.

These are rated 1 Amp at 400PIV, 600PIV and 1000PIV respectively.

Always be on the lookout for the higher voltage ones when they are on special.

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.

This would be an absolute minimum and if you anticipated drawing the

maximum current all the time then go to a higher VA rating.

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

Page 9: Temperature Monitoring System Final

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.

Figure 2.4 General view of Regulator

FEATURES:

• Output Current up to 1A

• Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V

• Thermal Overload Protection

• Short Circuit Protection

• Output Transistor Safe Operating Area Protection

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.

The pin-out for a three pin voltage regulator is as follows:

1.Voltage-in

2.Ground

3.Voltage out

9

Page 10: Temperature Monitoring System Final

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.

2.1.3 LIGHT EMITTING DIODE (LED):

LED's are special diodes that emit light when connected in a circuit.

They are frequently used as "pilot" lights in electronic appliances to indicate

whether the circuit is closed or not. A clear (or often colored) epoxy case

enclosed the heart of an LED, the semi-conductor chip.

Figure 2.5 LED View

10

Page 11: Temperature Monitoring System Final

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:

Figure 2.7 LED Internal View

1) By the flat side of the bulb.

2) By the shorter of the two wires extending from the LED.

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

Page 12: Temperature Monitoring System Final

2.2 General Description of LM35:

The LM35 series are precision integrated-circuit temperature sensors,

whose output voltage is linearly proportional to the Celsius (Centigrade)

temperature. The LM35 thus has an advantage over linear temperature sensors

calibrated in ˚ Kelvin, as the user is not required to subtract a large constant

voltage from its output to obtain convenient Centi-grade scaling. The LM35

does not require any external calibration or trimming to provide typical

accuracies of ±1⁄4˚C t room temperature and ±3⁄4˚C over a full −55 to +150˚C

temperature range. Low cost is assured by trimming and calibration at the

wafer level. The LM35’s 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.1˚C in still air. The LM35 is rated to operate over a −55˚ to +150˚C

temperature range, while the LM35C is rated for a −40˚ to +110˚C range (−10˚

with improved accuracy). The LM35 series is available pack-aged in hermetic

TO-46 transistor packages, w LM35C, LM35CA, and LM35D are also

available plastic TO-92 transistor package. The LM35D is al able in an 8-lead

surface mount small outline package plastic TO-220 package.

2.2.1 Features:

Calibrated directly in ˚ Celsius (Centigrade)

Linear + 10.0 mV/˚C scale factor

0.5˚C accuracy guarantee able (at +25˚C)

Rated for full −55˚ to +150˚C range

Suitable for remote applications

Low cost due to wafer-level trimming

Operates from 4 to 30 volts

Less than 60 µA current drain

12

Page 13: Temperature Monitoring System Final

Low self-heating, 0.08˚C in still air

Nonlinearity only ±1⁄4˚C typical

Low impedance output, 0.1 Ω for 1 mA load

Figure 2.8 Bottom View of LM35

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

13

Page 14: Temperature Monitoring System Final

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

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.

2.3 General Description for ADC:

The ADC0804 are CMOS 8-bit successive approximation A/D

converters that use a differential potentiometric ladder—similar to the 256R

products. These converters are designed to allow operation with the NSC800

and INS8080A derivative control bus with TRI-STATE output latches directly

driving the data bus. These A/Ds appear like memory locations or I/O ports to

the microprocessor and no interfacing logic is needed. Differential analog

voltage inputs allow increasing the common-mode rejection and offsetting the

analog zero input voltage value. In addition, the voltage reference input can be

adjusted to allow encoding any smaller analog voltage span to the full 8 bits of

resolution.

Features:

Compatible with 8080 µP derivatives—no interfacing logic needed -

access time - 135 ns

Easy interface to all microprocessors, or operates “stand alone”

Differential analog voltage inputs

Logic inputs and outputs meet both MOS and TTL voltage level

specifications

Works with 2.5V (LM336) voltage reference

On-chip clock generator

14

Page 15: Temperature Monitoring System Final

0V to 5V analog input voltage range with single 5V supply

No zero adjust required

0.3" standard width 20-pin DIP package

20-pin molded chip carrier or small outline package

Operates ratio metrically or with 5 VDC, 2.5 VDC, or analog span

adjusted voltage reference

Figure 2.9 Pin Description of Adc0804

2.4 MICROCONTROLLER AT89S52:

The AT89S52 is a low-power, high-performance CMOS 8-bit

microcontroller with 8k bytes of in-system programmable Flash memory. The

device is manufactured using Atmel’s high-density nonvolatile memory

technology and is compatible with the industry-standard 80C51 instruction set

and pinout. The on-chip Flash allows the program memory to be

reprogrammed in-system or by a conventional nonvolatile memory pro-

grammer. By combining a versatile 8-bit CPU with in-system programmable

Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller

which provides a highly-flexible and cost-effective solution to many

embedded control applications. The AT89S52 provides the following standard

features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer,

15

Page 16: Temperature Monitoring System Final

two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt

architecture, a 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 con- tents but freezes the oscillator, disabling all other chip functions

until the next interrupt or hardware reset.

2.4.1 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

• 256 X 8-BIT INTERNAL RAM

• 32 PROGRAMMABLE I/O LINES

• THREE 16-BIT TIMER/COUNTERS

• EIGHT INTERRUPT SOURCES

• FULL DUPLEX UART SERIAL CHANNEL

• LOW-POWER IDLE AND POWER-DOWN MODES

• INTERRUPT RECOVERY FROM POWER-DOWN MODE

• WATCHDOG TIMER

• DUAL DATA POINTER

• POWER-OFF FLAG

16

Page 17: Temperature Monitoring System Final

PIN CONFIGURATION:

Figure 2.10 Pin Description of 8051 Microcontroller

2.4.2 Pin Description:

VCC:

Supply voltage.

GND:

Ground.

17

Page 18: Temperature Monitoring System Final

Port 0:

Port 0 is an 8-bit open drain bidirectional 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:

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

Table 2.1 Port 1 Pins Functions

Port 2:

18

Page 19: Temperature Monitoring System Final

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

(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.

Table 2.2 Port 3 Pins Functions

19

Page 20: Temperature Monitoring System Final

RST:

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

20

Page 21: Temperature Monitoring System Final

programmed, EA w internally latched on reset. EA should be strapped to

VCC 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:

Output from the inverting oscillator amplifier.

Special Function Registers:

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.

Dual Data Pointer Registers:

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

Page 22: Temperature Monitoring System Final

DPS = 1 selects DP1. The user should always initialize the DPS bit to the

appropriate value before accessing the respective Data Pointer Register.

Power off Flag:

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).

MOV 0A0H, #data:

22

Page 23: Temperature Monitoring System Final

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).

MOV @R0, #data:

Note that stack operations are examples of indirect addressing, so the upper

128 bytes of data RAM are available as stack space.

Watchdog Timer:

(One-time Enabled with Reset-out) The WDT is intended as a recovery

method in situations where the CPU may be subjected to software upsets. The

WDT consists of a 13-bit counter and the Watchdog Timer Reset (WDTRST)

SFR. The WDT is defaulted to disable from exiting reset. 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, it will increment every machine

cycle while the oscillator is running. The WDT timeout period is dependent on

the external clock frequency. There is no way to disable the WDT except

through reset (either hardware reset or WDT over-flow reset). When WDT

overflows, it will drive an output RESET HIGH pulse at the RST pin.

Using the WDT:

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

Page 24: Temperature Monitoring System Final

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

Page 25: Temperature Monitoring System Final

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:

Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event

counter. The type of operation is selected by bit C/T2 in the SFR T2CON

(shown in Table 2). Timer 2 has three operating modes: capture, auto-reload

(up or down counting), and baud rate generator. The modes are selected by bits

in T2CON Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer

function, the TL2 register is incremented every machine cycle. Since a

machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the

oscillator frequency.

Table 2.3 Timer 2 Operating Modes

In the Counter function, the register is incremented in response to a 1-to-0

transition at its corresponding external input pin, T2. In this function, the

external input is sampled during S5P2 of every machine cycle. When the

samples show a high in one cycle and a low in the next cycle, the count is

incremented. The new count value appears in the register during S3P1 of the

cycle following the one in which the transition was detected. Since two

machine cycles (24 oscillator periods) are required to recognize a 1-to-0

transition, the maximum count rate is 1/24 of the oscillator frequency. To

ensure that a given level is sampled at least once before it changes, the level

should be held for at least one full machine cycle.

25

Page 26: Temperature Monitoring System Final

2.4.3 MICROPROCESSORS Vs MICROCONTROLLERS:

Microprocessor has following instructions to perform:

1. Reading instructions or data from program memory ROM.

2. Interpreting the instruction and executing it.

3. Microprocessor Program is a collection of instructions stored in a

Nonvolatile memory.

4. Read Data from I/O device

5. Process the input read, as per the instructions read in program memory.

NECESSITY OF MICROCONTROLLERS:

Microprocessors brought the concept of programmable devices and made

many applications of intelligent equipment. Most applications, which do not

need large amount of data and program memory, tended to be:

Costly: The microprocessor system had to satisfy the data and program

requirements so, sufficient RAM and ROM are used to satisfy most

applications .The peripheral control equipment also had to be satisfied.

Therefore, almost all-peripheral chips were used in the design. Because of

these additional peripherals cost will be comparatively high.

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

Page 27: Temperature Monitoring System Final

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

Page 28: Temperature Monitoring System Final

Figure 2.11 Block diagram of 8051 Microcontroller

2.4.4 Types of memory:

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

Page 29: Temperature Monitoring System Final

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

Page 30: Temperature Monitoring System Final

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

Functions of micro controller in main unit are

1. Sends appropriate commands to ADC to start conversion,

2. Collects the output of ADC for every 10 sec and stores in buffer,

3. Sends command to the modem for dialing the base every 80 sec,

4. Sends data in a serial manner to MODEM,

5. After data gets transmitted sends command for disconnection.

6. Sends appropriate information to the display unit as per status of the

communication medium.

2.5 LIQUID CRYSTAL DISPLAY (LCD):

Figure 2.12 Liquid Crystal Display

30

Page 31: Temperature Monitoring System Final

Vcc, at pin 16 controls the background contrast.

Vcc, at pin 2 controls the display contrast.

Pin 7 - 14 gets input data.

Pin 1 and pin 3 controls the brightness of the display.

Pin 5, gets a read/write signal.

Pin 6, enable signal.

Pin 4, data register select.

Figure 2.13 LCD Pins

31

Page 32: Temperature Monitoring System Final

Table 2.4 Pin Assignment

Interfacing Example - 16 Character x 2 Line LCD

2.5.1 Description:

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

Page 33: Temperature Monitoring System Final

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.

The 10k Potentiometer controls the contrast of the LCD panel.

Nothing fancy here. As with all the examples, I've left the power supply out.

You can use a bench power supply set to 5v or use a onboard +5 regulator.

Remember a few de-coupling capacitors, especially if you have trouble with

the circuit working properly. The 2 line x 16 character LCD modules are

available from a wide range of manufacturers and should all be compatible

33

Page 34: Temperature Monitoring System Final

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

The LCD panel requires a few instructions to be sent, to order to turn

on the display and initialize it. This is what the first for loop does. These

instructions must be sent to the LCD's Instruction Register which is controlled

by the Register Select (Pin 4). When pin 4 is low the instruction register is

selected, thus when high the data register must be selected. We connect this to

the Parallel Port's Select Printer line which happens to be hardware inverted.

Therefore if we write a '1' to bit 3 of the Control Register the Select Printer line

goes low.

We want to first send instructions to the LCD module. Therefore the

Register Select line must be low. As it is hardware inverted, we will want to set

bit 3 of the Control Register to '1'. However we don't want to upset any other

bits on the Control Port. We achieve this by reading the Control Port and

Oaring 0x80 to it. E.g. out port (CONTROL, in port b (CONTROL) | 0x08);

this will only set bit 3.

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.

After we initialize the LCD Module, we want to send text to it.

Characters are sent to the LCD's Data Port, thus we want to clear bit 3. Once

again we must only change the one bit, thus we use out port b (CONTROL, in

port b(CONTROL) & 0xF7);. Then we set up another for loop to read a byte

from the string and send it to the LCD panel. This is repeated for the length of

the string.

34

Page 35: Temperature Monitoring System Final

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:

Check the power supply connections

35

Page 36: Temperature Monitoring System Final

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

3.2 ASSEMBLY LANGUAGE PROGRAM:

Software’s used are:

1. Keil software for c programming

2. Express PCB for lay out design

3. Express SCH for schematic design

What's New in µVision3?

µ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?

µVision3 is an IDE (Integrated Development Environment) that helps you

write, compile, and debug embedded programs. It encapsulates the following

components:

A project manager.

A make facility.

Tool configuration.

Editor.

A powerful debugger.

To help you get started, several example programs (located in the \C51\

Examples, \C251\Examples, \C166\Examples, and

\ARM\...\Examples) are provided.

HELLO is a simple program that prints the string "Hello World" using

the Serial Interface.

MEASURE is a data acquisition system for analog and digital

systems.

36

Page 37: Temperature Monitoring System Final

TRAFFIC is a traffic light controller with the RTX Tiny operating

system.

SIEVE is the SIEVE Benchmark.

DHRY is the Dhrystone Benchmark.

WHET is the Single-Precision Whetstone Benchmark.

Additional example programs not listed here are provided for each device

architecture.

Building an Application in µVision2

To build (compile, assemble, and link) an application in µVision2, you must:

Select Project for example,166\EXAMPLES\HELLO\HELLO.UV2).

Select Project - Rebuild all target files or Build target.

µVision2 compiles, assembles, and links the files in your project.

Creating Your Own Application in µVision2

To create a new project in µVision2, you must:

1. Select Project - New Project.

2. Select a directory and enter the name of the project file.

3. Select Project - Select Device and select an 8051, 251, or C16x/ST10

device from the Device Database™.

4. Create source files to add to the project.

5. Select Project - Targets, Groups, Files. Add/Files, select Source

Group1, and add the source files to the project.

6. Select Project - Options and set the tool options. Note when you select

the target device from the Device Database™ all special options are set

automatically. You typically only need to configure the memory map

of your target hardware. Default memory model settings are optimal

for most applications.

7. Select Project - Rebuild all target files or Build target.

Debugging an Application in µVision2

To debug an application created using µVision2, you must:

1. Select Debug - Start/Stop Debug Session.

37

Page 38: Temperature Monitoring System Final

2. Use the Step toolbar buttons to single-step through your program. You

may enter G, main in the Output Window to execute to the main C

function.

3. Open the Serial Window using the Serial #1 button on the toolbar.

Debug your program using standard options like Step, Go, Break, and

so on.

Starting µVision2 and creating a Project

µVision2 is a standard Windows application and started by clicking on

the program icon. To create a new project file select from the µVision2 menu

Project – New Project…. This opens a standard Windows dialog that asks you

We suggest that you use a separate folder for each project. You can

simply use the icon Create New Folder in this dialog to get a new empty

folder. Then select this folder and enter the file name for the new project, i.e.

Project1.

µVision2 creates a new project file with the name PROJECT1.UV2 which

contains a default target and file group name. You can see these names in the

Project

Window – Files.

Now use from the menu Project – Select Device for Target and select a

CPU for your project. The Select Device dialog box shows the µVision2

device database. Just select the microcontroller you use. We are using for our

examples the Philips 80C51RD+ CPU. This selection sets necessary tool

options for the 80C51RD+ device and simplifies in this way the tool

Configuration

Building Projects and Creating a HEX Files

Typical, the tool settings under Options – Target are all you need to start

a new application. You may translate all source files and line the application

with a click on the Build Target toolbar icon. When you build an application

with syntax errors, µVision2 will display errors and warning messages in the

Output Window – Build page. A double click on a message line opens the

source file on the correct location in a µVision2 editor window. Once you

have successfully generated your application you can start debugging.

After you have tested your application, it is required to create an Intel

HEX file to download the software into an EPROM programmer or simulator.

38

Page 39: Temperature Monitoring System Final

µ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:

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.

39

Page 40: Temperature Monitoring System Final

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.

4. RESULT

In the temperature monitoring system we have used four blocks those

are temperature sensor,ADC0804,AT89s52microcontroller,LCD.In this system

the first block temperature sensor senses the temperature in the atmosphere in

40

Page 41: Temperature Monitoring System Final

analogue form and then sends this analogue signal to ADC to convert into

digital signal.This digital signal is fed to microcontroller through data lines.

By using the microcontroller process the data and send it to LCD in the form

of ASCIIcode.Finally LCD displays the external temperature in the

atmosphere.

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.

41

Page 42: Temperature Monitoring System Final

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:

In temperature monitoring system we can interface alarm to 8051

microcontroller. By using this interface we can found an alarm sound when

temperature increases to certain level.

6. REFERENCES

Books:

1. Muhammad Ali Mazidi, The 8051 Microcontroller and Embedded

systems, 2nd Edition.

42

Page 43: Temperature Monitoring System Final

2. Scott Machenzie, The 8051 Microcontroller.

3. B L Theraja, Electrical Technology.

4. K. Y. Tang, Alternating Current Circuits.

5. Golding and Widdis, Electrical measurements and measuring

instruments.

6. Admiralty, Examples in Electrical Calculations.

7. B. W. Williams, Power Electronics.

Books from Reference Library.

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

7. APPENDIX

7.1 SOURCE CODE:

43

Page 44: Temperature Monitoring System Final

#include<reg51.h>

sbit LCD_RS = P2^7;

sbit LCD_RW = P2^6;

sbit LCD_CS = P2^5;

sfr LCD_DT = 0x80;

sbit READ = P3^0;

sbit WRITE = P3^3;

sbit INTR = P3^2;

void delay(int k)

int l;

while(k)

for(l = 0; l<115; l++);

k--;

void command_Lcd(char value)

LCD_DT = value;

LCD_RS = 0;

LCD_RW = 0;

LCD_CS = 1;

delay(10);

LCD_CS = 0;

delay(10);

void display_lcd(char value)

44

Page 45: Temperature Monitoring System Final

LCD_DT = value;

LCD_RS = 1;

LCD_RW = 0;

LCD_CS = 1;

delay(10);

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);

void printl(char *p)

int i;

for(i = 0; i<p[i]; i++)

display_lcd(p[i]);

45

Page 46: Temperature Monitoring System Final

unsigned char readadc()

int adVal;

P1 = 0xff;

READ = 1;

WRITE = 1;

INTR = 1;

WRITE = 0;

delay(2);

WRITE = 1;

while( INTR == 1 );

READ = 0;

adVal = P1;

READ = 1;

return(adVal);

void Process(int Value)

int Temp, T1 = 0,T2 = 0,T3 = 0;

T1 = Value %10; //123-----> T1 = 3

Temp = Value / 10; //123-----> Temp = 12

T2 = Temp % 10; //12-------->T2 = 2

Temp = Temp /10; //12-------->Temp = 1

T3 = Temp ; //1--------->T3 = 1

command_Lcd(0x84);

delay(10);

46

Page 47: Temperature Monitoring System Final

//change this prompt according to your choice Example Temp:-------->

Watch//

printl("Temp:");

display_lcd(T3+0x30);

display_lcd(T2+0x30);

display_lcd(T1+0x30);

delay(100);

void main()

Initialise_Lcd();

//change this prompt according to your choice Example WELCOME-------->

Watch//

printl("WEL COME");

delay(3000);

/* command_Lcd(0xC2);

delay(10);

printl("HELLO WORLD");

delay(3000); */

command_Lcd(0x01);

delay(10);

command_Lcd(0x82);

delay(10);

printl("RANJITH REDDY");

command_Lcd(0xC3);

delay(10);

printl("06S41A0437");

delay(3000);

command_Lcd(0x01);

delay(10);

47

Page 48: Temperature Monitoring System Final

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());

7.2 LIST OF TABLES PAGE NO’S

Table 2.1 Port 1 Pins Functions……………………………………...18

48

Page 49: Temperature Monitoring System Final

Table 2.2 Port 3 Pins Functions……………………………………...19

Table 2.3 Timer 2 Operating Modes………………………………...25

Table 2.4 Pin Assignment……………………………………………31

7.3 LIST OF FIGURES PAGE NO’S

Figure 1.1: Block diagram of temperature monitoring system…..2

Figure 1.2: Schematic of temperature monitoring system……….3

Figure 2.1: Block diagram of power supply…………………………5

Figure 2.2: Circuit diagram of power supply………………………...6

Figure 2.3: Power Supply Requirements…………………..…………6

Figure 2.4 General view of Regulator…………………………….….9

Figure 2.5 LED View……………………………………………….10

Figure 2.6 LED Symbol…………………………………………….11

Figure 2.7 LED Internal view………………………………………11

Figure 2.8 Bottom View of LM35………………………………….13

Figure 2.9 Pin Description of Adc0804…………………………….15

Figure 2.10 Pin Description of 8051 Microcontroller……………...17

Figure 2.11 Block diagram of 8051 Microcontroller……………….27

Figure 2.12 Liquid Crystal Display………………………………...30

Figure 2.13 LCD Pins………………………………………….……31

Figure 2.14 Schematic of LCD……………………………………..32

49