单片机程序题 下载本文

NOKEY:

MOV A,P1 CPL A

JZ NOKEY MOV TEMP,P1 MOV A,P1

CJNE A,TEMP,NOKEY MOV R7,#16 MOV R2,#0

LOOP:MOV A,R2

MOV DPTR,#CODE_P0 MOVC A,@A+DPTR MOV P2,A INC R2 LCALL DL1S

DJNZ R7,LOOP SJMP START DL10ms:

MOV R6,#125 DL1: MOV R5,#98 NOP

DL2: DJNZ R5,DL2 DJNZ R6,DL1 RET

DL1s: MOV R4,#13 DL3: ACALL DL10ms DJNZ R4,DL3 RET

CODE_P0: DB 3FH,06H,5BH,4FH

DB 66H,6DH,7DH,07H

DB 7FH,6FH,77H,7CH

DB 39H,5EH,79H,71H

end

TEMP EQU 30H ORG 0000H

START: MOV SP,#5FH MOV P2,#73H MOV P1,#0FFH NOKEY:

MOV A,P1 CPL A

JZ NOKEY MOV TEMP,P1 MOV A,P1

CJNE A,TEMP,NOKEY MOV R7,#16 MOV R2,#0

LOOP:MOV A,R2

MOV DPTR,#CODE_P0 MOVC A,@A+DPTR MOV P2,A INC R2 LCALL DL1S

DJNZ R7,LOOP SJMP START DL10ms:

MOV R6,#125 DL1: MOV R5,#98 NOP

DL2: DJNZ R5,DL2 DJNZ R6,DL1 RET

DL1s: MOV R4,#13 DL3: ACALL DL10ms DJNZ R4,DL3 RET

CODE_P0: DB 3FH,06H,5BH,4FH

DB 66H,6DH,7DH,07H

DB 7FH,6FH,77H,7CH

DB 39H,5EH,79H,71H

end