Professional Documents
Culture Documents
PROJECT REPORT
ON
ELECTRONIC THERMOMETER USING
MICROCONTROLLER
SUBMITTED BY
R.ANAND BALAN
S.BALAJI
D.RAJESH PANDIYAN
K.B.RAJKUMAR
T.SUBRAMANIA SIVA
S.SUNIL
BONAFIDE CERTIFICATE
This is to certify that this ELECTRONIC THERMOMETER
USING
MICROCONTROLLER is a bonafide record of project work
carried
out by Mr. D.RAJESH PANDIYAN REG.NO: 2143127 of III
year, Sixth
Semester in Electronics & Communication Engg. had
successfully
Completed the entitled. In partial fulfillment for the
award of
Diploma in Electronics & Communication Engg. Under
my
supervision during the academic year 2003-2004.
Guide
H.O.D
Internal Examiner
External Examiner.
ACKNOWLEDGEMENT
We render our profound and heart felt
gratitude to our principal Mrs. Premalatha
Kanikannan, B.E., M.B.A., Thiru Seven Hills
Polytechnic College, Chennai for the
encouragement and co-operation for accomplishing
our project entitled ELECTRONIC THERMOMETER
USING MICROCONTROLLER.
We thank our H.O.D. Mr.V.ELANGOVAN,
D.E.C.E., MISTE for allowing us to under take the
object.
We thank our Internal guide Mr.V.ELANGOVAN,
for his sustained guidelines and encouragement.
His constant enthusiasm showed us the path to
achieve this cherished goal.
We express our sincere thanks to
Mr.G.SARAVANAN who provided us with his
expertise.
We also reveal our sincere thanks to all faculty
members of E.C.E. Department whose suggestions
and teaching brought the comprehensive in us to
complete this project.
CONTENTS
INTRODUCTION
REGULATED POWER SUPPLY
OVERVIEW OF MICROCONTROLLER
PERIPHERAL INTERFACE
ADC 804
DISPLAY INTERFACE
TEMP. TRANSDUCER
FUNCTIONAL BLOCK DIAGRAM OF CIRCUIT
OPERATION OF ADC CIRCUITS
ADC PROGRAM
INTRODUCTION
Temperature is the most important variable in industrial
processing, primarily because it is the fundamental
condition characteristic of the thermal state of the body.
Consequently it is most important that the various ways of
measuring temperature be well mastered and the
advantages and disadvantages of each method we well
understood and the operating limitation in terms of time of
response, temperature range distance of operation and
compatibility with other control etc. should be considered
for each installation and measurement. There are two types
of measurement 1. Non-electrical method (e.g. Glass
thermometer) and 2. electrical method (e.g. Digital
thermometer, thermo couples and RTDs)
THERMO COUPLES
Thermocouple is a device that converts thermal energy
to electric voltage when there is a temperature difference
between the ends of a pair of dissimilar metals. One end of
the pair is fused together to form a hot junction, and the
other end called the cold junction is connected to the
measuring instrument. The open circuit voltage developed
is a function of the Seebeck coefficient for the two metals
and is proportional to the temperature difference. The
Seebeck effect refers to the set conversion of thermal
energy to voltage under zero current conditions. The
direction and magnitude of the voltage depends on the
metals making up the junction and the temperatures of the
junctions. As opposed to the Seebeck effect if a current is
passed through junctions made of two dissimilar metals,
heat is absorbed in one junction and liberated in the other.
MICRO CONTROLLER
A By product of microprocessor development was the
microcontroller. Microcomputers are also known as single
chip microcontrollers.
Nowadays the conventional pneumatic controllers are
replaced by electronic controllers built using high speed
microprocessors and personal computers.
Microcontroller / Microcomputers offer more
advantages than the conventional microprocessors for
performing dedicated jobs. These ICs are also cost effective
and could be used for any applications such as process
control equipments, dot matrix Printers, PLCs etc., For the
Present work, microcontroller 8051 is made use of. This has
timers and I/O ports needed for the work.
INTRODUCTION TO 8051:
The 8051 is one of the most popular microcontrollers
Register Banks
The 8051 uses 8 "R" registers which are used
in many of its instructions. These "R" registers are
numbered from 0 through 7 (R0, R1, R2, R3, R4, R5, R6, and
R7). These registers are generally used to assist in
manipulating values and moving data from one memory
Interrupts
An interrupt is a special feature which allows the
8051 to provide the illusion of "multitasking," although in
reality the 8051 is only doing one thing at a time. The word
"interrupt" can often be substituted with the word "event."
An interrupt is triggered whenever a corresponding event
occurs. When the event occurs, the 8051 temporarily puts
"on hold" the normal execution of the program and executes
a special section of code referred to as an interrupt handler.
The interrupt handler performs whatever special functions
are required to handle the event and then returns control to
the 8051 at which point program execution continues as if it
had never
been interrupted.
Interrupt Priorities
The 8051 offers two levels of interrupt priority:
high and low. By using interrupt priorities you may assign
higher priority to certain interrupt
conditions. For example, you may have enabled Timer 1
Interrupt which is automatically called every time Timer 1
overflows. Additionally, you
may have enabled the Serial Interrupt which is called every
time a character is received via the serial port. However, you
may consider that receiving a character is much more
important than the timer interrupt. In this case, if Timer 1
Interrupt is already executing you may wish that the serial
interrupt itself interrupts the Timer 1 Interrupt. When the
serial interrupt is complete, control passes back to Timer 1
Interrupt and finally back to the main program. You may
accomplish this by assigning a high priority to the Serial
Interrupt and a low priority to the Timer 1 Interrupt.
In order to understand--and better make use of-the 8051, it is necessary to understand some underlying
information concerning timing. The 8051 operates based on
an external crystal. This is an electrical device which, when
energy is applied, emits pulses at a fixed frequency. One can
find crystals of virtually any frequency depending on the
application
requirements. When using an 8051, the most common
crystal frequencies are 12 megahertz and 11.059
megahertz--with 11.059 being much more common. Why
would anyone pick such an odd-ball frequency? Theres a
real reason for it--it has to do with generating baud rates
and well talk more about it in the Serial Communication
chapter. For the remainder of this discussion well assume
that were using an 11.059 MHz crystal. Microcontrollers
(and many other electrical systems) use crystals to
synchronize operations. The 8051 uses the crystal for
precisely that: to synchronize its operation. Effectively, the
8051 operates using what are called "machine cycles." A
single machine cycle is the minimum amount of time in
which a single 8051 instruction can be executed. Although
many instructions take multiple cycles. A cycle is, in reality,
12 pulses of the crystal. That is to say, if an instruction takes
one machine cycle to execute, it will take 12 pulses of the
crystal to execute. Since we know the crystal is pulsing
11,059,000 times per second and that one machine cycle is
12 pulses, we can calculate how many instruction cycles the
8051 can execute per second: 11,059,000 / 12 = 921,583
This means that the 8051 can execute 921,583 single-cycle
instructions per second. Since a large number of 8051
instructions are single-cycle instructions it is often
considered that the 8051 can execute roughly 1 million
instructions per second, although in reality it is less--and,
depending on the instructions being used, an estimate of
about 600,000 instructions per second is more realistic. For
example, if you are using exclusively 2-cycle instructions
you would find that the 8051 would execute 460,791
instructions per second.
The 8051 also has two really slow instructions that
require a full 4 cycles to execute--if you were to execute
nothing but those instructions youd find performance to be
about 230,395 instructions per second. It is again important
to emphasize that not all instructions execute in the same
amount of time. The fastest instructions require one
machine cycle (12 crystal pulses), many others require two
machine cycles (24 crystal pulses), and the two very slow
math operations require four machine cycles (48 crystal
pulses).
Timers
MEMORY MAPPING
The 8051 memory register map is shown in the diagram. The
8051 internal 4K ROM and 128 byte RAM, including the special
function registers, are shown in the diagram. The 8051 can address
external memory if there is not enough internal RAM and /or ROM.
When used to address external memory, two ports provide the
memory addressing. The 8051 addresses two separate memory
spaces.
The 8051 uses one memory space for storing programs and the
other for storing variable data. The program memory space is a
read only space. One can read program instructions from this
space, but the processor cannot write data into or read data from
these memory locations. The 8051 internal ROM is in program
memory space. All instruction fetches are taken from the program
memory space.
The data memory space is read-write memory space. The
processor can read data from this memory space and can write data
to this memory space. It cannot execute program functions from
this memory space. The 8051 internal RAM is in this memory space.
The 128 bytes of internal RAM (memory locations 00H to 7 FH)
provide general read write data storage. Although we say the 8051
has 128 bytes of internal RAM. Part of this memory space is often
referred to as general-purpose registers.
It is important that the 8051 internal RAM is often referred to
as registers.
The 8051 also has 22 special function registers which are
not part of the 128 byes of internal RAM. The 8051 special
function registers occupy data memory space from 80H to F8H.
Although addressable as memory locations, these registers must be
used for their intended purpose.
If more program memory is needed, the 4-Kbyte, memory
can be expanded by an additional 60 K bytes giving the 8051 a full
64-K bytes program memory space. If the 8051 EA pin is asserted
(Connected to ground) the 8051 does not use the internal 4K ROM.
The external memory must start at memory location 0000H and can
be up to a full
64 K bytes.
If more RAM are needed add external data memory. AS shown
in the diagram full use of all 64 Kbytes of the external memory
address space also possible. This is, this memory is addressed
separately from the internal 128 bytes of RAM.
FEATURES OF 8255
The 8255 is a 40-pin DIP chip. It has three separately
accessible ports. The ports are each 8-bit, and are named A, B, and
C. The individual ports of the 8255 can be programmed to be input
or output, and can be changed dynamically. In addition, 8255 ports
have handshaking capability, thereby allowing interface with
devices that also have handshaking signals, such as printers.
PA0 PA7
The 8-bit port A can be programmed as all input, or as all
output, or all bits as bidirectional input/output.
PB0 PB7
PC0 PC7
This 8-bit port C can be all input or output. It can also be split
into two parts, CU (upper bits PC4 PC&) and CL (Lower bits PC0
PC3). Each can be used for input or output. In addition, any of bits
PC0 to PC7 can be programmed individually.
RD and WR
These two active-low control signals are inputs to the 8255.
The RD and WR signals from the 8031/51 are connected to these
inputs.
D0 D7 data pin
The data pins of the 8255 are connected to the data pins of the
microcontroller allowing it to send data back and forth between the
controller and the 8255 chip.
RESET
This is an active-high signal input into the 8255 used to clear
the control register. When RESET is activated, all ports are
initialized as input ports. In many designs this pin is connected to
the RESET output of the system bus or grounded to make it inactive.
Like all IC input pins, it should not be left unconnected.
CONTROL WORD
According to the requirement, a port can be programmed to
act either as an input port or an output port. For programming the
ports of 8255 a control word is formed. The bits of control word.
The word is written into the control word register which is within
8255. No read operation of the control word register is allowed.
4. BSR (bit set/reset) mode. In this mode, only the individual bits
of port C can be programmed. This mode is discussed further
in the third section of this chapter
EPROM
27C256
SRAM 62256
Storage cells is static RAM memory are made of flip-flops and
therefore do not require refreshing in order to keep their data. This
is in contrast to DRAM, discussed below. The problem with the use
of flip-flops for storage cells is that each cell requires at least 6
transistors to build, and the cell holds only 1 bit of data. In recent
years, the cells have been made of 4 transistors, which still is too
many. The use of 4-transistor cells plus the use of CMOS technology
has given birth to a high-capacity SRAM, but its capacity is far
below DRAM. WE are write enable, and OE is output enable, for read
and writes signals respectively.
SERIAL INTERFACE
MAX 232
DECODER 74138
The simplest method of decoding is the usage of NAND gate.
The 74138 is 3-8 decoder. The three inputs are A,B and C generates
8 active low output of Y0 to Y7. each y output is connected to cs of a
memory chip allowing control of 8 memory blocks by a single 74138
IC.
CS
Chip select is an active low input used to activate the ADC 804
chip. To access the ADC 804, this pin must be low.
RD (read)
This is an input signal and is active low. The ADC converts the
analog input to its binary equivalent and holds it in an internal
register. RD is used to get the converted data out of the ADC 804
chip. When
CS = 0, if a high-to-low pulse is applied to the RD pin, the 8-bit
digital output shows up at the D0 D7 data pins. The RD pin is also
referred to as output enable.
Typical values are R = 10K ohms and C = 150 pF. Substitution in the
above equation, we get f = 606 k Hz. In that case, the conversion
time is 110 s.
ADC
devices
PRODUCT DESCRIPTION
The AD590 is a two-terminal integrated circuit
temperature transducer that produces an output current
proportional to absolute temperature. For supply voltages
between +4 V and +30 V the device acts as a high
impedance, constant current regulator passing 1 mA/K.
Laser trimming of the chips thin-film resistors is used to
calibrate the device to 298.2 mA output at 298.2K (+25C).
PRODUCT HIGHLIGHTS
1. The AD590 is a calibrated two terminal
temperature sensor
requiring only a dc voltage supply (+4 V to +30 V). Costly
transmitters, filters, lead wire compensation and
linearization circuits are all unnecessary in applying the
device.
2. State-of-the-art laser trimming at the wafer
level in conjunction with extensive final testing ensures that
AD590 units are
easily interchangeable.
3. Superior interface rejection results from the
output being a
current rather than a voltage. In addition, power
requirements are low (1.5 mWs @ 5 V @ +25C.) These
features make the AD590 easy to apply as a remote sensor.
4. The high output impedance (>10 MW)
provides excellent
CIRCUIT DESCRIPTION
The AD590 uses a fundamental property of
the silicon transistors from which it is made to realize its
temperature proportional characteristic: if two identical
transistors are operated at a constant ratio of collector
current densities, r, then the difference in their base-emitter
voltage will be (kT/q)(In r). Since both k, Boltzmans
constant and q, the charge of an electron, are constant, the
resulting voltage is directly proportional to absolute
temperature (PTAT).
CALIBRATION ERROR
At final factory test the difference
between the indicated
temperature and the actual temperature is called the
calibration error. Since this is a scale factory error, its
contribution to the total error of the device is PTAT. For
example, the effect of the 1C specified maximum error of
the AD590L varies from 0.73C at 55C to 1.42C at 150C.
NONLINEARITY
Nonlinearity as it applies to the AD590 is the
maximum deviation of current over temperature from a
best-fit straight line. The nonlinearity of the AD590 over the
55C to +150C range is superior to all conventional
electrical temperature sensors such as thermocouples. RTDs
and thermistors. Figure 6 shows the nonlinearity of the
typical AD590K from Figure 6.
- 6063H
- 6060H
- 6061H
-6062H
ADC PROGRAM
; port A receives digital o/p from adc
; port B for r/w
;"ADC AND DAC PROGRAM"
;port A receives digital o/p from adc
;port c for r/w
9000
main:
9000 906063
mov
dptr,#6063
9003 7490
mov
a,#90h;define port A as
i/p,remaining as o/p
9005 F0
movx
@dptr,a
9006 906062
mov
dptr,#6062
9009 74FF
mov
a,#ffh
900B F0
movx
@dptr,a
900C 906062
mov
dptr,#6062
900F 7400
mov
a,#0h
9011 F0
movx
@dptr,a
9012 906062
mov
dptr,#6062
9015 74FF
mov
a,#ffh
9017 F0
movx
@dptr,a
9018 129022
lcall
delay
901B 906060
mov
dptr,#6060
901E E0
movx
lcall
00bbh
;start of
conversion
values
901F 120BBB
;end of conversion
;port A
;DELAY SUBROUTINE
9022
delay:
9022 79FF
9024
mov
Loop:
9024 00
nop
9025 00
nop
9026 00
nop
9027 00
nop
9028 00
nop
9029 00
nop
902A 00
nop
902B D9F7
djnz
902D 22
ret
;Note
r1,#ffh
r1,loop
;initlcd:
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
INITLCD:
LXI D,0EA6H
CALL DELAY
;for 15msec
MVI A,38H
OUT LCDCMD
LXI D,0401H
CALL DELAY
;functionset
MVI A,38H
OUT LCDCMD
LXI D,0019H
CALL DELAY
;functionset
MVI A,38H
OUT LCDCMD
LXI D,0014H
CALL DELAY
(useless)
;for 4.1msec
(useless)
;for 100usec
MVI A,0fH
OUT LCDCMD
LXI D,0014H
CALL DELAY
MVI A,06H
OUT LCDCMD
LXI D,0014H
CALL DELAY
MVI A,01H
OUT LCDCMD
LXI D,019AH
CALL DELAY
LXI D,000AH
CALL DELAY
;for 40usec
;for 1.64msec
RET
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;DELAY FUNCTION
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;250 msec for count FFFF
DELAY:
DCX D
;total no. of T
states=24*(count-1)+31
MOV A,E
ORA D
JNZ DELAY
RET
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;PUTCHAR:
;
I/P:A-HAVE THE ASCII VALUE
;
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
PUTCHAR:
PUSH H
PUSH D
PUSH B
MOV D,A
LDA FLGSERIAL
CPI 01H
JNZ LOCALD
MOV A,D
CALL TRACHA
monitor
JMP RET10
LOCALD:
MOV A,D
OUT LCDDIS
LXI D,000AH
;for 40usec
CALL DELAY
RET10:
POP B
POP D
POP H
RET
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;DISPLAY ADDRESS ---in first line (like 8100: )
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DISADR:
LDA ADRBUF
CALL PUTBYTE
LDA ADRBUF+1H
CALL PUTBYTE
MVI A,3AH
after the addr
CALL PUTCHAR
MVI A," "
CALL PUTCHAR
RET
;***********************************************
;ASCII
;***********************************************
ASCII1:
ANI 0FH
CPI 0AH
JC ADD
ADI 07H
ADD:
ADI 30H
RET
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;DISPLAY OUTPUT BUFFER ----after disassemble
;
It displays addr,opcodes in first line and
;
mnemonics in second line.
;
line 1: xxxx: xx xx xx
;
line 2: lxi h,5050(mnemonics)
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DISOPB:
MVI A,06H
CALL GOTOXY
LXI H,OPBUF
MVI C,03H
MOV A,M
CNDIS:
first line
CALL PUTCHAR
INX H
MOV A,M
CALL PUTCHAR
INX H
MVI A,20H
CALL PUTCHAR
;SPACE CHARACTER
DCR C
JNZ CNDIS
LDA FLGSERIAL
CPI 01H
JZ GIVESPACE
MVI A,40H
CALL GOTOXY
JMP CNDIS1
GIVESPACE:MVI A," "
CALL PUTCHAR
CALL PUTCHAR
CNDIS1:
MOV A,M
CPI 00H
RZ
CALL PUTCHAR
INX H
JMP CNDIS1
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
CUROFF: MVI A,0CH
;{0 0 0 0 1 D C B}=00001100
OUT LCDCMD
LXI D,0014H
;for 40usec + 40us
CALL DELAY
RET
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
CURON: MVI A,0FH
;{0 0 0 0 1 D C B}=00001111
OUT LCDCMD
LXI D,0014H
;for 40usec + 40us
CALL DELAY
RET
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
LCDOFF: MVI A,08H
;{0 0 0 0 1 D C B}=00001000
OUT LCDCMD
LXI D,0014H
;for 40usec + 40us
CALL DELAY
RET
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;GOTOXY FUNCTION
;
MOVES LCD CURSOR POSITION
;I/P:
A-DDRAM ADDR
00H-27H for 1st line
;
40h-67h for 2nd line
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
GOTOXY:
MOV
LDA
CPI
JNZ
D,A
FLGSERIAL
01H
LGOTO
MOV A,D
CPI 40H
JC ENDGOTO
MVI A,0AH
CALL PUTCHAR
JMP ENDGOTO
LGOTO:
ENDGOTO:
MOV A,D
ORI 80H
OUT LCDCMD
LXI D,000AH
CALL DELAY
RET
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;CLRSCR FUNCTION
;
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
CLRSCR:
LDA FLGSERIAL
CPI 01H
JNZ LCDCLR
MVI A,0AH
CALL PUTCHAR
RET
LCDCLR:
MVI A,01H
OUT LCDCMD
LXI D,01BAH
delay (01BAH)
CALL DELAY
RET
BIBLIOGRAPHY
WEBSITES
1. http://www.atmel.com
2. http://www.google.com
3. http://www.8052.com
BOOKS
1. THE 8051 MICROCONTROLLER AND EMBEDDED
SYSTEMS (Muhammad Ali Mazidi )
2. MICROPROCESSOR AND ITS APPLICATIONS
(S.Rajasekar,D.Madhavan)
3. MICROPROCESSOR BASED TEMPERATURE
INDICATOR
(C.Rameshu, A.P.Sivaprasad)
4. INDUSTRIAL INSTRUMENTATION
(C.Dhanasekaran)
CONCLUSION
AN OVERVIEW
Temperature measurement system
using microprocessor/microcontroller has been
described in this report. The system consists of a
combination of hardware and software. The system
has relatively fast response and high accuracy. The
overall system is also quite simple to implement
and relatively cheap.
APPLICATION
This method has got a wide variety of
industrial, domestic, powerplant, school and
colleges and research institutes application. This
system plays a major role in deciding the quality of
petro-chemical industry product e.g.oil, fertilizer,
and de-salination and space research. This
controller can accept a variety of inputs to measure
different variables such as temperature transducer,
strain gauges, load cells, flow, pressure, level,
speed, time, by way of suitable interfacing and
Programming.
We have experienced very many
difficulties in carrying out the project which was
overcome by suggestions and guidance given by
our parents, friends and well-wishers. We have
gained more knowledge about the sections involved
in our project. We feel very happy and proud to
completed this project. We thank one and all who
helped for the successful completion of the course.