Well Well,
So the experience of making Micromouse with Awesome and have had good hands on experience on Microcontrollers.....
So thought of making a simple application using 8051 microcontroller.
A simple Digital Thermometer and Controller.
Here it goes:
1) Use LM35 for sensing tmperature.
2) Add LM324 based signal conditioning to multiplu output of LM35 (10mV/degree Centigrade) with 1.96 to match with resolution of ADC.
3) Use ADC0809 to convert analog value to digital one.
4) Use AT89C51
5) Display temperature on 16x2 LCD
6) Use 5V relay to control Heater
7) Use ULN2003 for driving relay.
Here is circuit diagram designed in ISIS Proteus Simulator:
Created PCB in Express PCB:
Get the PCB manufactured. Solder all components and write a bit of Code:
Here it goes:
EN EQU P0.7
RS EQU P0.5
RW EQU P0.6
ADCA EQU P0.2
ADCB EQU P0.1
ADD_C EQU P0.0
TEMP EQU 08H
COUNT1 EQU 09H
COUNT2 EQU 0AH
COUNT3 EQU 0BH
SET_POINT EQU 0CH
ADC_VALUE EQU 0DH
LCD_DATA EQU P2
ORG 0000H
JMP INITIALISE
ORG 0013H
LCALL INT11
RETI
ORG 0003H
LCALL INT00
RETI
ORG 0100H
INITIALISE:
MOV SP,#30H
SETB TCON.2
SETB TCON.0
MOV IE,#10000101B
LCALL DISPLAY_WELCOME
LCALL DELAY_1
JMP MAIN
MAIN:
LCALL READ_ADC
MOV TEMP,A
INC TEMP
MOV COUNT1,#30H
MOV COUNT2,#30H
MOV COUNT3,#30H
LCALL CONVERT
LCALL LCD_DISPLAY
LCALL COMPARE
LCALL DELAY_1
JMP MAIN
DELAY_1:
MOV R4,#0AH
AAAA2:MOV R3,#0FFH
AAAA1:MOV R2,#0FFH
AAAA:DJNZ R2,AAAA
DJNZ R3,AAAA1
DJNZ R4,AAAA2
RET
COMPARE:
MOV A,SET_POINT
SUBB A,ADC_VALUE
JC NO_CHANGE
CLR P0.3
SETB P0.4
RET
NO_CHANGE:
SETB P0.3
CLR P0.4
RET
READ_ADC:
MOV A,#0FFH
MOV P1,A ;TO MAKE P1 AS AN INPUT PORT FOR ADC DATA
SETB ADCA
SETB ADCB
CLR ADD_C
SETB P3.5 ;SET ALE HIGH
LCALL DELAY_ALE
SETB P3.0 ; SET SOC
LCALL DELAY_START
CLR P3.5
CLR P3.0
SETB P3.1
HERE1: JNB P3.1,HERE1 ;CHECKING EOC
SETB P3.4 ;SET OE
LCALL DELAY_OE
MOV A,P1
MOV ADC_VALUE, A
CLR P3.4 ;OE RESET
RET
DELAY_ALE:
DELAY_START:
DELAY_OE:
NOP
NOP
RET
DISPLAY_WELCOME:
MOV A,#38H
LCALL COMMAND
MOV A,#0EH
LCALL COMMAND
MOV A,#01H
LCALL COMMAND
MOV A,#06H
LCALL COMMAND
MOV A,#80H
LCALL COMMAND
MOV A,#"W"
LCALL DISPLAY
MOV A,#"E"
LCALL DISPLAY
MOV A,#"L"
LCALL DISPLAY
MOV A,#"C"
LCALL DISPLAY
MOV A,#"O"
LCALL DISPLAY
MOV A,#"M"
LCALL DISPLAY
MOV A,#"E"
LCALL DISPLAY
RET
LCD_DISPLAY:
MOV A,#38H
LCALL COMMAND
MOV A,#0EH
LCALL COMMAND
MOV A,#01H
LCALL COMMAND
MOV A,#06H
LCALL COMMAND
MOV A,#80H
LCALL COMMAND
MOV A,#"T"
LCALL DISPLAY
MOV A,#":"
LCALL DISPLAY
MOV A,COUNT3
LCALL DISPLAY
MOV A,COUNT2
LCALL DISPLAY
MOV A,COUNT1
LCALL DISPLAY
MOV A,#' '
LCALL DISPLAY
MOV A,#'S'
LCALL DISPLAY
MOV A,#'P'
LCALL DISPLAY
MOV A,#':'
LCALL DISPLAY
MOV TEMP,SET_POINT
MOV COUNT3,#30H
MOV COUNT2,#30H
MOV COUNT1,#30H
LCALL CONVERT
MOV A,COUNT3
LCALL DISPLAY
MOV A,COUNT2
LCALL DISPLAY
MOV A,COUNT1
LCALL DISPLAY
RET
COMMAND:
MOV LCD_DATA,A
CLR RS
CLR RW
SETB EN
CLR EN
LCALL DELAY
RET
DISPLAY:
MOV LCD_DATA,A
SETB RS
CLR RW
SETB EN
CLR EN
LCALL DELAY
RET
CONVERT:
DJNZ TEMP,ENDX
RET
ENDX:
MOV A,COUNT1
INC A
CJNE A,#3AH,MMM
MOV A,#30H
MOV COUNT1,A
MOV A,COUNT2
INC A
CJNE A,#3AH,MMM2
MOV A,#30H
MOV COUNT2,A
MOV A,COUNT3
INC A
CJNE A,#3AH,MMM3
MOV A,#30H
MOV COUNT3,A
MMM3:
MOV COUNT3,A
JMP END_INT0
MMM2:
MOV COUNT2,A
JMP END_INT0
MMM:
MOV COUNT1,A
END_INT0:
JMP CONVERT
RET
DELAY:
MOV R3,#07H
FRFR2:MOV R4,#09FH
FRFR:DJNZ R4,FRFR
DJNZ R3,FRFR2
RET
INT11:
INC SET_POINT
RET
INT00:
DEC SET_POINT
RET
END
So the experience of making Micromouse with Awesome and have had good hands on experience on Microcontrollers.....
So thought of making a simple application using 8051 microcontroller.
A simple Digital Thermometer and Controller.
Here it goes:
1) Use LM35 for sensing tmperature.
2) Add LM324 based signal conditioning to multiplu output of LM35 (10mV/degree Centigrade) with 1.96 to match with resolution of ADC.
3) Use ADC0809 to convert analog value to digital one.
4) Use AT89C51
5) Display temperature on 16x2 LCD
6) Use 5V relay to control Heater
7) Use ULN2003 for driving relay.
Here is circuit diagram designed in ISIS Proteus Simulator:
Created PCB in Express PCB:
Get the PCB manufactured. Solder all components and write a bit of Code:
Here it goes:
EN EQU P0.7
RS EQU P0.5
RW EQU P0.6
ADCA EQU P0.2
ADCB EQU P0.1
ADD_C EQU P0.0
TEMP EQU 08H
COUNT1 EQU 09H
COUNT2 EQU 0AH
COUNT3 EQU 0BH
SET_POINT EQU 0CH
ADC_VALUE EQU 0DH
LCD_DATA EQU P2
ORG 0000H
JMP INITIALISE
ORG 0013H
LCALL INT11
RETI
ORG 0003H
LCALL INT00
RETI
ORG 0100H
INITIALISE:
MOV SP,#30H
SETB TCON.2
SETB TCON.0
MOV IE,#10000101B
LCALL DISPLAY_WELCOME
LCALL DELAY_1
JMP MAIN
MAIN:
LCALL READ_ADC
MOV TEMP,A
INC TEMP
MOV COUNT1,#30H
MOV COUNT2,#30H
MOV COUNT3,#30H
LCALL CONVERT
LCALL LCD_DISPLAY
LCALL COMPARE
LCALL DELAY_1
JMP MAIN
DELAY_1:
MOV R4,#0AH
AAAA2:MOV R3,#0FFH
AAAA1:MOV R2,#0FFH
AAAA:DJNZ R2,AAAA
DJNZ R3,AAAA1
DJNZ R4,AAAA2
RET
COMPARE:
MOV A,SET_POINT
SUBB A,ADC_VALUE
JC NO_CHANGE
CLR P0.3
SETB P0.4
RET
NO_CHANGE:
SETB P0.3
CLR P0.4
RET
READ_ADC:
MOV A,#0FFH
MOV P1,A ;TO MAKE P1 AS AN INPUT PORT FOR ADC DATA
SETB ADCA
SETB ADCB
CLR ADD_C
SETB P3.5 ;SET ALE HIGH
LCALL DELAY_ALE
SETB P3.0 ; SET SOC
LCALL DELAY_START
CLR P3.5
CLR P3.0
SETB P3.1
HERE1: JNB P3.1,HERE1 ;CHECKING EOC
SETB P3.4 ;SET OE
LCALL DELAY_OE
MOV A,P1
MOV ADC_VALUE, A
CLR P3.4 ;OE RESET
RET
DELAY_ALE:
DELAY_START:
DELAY_OE:
NOP
NOP
RET
DISPLAY_WELCOME:
MOV A,#38H
LCALL COMMAND
MOV A,#0EH
LCALL COMMAND
MOV A,#01H
LCALL COMMAND
MOV A,#06H
LCALL COMMAND
MOV A,#80H
LCALL COMMAND
MOV A,#"W"
LCALL DISPLAY
MOV A,#"E"
LCALL DISPLAY
MOV A,#"L"
LCALL DISPLAY
MOV A,#"C"
LCALL DISPLAY
MOV A,#"O"
LCALL DISPLAY
MOV A,#"M"
LCALL DISPLAY
MOV A,#"E"
LCALL DISPLAY
RET
LCD_DISPLAY:
MOV A,#38H
LCALL COMMAND
MOV A,#0EH
LCALL COMMAND
MOV A,#01H
LCALL COMMAND
MOV A,#06H
LCALL COMMAND
MOV A,#80H
LCALL COMMAND
MOV A,#"T"
LCALL DISPLAY
MOV A,#":"
LCALL DISPLAY
MOV A,COUNT3
LCALL DISPLAY
MOV A,COUNT2
LCALL DISPLAY
MOV A,COUNT1
LCALL DISPLAY
MOV A,#' '
LCALL DISPLAY
MOV A,#'S'
LCALL DISPLAY
MOV A,#'P'
LCALL DISPLAY
MOV A,#':'
LCALL DISPLAY
MOV TEMP,SET_POINT
MOV COUNT3,#30H
MOV COUNT2,#30H
MOV COUNT1,#30H
LCALL CONVERT
MOV A,COUNT3
LCALL DISPLAY
MOV A,COUNT2
LCALL DISPLAY
MOV A,COUNT1
LCALL DISPLAY
RET
COMMAND:
MOV LCD_DATA,A
CLR RS
CLR RW
SETB EN
CLR EN
LCALL DELAY
RET
DISPLAY:
MOV LCD_DATA,A
SETB RS
CLR RW
SETB EN
CLR EN
LCALL DELAY
RET
CONVERT:
DJNZ TEMP,ENDX
RET
ENDX:
MOV A,COUNT1
INC A
CJNE A,#3AH,MMM
MOV A,#30H
MOV COUNT1,A
MOV A,COUNT2
INC A
CJNE A,#3AH,MMM2
MOV A,#30H
MOV COUNT2,A
MOV A,COUNT3
INC A
CJNE A,#3AH,MMM3
MOV A,#30H
MOV COUNT3,A
MMM3:
MOV COUNT3,A
JMP END_INT0
MMM2:
MOV COUNT2,A
JMP END_INT0
MMM:
MOV COUNT1,A
END_INT0:
JMP CONVERT
RET
DELAY:
MOV R3,#07H
FRFR2:MOV R4,#09FH
FRFR:DJNZ R4,FRFR
DJNZ R3,FRFR2
RET
INT11:
INC SET_POINT
RET
INT00:
DEC SET_POINT
RET
END
And yeah..... It works :-)