pandeeey
Newbie level 3
hello everyone.
i am doing project on temperature control and monitoring system .i have completed temperature monitoring syestem now i need to to work on the controlling system.I have used two line LCD one for displaying the measured temperature and other for displaying the desired temperature taken from input.
i have written program for using keypad for control but i think this makes the system more complex .instead of 4*3 keypad can i use a a increment and decrement key followed by enter key?can anyone plz help me with the coding ,i am running out of time,i need to complete the project within a week...plz post ur reply asap
codes for the temperature monitoring system are:
INCLUDE 8051.mc
;EN EQU P3.0
;RS EQU P3.1
;RW EQU P3.2
MOV P0, #0FFH ;initialize port 0
MOV P3, #0FFH ;initialize port 3
MOV P1, #0FFH ;initialize port 1
org 0000H
MOV R1, #0 ; Counters for LCD
MOV R2, #0
MOV R3, #0
MOV R4, #0
MOV R5, #0
MOV R6, #0
MOV R7, #0
mov A,#38H ; Setting Up the LCD
lcall command
mov A,#0EH ; Display On
lcall command
mov A,#06H ; Entry Mode
lcall command
SETB P3.7 ; INTR
BACK: CLR P3.6 ; WR
SETB P3.6 ; WR
ACALL INTLOOP
CLR P3.5 ;RD
MOV A, P0
ACALL CONVERSION
ACALL DATADISPLAY
ACALL DELAYADC
SETB P3.5
SJMP BACK
CONVERSION:
ACALL BINTODEC
ACALL DECTOASC
BINTODEC:
MOV A,P0
MOV B,#10
DIV AB
MOV R7,B
MOV R6,A
RET
DECTOASC:
MOV R0,#2
A1:MOV A,R6
ORL A,#30H
MOV R4,A
MOV A,R7
ORL A,#30H
MOV R5,A
DJNZ R0,A1
RET
RET
DATADISPLAY:
mov a,#82H
lcall command
mov a,#02H ; Setting DDRAM Address to Home position
lcall command
lcall delay1
; Displays temperature measured ON FIRST LINE OF LCD
mov a,#84
lcall datw
NOP
mov a,#69
lcall datw
NOP
mov a,#77
lcall datw
mov a,#80
lcall datw
NOP
mov a,#58
lcall datw
NOP
mov A,R4
lcall datw
NOP
mov A,R5
lcall datw
NOP
mov a,#254
lcall datw
NOP
mov a,#67
lcall datw
NOP
MOV A,#255 ; Moving Value 255 to PORT 1
MOV P1,A
RET
INTLOOP:
CLR P3.7 ;INTR RESET
RET
DELAYADC:
TTO:MOV R0,#76
MOV R1,#75
MOV R2,#164
TT1JNZ R2,TT1
DJNZ R1,TT1
DJNZ R0,TT1
RET
; Function to Send Commands to LCD
command:
clr P3.2
clr P3.1
setB P3.0
MOV P1,A
lcall delay
clr P3.0
RET
; Function to Display Data on LCD Screen
datw:
SETB P3.1
clr P3.2
SETB P3.0
MOV P1,A
lcall delay
clr P3.0
RET
; Generating Small Delay
delay:
mov r0,#255
loop: DJNZ r0,loop;
RET
; Generating a Bigger Delay
delay1:
mov r1,#255
loop1: mov r3,#120
loop2: djnz r3,loop2
djnz r1,loop1
RET
END
i am doing project on temperature control and monitoring system .i have completed temperature monitoring syestem now i need to to work on the controlling system.I have used two line LCD one for displaying the measured temperature and other for displaying the desired temperature taken from input.
i have written program for using keypad for control but i think this makes the system more complex .instead of 4*3 keypad can i use a a increment and decrement key followed by enter key?can anyone plz help me with the coding ,i am running out of time,i need to complete the project within a week...plz post ur reply asap
codes for the temperature monitoring system are:
INCLUDE 8051.mc
;EN EQU P3.0
;RS EQU P3.1
;RW EQU P3.2
MOV P0, #0FFH ;initialize port 0
MOV P3, #0FFH ;initialize port 3
MOV P1, #0FFH ;initialize port 1
org 0000H
MOV R1, #0 ; Counters for LCD
MOV R2, #0
MOV R3, #0
MOV R4, #0
MOV R5, #0
MOV R6, #0
MOV R7, #0
mov A,#38H ; Setting Up the LCD
lcall command
mov A,#0EH ; Display On
lcall command
mov A,#06H ; Entry Mode
lcall command
SETB P3.7 ; INTR
BACK: CLR P3.6 ; WR
SETB P3.6 ; WR
ACALL INTLOOP
CLR P3.5 ;RD
MOV A, P0
ACALL CONVERSION
ACALL DATADISPLAY
ACALL DELAYADC
SETB P3.5
SJMP BACK
CONVERSION:
ACALL BINTODEC
ACALL DECTOASC
BINTODEC:
MOV A,P0
MOV B,#10
DIV AB
MOV R7,B
MOV R6,A
RET
DECTOASC:
MOV R0,#2
A1:MOV A,R6
ORL A,#30H
MOV R4,A
MOV A,R7
ORL A,#30H
MOV R5,A
DJNZ R0,A1
RET
RET
DATADISPLAY:
mov a,#82H
lcall command
mov a,#02H ; Setting DDRAM Address to Home position
lcall command
lcall delay1
; Displays temperature measured ON FIRST LINE OF LCD
mov a,#84
lcall datw
NOP
mov a,#69
lcall datw
NOP
mov a,#77
lcall datw
mov a,#80
lcall datw
NOP
mov a,#58
lcall datw
NOP
mov A,R4
lcall datw
NOP
mov A,R5
lcall datw
NOP
mov a,#254
lcall datw
NOP
mov a,#67
lcall datw
NOP
MOV A,#255 ; Moving Value 255 to PORT 1
MOV P1,A
RET
INTLOOP:
CLR P3.7 ;INTR RESET
RET
DELAYADC:
TTO:MOV R0,#76
MOV R1,#75
MOV R2,#164
TT1JNZ R2,TT1
DJNZ R1,TT1
DJNZ R0,TT1
RET
; Function to Send Commands to LCD
command:
clr P3.2
clr P3.1
setB P3.0
MOV P1,A
lcall delay
clr P3.0
RET
; Function to Display Data on LCD Screen
datw:
SETB P3.1
clr P3.2
SETB P3.0
MOV P1,A
lcall delay
clr P3.0
RET
; Generating Small Delay
delay:
mov r0,#255
loop: DJNZ r0,loop;
RET
; Generating a Bigger Delay
delay1:
mov r1,#255
loop1: mov r3,#120
loop2: djnz r3,loop2
djnz r1,loop1
RET
END