Archive for July 2013
temperature sensor program
A digital temperature sensor
Temperature detector:
ORG 0000H
ADC_RD EQU P2.0
ADC_WR EQU P2.1
ADC_INTR EQU P2.2
MYDATA EQU P0
RAM_ADDR EQU 30H
ASCI_RSULT EQU 50H
MOV P0,#0FFH
MOV P1,#00H
MOV P3,#00H
ACALL LCD_INIT
SETB ADC_INTR
ACALL WRITE
BACK: CLR ADC_WR
SETB ADC_WR
HERE: JB ADC_INTR,HERE
CLR ADC_RD
MOV A,MYDATA
SETB ADC_RD
MOV A,MYDATA
MOV P1,A
ACALL CONVERSION
ACALL DELAY
SJMP BACK
DELAY: MOV R1,#05H
A1: MOV R2,#55H
A2: DJNZ R2,A2
DJNZ R1,A1
RET
LCD_INIT: MOV A,#38H
ACALL COMMAND
ACALL DELAY
MOV A,#0CH
ACALL COMMAND
ACALL DELAY
MOV A,#01H
ACALL COMMAND
ACALL DELAY
MOV A,#06H
ACALL COMMAND
ACALL DELAY
MOV A,#80H
ACALL COMMAND
ACALL DELAY
RET
WRITE:
MOV A,#'T'
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,#'E'
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,#'M'
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,#'P'
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,#':'
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,#88h
ACALL COMMAND
ACALL DELAY
MOV A,#0DFH
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,#89h
ACALL COMMAND
ACALL DELAY
MOV A,#'C'
ACALL DATA_DISPLAY
ACALL DELAY
RET
COMMAND:ACALL READY
MOV P1,A
CLR P2.3
CLR P2.4
SETB P2.5
NOP
NOP
NOP
CLR P2.5
RET
DATA_DISPLAY:ACALL READY
MOV P1,A
SETB P2.3
CLR P2.4
SETB P2.5
NOP
NOP
NOP
CLR P2.5
RET
READY: SETB P1.7
CLR P2.3
SETB P2.4
BACK1: CLR P2.5
ACALL DELAY
SETB P2.5
JB P1.7,BACK1
RET
CONVERSION:
mov r0,#RAM_ADDR
mov a,p1
mov b,#10
div ab
mov @r0,b
inc r0
mov b,#10
div ab
mov @r0,b
inc r0
mov @r0,a
MOV R0,#RAM_ADDR
MOV R1,#ASCI_RSULT
MOV R2,#3
BACKk: MOV A,@R0
ORL A,#30H
MOV @R1,A
INC R0
INC R1
DJNZ R2,BACKk
MOV A,#85H
ACALL COMMAND
ACALL DELAY
MOV A,52H
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,51H
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,50H
ACALL DATA_DISPLAY
ACALL DELAY
RET
END
CLICK HERE TO SEE CIRCUIT DIAGRAM
how do we measure temperature with resistance temperature detector
It is a nice project and easy to implement. Microcontroller 8051 is the most important part of this project. I have implemented this circuit on proteus software for virtual simulation and also completed hardware. I have used a temperature sensor LM325 to detect the temperature. Temperature sensor detects the temperature and gives output in analog form. As we know that microcontroller cannot process analog data so that we have to convert it in suitable digital form to process it and display it on LCD.
A TO D CONVERSION: To convert the analog output given by LM325 i have used an A2D converter ADC 0808. ADC 0808 converts the analog input into suitable digital output of 8 bit so that it can be processed easily by the microcontroller.
Operation: As we know that LCD cannot display the hex value. We need to convert it into ASCII equivalent to display on LCD.
CLICK HERE TO SEE PROGRAM FOR TEMPERATURE DETECTOR