哈工大单片机实验报告 下载本文

MOV A,20H INC A

DA A ;时加1.十进制调整 MOV 20H,A

CJNE A,#24H,DONE ;24小时到吗? MOV 20H,#00H ;时单元清零 DONE: POP ACC ;退栈 POP PSW RETI

;----------------------------------------------

SSEE: SETB RS1 ;换工作区 MOV R5,#05H SSE2: MOV 30H,#20H MOV 31H,#7EH MOV R7,#06H SSE1: MOV R1,#0DDH MOV A,30H

MOVX @R1,A ;字位送入 MOV R0,31H MOV A,@R0 MOV DPTR,#DDFF

MOVC A,@A+DPTR ;取字形代码 MOV R1,#0DCH

MOVX @R1,A ;字形送入 MOV A,30H ;右移 RR A MOV 30H,A DEC 31H MOV A,#0FFH

MOVX @R1,A ;关显示 DJNZ R7,SSE1 ;6位显示完了吗? DJNZ R5,SSE2 ;5次显示完了吗? CLR RS1

-16-

RET

;-------------------------------------------------------

DDFF: DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H DB 88H,83H,0C6H,0A1H,86H,8EH,0FFH,0CH,89H,0DEH ;------------------------------------------------------- X3: MOV R4,A MOV R0,#50H MOV A,@R0 MOV R1,A MOV A,R4 MOV @R1,A CLR A POP DPH POP DPL

MOVC A,@A+DPTR INC DPTR CJNE A,01H,X30 dec r1 clr a

MOVC A,@A+DPTR X31: MOV @R0,A INC DPTR PUSH DPL PUSH DPH RET X30: DEC R1 MOV A,R1 SJMP X31 ;-------------------------- X2: MOV R6,#50H X0: ACALL XLE JNB ACC.5,XX0 DJNZ R6,X0 MOV R6,#20H

-17-

MOV R0,#50H MOV A,@R0 MOV R0,A MOV A,@R0 MOV R7,A MOV A,#10H MOV @R0,A X1: ACALL XLE JNB ACC.5,XX1 DJNZ R6,X1 MOV A,R7 MOV @R0,A SJMP X2 XX1: MOV R6,A MOV A,R7 MOV @R0,A MOV A,R6 XX0: RET ;---------------------------- XLE: ACALL DIS ACALL KEY MOV R4,A MOV R1,#48H MOV A,@R1 MOV R2,A INC R1 MOV A,@R1 MOV R3,A MOV A,R4 XRL A,R3 MOV R3,04H MOV R4,02H JZ X10 MOV R2,#88H

-18-

MOV R4,#88H X10: DEC R4 MOV A,R4 XRL A,#82H JZ X11 MOV A,R4 XRL A,#0EH JZ X11 MOV A,R4 JZ X12 MOV R4,#20H DEC R2 SJMP X13 X12: MOV R4,#0FH X11: MOV R2,04H NOP NOP

MOV R4,03H X13: MOV R1,#48H MOV A,R2 MOV @R1,A INC R1 MOV A,R3 MOV @R1,A MOV A,R4 JB ACC.5,X113 JB ACC.4,X113 MOV DPTR,#LS3 MOVC A,@A+DPTR X113: RET

;---------------------------------

LS3: DB 07H,04H,08H,05H,09H,06H,0AH DB 0BH,01H,00H,02H,0FH,03H,0EH DB 0CH,0DH

-19-