程序框图
程序
0030 758160 CHK00: MOV SP,#60H
0033 1204A5 LCALL LEDP
0036 900081 MOV DPTR,#CLOCK
0039 A882 MOV R0,DPL
003B A983 MOV R1,DPH
003D 90000B MOV DPTR,#000BH
0040 7402 MOV A,#02H
0042 F0 MOVX @DPTR,A
0043 A3 INC DPTR
0044 E9 MOV A,R1
0045 F0 MOVX @DPTR,A
0046 A3 INC DPTR
0047 E8 MOV A,R0
0048 F0 MOVX @DPTR,A
0049 120DF0 CHK0: LCALL LCK0 ;键扫,显示子程序
004C 120068 LCALL PTDS0 ;显示缓冲区放数子程序
004F 758901 MOV TMOD,#01H
0052 43A882 ORL IE,#82H
0055 758AB7 MOV TL0,#0B7H
0058 758C3C MOV TH0,#3CH ;定时中断初始化
005B 752300 MOV 23H,#00H
005E D28C SETB TR0 ;开定时
0060 120425 LOO5: LCALL DIS ;显示
0063 120068 LCALL PTDS0
0066 80F8 SJMP LOO5
0068 7879 PTDS0: MOV R0,#79H
006A E522 MOV A,22H
006C 1177 ACALL PTDS
006E E521 MOV A,21H
0070 1177 ACALL PTDS
0072 E520 MOV A,20H
0074 1177 ACALL PTDS
0076 22 RET
0077 F9 PTDS: MOV R1,A ;拆送显示缓冲区
0078 117C ACALL PTDS1
007A E9 MOV A,R1
007B C4 SWAP A
007C 540F PTDS1: ANL A,#0FH
007E F6 MOV @R0,A
007F 08 INC R0
0080 22 RET
0081 758AB7 CLOCK: MOV TL0,#0B7H
0084 758C3C MOV TH0,#3CH ;恢复初值
0087 C0D0 PUSH PSW
0089 C0E0 PUSH ACC
008B D2D3 SETB 0D3H ;保护
008D 0523 INC 23H ;0.1秒加1
008F E523 MOV A,23H
0091 B40A27 CJNE A,#0AH,DONE ;1秒到吗?
0094 752300 MOV 23H,#00H ;清0.1秒单元
0097 E522 MOV A,22H
0099 04 INC A ;秒加1
009A D4 DA A
009B F522 MOV 22H,A ;十进制调整
009D B4601B CJNE A,#60H,DONE ;60秒到吗?
00A0 752200 MOV 22H,#00H ;秒单元清零
00A3 E521 MOV A,21H
00A5 04 INC A
00A6 D4 DA A ;分加1,十进制调整
00A7 F521 MOV 21H,A
00A9 B4600F CJNE A,#60H,DONE ;60分到吗?
00AC 752100 MOV 21H,#00H ;分单元清零
00AF E520 MOV A,20H
00B1 04 INC A
00B2 D4 DA A ;时加1,十进制调整
00B3 F520 MOV 20H,A
00B5 B42403 CJNE A,#24H,DONE ;24小时到吗?
00B8 752000 MOV 20H,#00H ;时单元清零
00BB D0E0 DONE: POP ACC ;退栈
00BD D0D0 POP PSW
00BF 32 RET1
ORG 0D59H
0D59 D2D4 SSEE: SETB RS1 ;换工作区
0D58 7D05 MOV R5,#05H
0D5D 753020 SSE2: MOV 30H,#20H
0D60 75317E MOV 31H,#7EH
0D63 7F06 MOV R7,#06H
0D65 79DD SSE1: MOV R1,#0DDH
0D67 E530 MOV A,30H
0D69 F3 MOVX @R1,A ;字位送入
0D6A A831 MOV R0,31H
0D6C E6 MOV A,@R0
0D6D 900D85 MOV DPTR,#0DDFFH
0D70 93 MOVC A,@A+DPTR ;取字形代码
0D71 79DC MOV R1,#0DCH
0D73 F3 MOVX @R1,A ;字形送入
0D74 E530 MOV A,30H ;右移
0D76 03 RR A
0D77 F530 MOV 30H,A
0D79 1531 DEC 31H
0D7B 74FF MOV A,#0FFH
0D7D F3 MOVX @R1,A ;关显示
0D7E DFE5 DJNZ R7,SSE1 ;6位显示完了吗?
0D80 DDDB DJNZ R5,SSE2 ;5次显示完了吗?
0D82 C2D4 CLR RS1
0D84 22 RET
0D85 C0F9A4 ODFF: DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H
0D88 B09992, DB 0F8H,80H,90H
0D8B 82F880
0D8E 90
0D8F 8883C6 DB 88H,83H,0C6H,0A1H,86H
0D92 A1868E DB 8EH,0FFH,0CH,89H,0DEH
0D95 FF0C89
0D98 DE
ORG 038EH
038E FC X3: MOV R4,A
038F 7850 MOV R0,#50H
0391 E6 MOV A,@R0
0392 F9 MOV R1,A
0393 EC MOV A,R4
0394 F7 MOV @R1,A
0395 E4 CLR A
0396 D083 POP DPH
0398 D082 POP DPL
039A 93 MOVC A,@A+DPTR
039B A3 INC DPTR
039C B5010A CJNE A,01H,X30
039F 19 DEC R1
03A0 E4 CLR A
03A1 93 MOVC A,@A+DPTR
03A2 F6 X31: MOV @R0,A
03A3 A3 INC DPTR
03A4 C082 PUSH DPL
03A6 C083 PUSH DPH
03A8 22 RET
03A9 19 X30: DEC R1
03AA E9 MOV A,R1
03AB 80F5 SJMP X31
;--------------------------------------
03AD 7E50 X2:MOV R6,#50H
03AF 71D1 X0:ACALL XLE
03B1 30E51C JNB ACC.5,XX0
03B4 DEF9 DJNZ R6,X0
03B6 7E20 MOV R6,#20H
03B8 7850 MOV R0,#50H
03BA E6 MOV A,@R0
03BB F8 MOV R0,A
03BC E6 MOV A,@R0
03BD FF MOV R7,A
03BE 7410 MOV A,#10H
03C0 F6 MOV @R0,A
03C1 71D1 X1:ACALL XLE
03C3 30E506 JNB ACC.5,XX1
03C6 DEF9 DJNZ R6,X1
03C8 EF MOV A,R7
03C9 F6 MOV @R0,A
03CA 80E1 SJMP X2
03CC FE XX1: MOV R6,A
03CD EF MOV A,R7
03CE F6 MOV @R0,A
03CF EE MOV A,R6
03D0 22 XX0: RET
03D1 9125 XLE: ACALL DIS
03D3 9164 ACALL KEY
03D5 FC MOV R4,A
03D6 7948 MOV R1,#48H
03D8 E7 MOV A,@R1
03D9 FA MOV R2,A
03DA 09 INC R1
03DB E7 MOV A,@R1
03DC FB MOV R3,A
03DD EC MOV A,R4
03DE 6B XRL A,R3
03DF AB04 MOV R3,04H
03E1 AC02 MOV R4,02H
03E3 6004 JZ X10
03E5 7A88 MOV R2,#88H
03E7 7C88 MOV R4,#88H
03E9 1C X10: DEC R4
03EA EC MOV A,R4
03EB 6482 XRL A,#82H
03ED 600F JZ X11
03EF EC MOV A,R4
03F0 640E XRL A,#0EH
03F2 600A JZ X11
03F4 EC MOV A,R4
03F5 6005 JZ X12
03F7 7C02 MOV R4,#20H
03F9 1A DEC R2
03FA 8006 SJMP X13
03FC 7C0F X12: MOV R4,#0FH
03FE AA04 X11: MOV R2,04H
0400 AC03 MOV R4,03H
0402 7948 X13: MOV R1,#48H
0404 EA MOV A,R2
0405 F7 MOV @R1,A
0406 09 INC R1
0407 EB MOV A,R3
0408 F7 MOV @R1,A
0409 EC MOV A,R4
040A 20E507 JB ACC.5,X113
040D 20E404 JB ACC.4,X113
0410 900415 MOV DPTR,#LS3
0413 93 MOVC A,@A+DPTR
0414 22 X113: RET
0415 070408 LS3: DB 07H,04H,08H,05H,09H,06H,0AH 0418 050906
041B 0A
041C 0B0100 DB 0BH,01H,00H,02H,0FH,03H,0EH
041F 020F03
0422 0E
0423 0C0D DB 0CH,0DH
0425 C083 DIS: PUSH DPH
0427 C082 PUSH DPL
0429 D2D4 SETB RS1
042B 787E MOV R0,#7EH
042D 7A20 MOV R2,#20H
042F 7B00 MOV R3,#00H
0431 90044F MOV DPTR,#LS0
0434 E6 LS2: MOV A,@R0
0435 93 MOVC A,@A+APTR
0436 79DC MOV R1,#0DCH
0438 F3 MOVX @R1,A
0439 EA MOV A,R2
043A 09 INC R1
043B F3 MOVX @R1,A
043C DBFE LS1: DJNZ R3,LS1
043E C3 CLR C
043F 13 RRC A
0440 FA MOV R2,A
0441 18 DEC R0
0442 70F0 JNZ LS2
0444 F2 MOVX @R0,A
0445 18 DEC R0
0446 F4 CPL A
0447 F2 MOVX @R0,A
0448 C2D4 CLR RS1
044A D082 POP DPL
044C D083 POP DPH
044E 22 RET
044F C0F9A4 LS0: DB 0C0H,0F9H,0A4H,0B0H,99H,92H
0452 B09992
0455 82F880 DB 82H,0F8H,80H,90H,88H,83H,0C6H
0458 908883
045B C6
045C A1868E DB 0A1H,86H,8EH,0FFH,0CH,89H,7FH,0BFH
045F FF0C89
0462 7FBF
0464 D2D4 KEY: SETB RS1
0466 7AFE MOV R2,#0FEH
0468 7B08 MOV R3,#08H
046A 7800 MOV R0,#00H
046C 79DD LP1: MOV R1,#0DDH
046E EA MOV A,R2
046F F3 MOVX @R1,A
0470 23 RL A
0471 FA MOV R2,A
0472 09 INC R1
0473 E3 MOVX A,@R1
0474 F4 CPL A
0475 540F ANL A,#0FH
0477 700E JNZ LP0
0479 08 INC R0
047A DBF0 DJNZ R3,LP1
047C 7420 XP33: MOV A,#20H
047E FA XP3: MOV R2,A
047F E4 CLR A
0480 79DD MOV R1,#0DDH
0482 F3 MOVX @R1,A
0483 EA MOV A,R2
0484 C2D4 CLR RS1
0486 22 RET
0487 F4 LP0: CPL A
0488 20E004 JB ACC.0,XP0
048B 7400 MOV A,#00H
048D 8013 SJMP LPP
048F 20E104 XP0: JB ACC.1,XP1
0492 7408 MOV A,#08H
0494 800C SJMP LPP
0496 20E204 XP1: JB ACC.2,XP2
0499 7410 MOV A,#10H
049B 8005 SJMP LPP
049D 20E3DC XP2: JB ACC.3,XP33
04A0 7418 MOV A,#18H
04A2 28 LPP: ADD A,R0
04A3 80D9 SJMP XP3
;---------------------------------------
04A5 75507E LEDP: MOV 50H,#7EH
04A8 7410 MOV A,#10H
04AA 7879 MOV R0,#79H
04AC F6 LEDS: MOV @R0,A
04AD 08 INC R0
04AE B87EFB CJNE R0,#7EH,LEDS
04B1 04 INC A
04B2 F6 MOV @R0,A
04B3 7420 MOV A,#20H
04B5 F548 MOV 48H,A
04B7 F549 MOV 49H,A
04B9 22 RET
END
上一篇:AT89S51算术运算类指令
下一篇:DAC0832转换程序
推荐阅读最新更新时间:2024-03-16 15:57