哈工大单片机原理与应用实验报告 下载本文

MOV A,30H RR A

MOV 30H,A DEC 31H

MOV A,#0FFH

MOVX @R1,A DJNZ R7,SSE1 DJNZ R5,SSE2 CLR RS1 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 MOV R0,#50H MOV A,@R0 MOV R0,A MOV A,@R0 MOV R7,A MOV A,#10H

-20-

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 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

-21-

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 DIS: PUSH DPH PUSH DPL SETB RS1 MOV R0,#7EH MOV R2,#20H MOV R3,#00H MOV DPTR,#LS0 LS2: MOV A,@R0

MOVC A,@A+DPTR MOV R1,#0DCH MOVX @R1,A MOV A,R2 inc R1

MOVX @R1,A LS1: DJNZ R3,LS1 CLR C RRC A MOV R2,A DEC R0 JNZ LS2 movx @r0,a dec r0 cpl a movx @r0,a CLR RS1 POP DPL POP DPH RET

LS0: DB 0C0H,0F9H,0A4H,0B0H,99H,92H DB 82H,0F8H,80H,90H,88H,83H,0C6H

DB 0A1H,86H,8EH,0FFH,0CH,89H,7FH,0BFH KEY: SETB RS1

-22-

MOV R2,#0FEH MOV R3,#08H MOV R0,#00H LP1: MOV R1,#0DDH MOV A,R2 MOVX @R1,A RL A

MOV R2,A inc r1

MOVX A,@R1 CPL A

ANL A,#0FH JNZ LP0 INC R0

DJNZ R3,LP1 XP33: MOV A,#20H XP3: mov r2,a clr a mov r1,#0ddh movx @r1,a mov a,r2 CLR RS1 RET LP0: CPL A

JB ACC.0,XP0 MOV A,#00H SJMP LPP XP0: JB ACC.1,XP1 MOV A,#08H SJMP LPP XP1: JB ACC.2,XP2 MOV A,#10H SJMP LPP

XP2: JB ACC.3,XP33 MOV A,#18H LPP: ADD A,R0 sjmp xp3

LEDP: MOV 50H,#7EH MOV A,#10H MOV R0,#79H LEDS: MOV @R0,A INC R0 CJNE R0,#7EH,LEDS INC A MOV @R0,A RET

-23-