;-------------------------------------------------------------------------------------------------; ; Design By : Mahdi Maherani ; ; & Mohammad Reza Khazaei ; ; 30 Apr 2007 ; ;------------------------------------------------------------------------------------------------; #include ORG 30H ADC EQU 90H ; PORT P1 LCD EQU 0AOH ; PORT P2 ENTER EQU 86H ; BIT P0.6 OF PORT 0 RW EQU 85H ; BIT P0.5 RS EQU 84H ; BIT P0.4 E EQU 83H ; BIT P0.3 RD EQU 82H ; BIT P0.2 WR EQU 81H ; BIT P0.1 INT EQU 80H ; BIT P0.6 POWER EQU 87H ; BIT P0.7 ;...........................; ; DISPLAY AUTOR ; ;...........................; MOV A,#38H ; LCD 2 LINE ACALL COMN ACALL DELAY1 MOV A,#0OEH ;LCD ON , CURSOR ON ACALL COMN ACALL DELAY1 MOV A,#01H ; CLEAR LCD ACALL COMN ACALL DELAY1 MOV A,#06H ; ACALL COMN ACALL DELAY1 MOV A,#86H ACALL COMN ACALL DELAY1 MOV A,#'D' ACALL DISPLAY ACALL DELAY1 MOV A,#'E' ACALL DISPLAY ACALL DELAY1 MOV A,#'S' ACALL DISPLAY ACALL DELAY1 MOV A,#'I' ACALL DISPLAY ACALL DELAY1 MOV A,#'G' ACALL DISPLAY ACALL DELAY1 MOV A,#'N' ACALL DISPLAY ACALL DELAY1 MOV A,#20H ; SPACE ACALL DISPLAY ACALL DELAY1 MOV A,#58 ; : ACALL DISPLAY ACALL DELAY1 MOV A,#0C0H ; NEXT LINE ACALL COMN ACALL DELAY1 MOV A,#'M' ACALL DISPLAY ACALL DELAY1 MOV A,#'A' ACALL DISPLAY ACALL DELAY1 MOV A,#'H' ACALL DISPLAY ACALL DELAY1 MOV A,#'E' ACALL DISPLAY ACALL DELAY1 MOV A,#'R' ACALL DISPLAY ACALL DELAY1 MOV A,#'A' ACALL DISPLAY ACALL DELAY1 MOV A,#'N' ACALL DISPLAY ACALL DELAY1 MOV A,#'I' ACALL DISPLAY ACALL DELAY1 MOV A,#'&' ACALL DISPLAY ACALL DELAY1 MOV A,#'K' ACALL DISPLAY ACALL DELAY1 MOV A,#'D' ACALL DISPLAY ACALL DELAY1 MOV A,#'H' ACALL DISPLAY ACALL DELAY1 MOV A,#'A' ACALL DISPLAY ACALL DELAY1 MOV A,#'Z' ACALL DISPLAY ACALL DELAY1 MOV A,#'A' ACALL DISPLAY ACALL DELAY1 MOV A,#'E' ACALL DISPLAY ACALL DELAY1 MOV A,#'I' ACALL DISPLAY ACALL DELAY1 ACALL DELAY3 ; 3 SEC ;---------------------------------; ; DISPLAY PERESS ENTER PLZ ; ;---------------------------------; MOV A,01H ; CLEAR LCD SETB ENTER ; INPUT PIN P0.6 MOV A,#0EH ; LCD,CURSOR ON ACALL COMN ACALL DELAY1 MOV A,#'E' ACALL DISPLAY ACALL DELAY1 MOV A,#'N' ACALL DISPLAY ACALL DELAY1 MOV A,#'T' ACALL DISPLAY ACALL DELAY1 MOV A,#'E' ACALL DISPLAY ACALL DELAY1 MOV A,#'R' ACALL DISPLAY ACALL DELAY1 MOV A,#20H ACALL DISPLAY ACALL DELAY1 MOV A,#'P' ACALL DISPLAY ACALL DELAY1 MOV A,#'L' ACALL DISPLAY ACALL DELAY1 MOV A,#'Z' ACALL DISPLAY ACALL DELAY1 ; ;-----------------------------------; ; MAIN ; ;-----------------------------------; ; AGAIN: JB ENTER,AGAIN ; WAIT FOR START CLR WR SETB WR ; L-H START A2D HER2: JB INT,HER2 ; WAIT FOR END A2D SETB RD CLR RD ; H-L MOV A,#0FFH MOV ADC,A ; INPUT ADC MOV A,ADC ; DATA ACALL CONV2ASCII ACALL DISPLAY_TEMP JNB POWER,EXIT SJMP AGAIN ; ;----------------------------------- ; COMN : ACALL READY CLR RS CLR RW SETB E CLR E MOV LCD,A RET ;------------------------------------ ; READY : SETB RW CLR RS HER3: JB 0A7H,HER3 ; P2.0 RET ;------------------------------------ ; DISPLAY : ACALL READY SETB RS CLR RW SETB E CLR E ; H-L MOV LCD,A RET ;------------------------------------ ; DELAY1 : MOV R5,#50 BACK: MOV R6,#0FFH HER4: DJNZ R6,HER4 DJNZ R5,BACK RET ;------------------------------------- ; DELAY3 : MOV 89H,#10H ; MOV TO TMOD MOV R4,#60 BACK2: MOV 8BH,#4BH ; MOV TO TL MOV 8DH,#0FD ; MOV TO TH SETB 8EH ; SETB TRI HER5: JNB 8FH,HER5 ; CHEK TF1 CLR 8EH CLR 8FH DJNZ R4,BACK2 RET ;-------------------------------------- ; CONV2ASCII : MOV OFOH,#10 ; MOV TO B DIV AB MOV R1,0F0H MOV 0FOH,#0AH ; MOV TO B DIV AB RET ;-------------------------------------- ; DISPLAY_TEMP : PUSH 0E0H MOV A,#01H ; CLEAR LCD ACALL COMN ACALL DELAY1 MOV A,#0EH ACALL COMN ACALL DELAY1 MOV R7,#8 BACK3: MOV A,#14 ACALL COMN ACALL DELAY1 DJNZ R7,BACK3 MOV A,R1 ACALL DISPLAY ACALL DELAY1 MOV A,#10H ACALL COMN ACALL DELAY1 MOV A,0F0H ACALL DISPLAY ACALL DELAY1 MOV A,#10H ACALL COMN ACALL DELAY1 POP OEOH JZ NEX ACALL DISPLAY ACALL DELAY1 NEX: RET ;---------------------------------- EXIT: END