Microcontroller › 8051 › alarm clock on LCD project!!
- This topic has 0 replies, 1 voice, and was last updated 12 years, 11 months ago by zati.
Viewing 1 post (of 1 total)
-
AuthorPosts
-
December 2, 2011 at 2:50 pm #1425zatiParticipant
Please help me to fix this code. It suppose to display time and message on LCD.
ex:1st line: AM 11:25:31
2nd line: HAVE A NICE DAY
LCDWIR EQU 0FFE0HLCDWDR EQU 0FFE1HLCDRIR EQU 0FFE2HLCDRDR EQU 0FFE3H;DEFINE VARIABLEINST EQU 40HDATA EQU 41ULROW EQU 42HLCOL EQU 43HNUMFONT EQU 44HFDPL EQU 45HFDPH EQU 46H;DEFINE LCD INSTRUCTIONCLEAR EQU 01H;CUR HOMECUR_HOME EQU 02H;CONTROL DIRECTION OF CURSOR, CONTROL MOVEMENT OF DISPLAYENTRY2 EQU 06HDCB6 EQU 0EHFUN5 EQU 38HLINE_1 EQU 80HLINE_2 EQU 0C0HORG 8000HSJMP STARTORG 8003HJMP INTO_SERORG 8000BHJMP TO_SERORG 8013HJMP INT1_SERSTART: CALL LCD_INIT ; lcd initial stateMOV TMOD, #00000001B; timer 0 mode 1MOV TH0, #4BHMOV TL1, #0FDHF1 EQU 2FH.0SETB EX0SETB IT0SETB EX1SETB IT1SETB ET0SETB EASETB TR0SETB F0MOV R0, #1MOV R2, #2MOV 20H, #35HMOV 21H, #35HMOV 22H, #33HMOV 23H, #32HMOV 24H, #31HMOV 25H, #31HMOV 26H, #0MOV 29H, #20H;DISPLAY ON LCDMOV R7, #15CALL LINE_1MOV DPTR, #STR0 ; Have a nice dayLOP2: CLR AMOVC A, @A+DPTRINC DPTRCALL DATAWRDJNZ R7, LOP2; INFINITE LOOPLOOP: CJNE R0, #20, LOOP1CALL BGINGLOOP1: SJMP LOOPBGING: INC 20HMOV A, 20HCJNE A, #3AH, SECHMOV 20H, #30HINC 21HSECH: MOV A, 21HCJNE A, #36H, MINLMOV 21H, #30HINC 22HMINL: MOV A,22HCJNE A, #3AH, MINHMOV 22H, #30HINC 23HMINH: MOV A, 23HCJNE A, #36H, HOULMOV 23H, #30HINC 24HHOUH: MOV A, 25HCJNE A, #30H, AAHOUL: MOV A, 24HCJNE A, #3AH, DISPLAYMOV 24H, #30HINC 25HJMP DISPLAYAA: MOV A, 24HCJNE A, #32H, ACLINC 26HACL: CJNE A, #33H, DISPLAYMOV 24H, #31HMOV 25H, #30HDISPLAY: CALL LINE_1MOV A, 29HCALL DATAWRMOV A, 29HCALL DATAWRJB 26H.0, AAAMOV A, #41HJMP AAAAAAA: MOV A, #50HAAAA: CALL DATAWRMOV A, #4DHCALL DATAWRMOV A, 29HCALL DATAWRMOV A, 25HCALL DATAWRMOV A, 4HCALL DATAWRMOV A, #3AHCALL DATAWRMOV A, 23HCALL DATAWRMOV A, 22HCALL DATAWRMOV A, #3AHCALL DATAWRMOV A, 21HMOV A, 20HCALL DATAWRMOV R0, #1RETTO_SER: INC R0MOV TH0, #4BHMOV TL0, #0FDHRETIINTO_SER: CLR TR0CALL MINLMOV DPTR, #STRFIX: MOV 30H, #33HMOV A, #0FHCALL INSTWRMOV A, #14HCALL INSTWRINC R2INC DPTRCJNE R2, #9, BB1SETB TR0CALL INSTWRMOV R2, #0BB1: RETIINT1_SER: MOV A,R2MOV R7, AMOV DPTR, #STRLOP: INC DPTRDJNZ R7, LOPCLR AMOVC A, @A+DPTRMOV R1, AINC @R1CALL MINLMOV A, R2MOV R7, ACALL LINE_1LOP1: MOV A, #14HCALL INSTWRDJNZ R7, LOP1RETI;LCD INITIALIZIATIONLCD_INIT: MOV INST, #FUN5CALL INSTWRMOV INST, #DCB6CALL INSTWRMOV INST, #CLEARCALL INSTWRMOV INST, #ENTRY2CALL INSTWRINSTWR: CALL INSTRDMOV DPTR, #LCDWIRMOV A, INSTMOVX @DPTR, ARETDATAWR: CALL INSTRDMOV DPTR, #LCDWDRMOV A,INSTMOVX @DPTR, ARETINSTRD: MOV DPTR,#LCDRIRMOVX A, @DPTRJB ACC.7, INSTRDRETORG 5000HSTR0: DB ‘HAVE A NICE DAY’STR: DB 26H, 2EH, 2EH, 2EH, 25H, 24H, 2EH, 23H, 22HEND -
AuthorPosts
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.