《单片机汇编语言控制四位数码管循环显示0123到9.docx》由会员分享,可在线阅读,更多相关《单片机汇编语言控制四位数码管循环显示0123到9.docx(5页珍藏版)》请在三一办公上搜索。
1、单片机汇编语言控制四位数码管循环显示0123到9ORG 0000H SJMP MAIN ORG 0050H MAIN: MOV R1,#1 LOOP2:MOV R2,#100 LOOP1:MOV P2,#0FEH MOV P0,#3FH ;SHOW0 ACALL DELAY1 MOV P2,#0FDH MOV P0,#06H ;SHOW1 ACALL DELAY1 MOV P2,#0FBH MOV P0,#5BH ;SHOW2 ACALL DELAY1 MOV P2,#0F7H MOV P0,#4FH ;SHOW3 ACALL DELAY1 DJNZ R2,LOOP1 DJNZ R1,LOOP
2、2 MOV R1,#1 LOOP4:MOV R2,#100 LOOP3:MOV P2,#0FEH MOV P0,#06H ;SHOW1 ACALL DELAY1 MOV P2,#0FDH MOV P0,#5BH ;SHOW2 ACALL DELAY1 MOV P2,#0FBH MOV P0,#4FH ;SHOW3 ACALL DELAY1 MOV P2,#0F7H MOV P0,#66H ;SHOW4 ACALL DELAY1 DJNZ R2,LOOP3 DJNZ R1,LOOP4 MOV R1,#1 LOOP6:MOV R2,#100 LOOP5: MOV P2,#0FEH MOV P0,#
3、5BH ;SHOW2 ACALL DELAY1 MOV P2,#0FDH MOV P0,#4FH ;SHOW3 ACALL DELAY1 MOV P2,#0FBH MOV P0,#66H ;SHOW4 ACALL DELAY1 MOV P2,#0F7H MOV P0,#6DH ;SHOW5 ACALL DELAY1 DJNZ R2,LOOP5 DJNZ R1,LOOP6 MOV R1,#1 LOOP8:MOV R2,#100 LOOP7:MOV P2,#0FEH MOV P0,#4FH ;SHOW3 ACALL DELAY1 MOV P2,#0FDH MOV P0,#66H ;SHOW4 AC
4、ALL DELAY1 MOV P2,#0FBH MOV P0,#6DH ;SHOW5 ACALL DELAY1 MOV P2,#0F7H MOV P0,#7DH ;SHOW6 ACALL DELAY1 DJNZ R2,LOOP7 DJNZ R1,LOOP8 MOV R1,#1 LOOP10:MOV R2,#100 LOOP9:MOV P2,#0FEH MOV P0,#66H ;SHOW4 ACALL DELAY1 MOV P2,#0FDH MOV P0,#6DH ;SHOW5 ACALL DELAY1 MOV P2,#0FBH MOV P0,#7DH ;SHOW6 ACALL DELAY1 M
5、OV P2,#0F7H MOV P0,#07H ;SHOW7 ACALL DELAY1 DJNZ R2,LOOP9 DJNZ R1,LOOP10 MOV R1,#1 LOOP12:MOV R2,#100 LOOP11:MOV P2,#0FEH MOV P0,#6DH ;SHOW5 ACALL DELAY1 MOV P2,#0FDH MOV P0,#7DH ;SHOW6 ACALL DELAY1 MOV P2,#0FBH MOV P0,#07H ;SHOW7 ACALL DELAY1 MOV P2,#0F7H MOV P0,#7FH ;SHOW8 ACALL DELAY1 DJNZ R2,LOO
6、P11 DJNZ R1,LOOP12 MOV R1,#1 LOOP14:MOV R2,#100 LOOP13:MOV P2,#0FEH MOV P0,#7DH ;SHOW6 ACALL DELAY1 MOV P2,#0FDH MOV P0,#07H ;SHOW7 ACALL DELAY1 MOV P2,#0FBH MOV P0,#7FH ;SHOW8 ACALL DELAY1 MOV P2,#0F7H MOV P0,#6FH ;SHOW9 ACALL DELAY1 DJNZ R2,LOOP13 DJNZ R1,LOOP14 MOV R1,#1 LOOP16:MOV R2,#100 LOOP15
7、:MOV P2,#0FEH MOV P0,#07H ;SHOW7 ACALL DELAY1 MOV P2,#0FDH MOV P0,#7FH ;SHOW8 ACALL DELAY1 MOV P2,#0FBH MOV P0,#6FH ;SHOW9 ACALL DELAY1 MOV P2,#0F7H MOV P0,#3FH ;SHOW0 ACALL DELAY1 DJNZ R2,LOOP15 DJNZ R1,LOOP16 MOV R1,#1 LOOP18:MOV R2,#100 LOOP17:MOV P2,#0FEH MOV P0,#7FH ;SHOW8 ACALL DELAY1 MOV P2,#
8、0FDH MOV P0,#6FH ;SHOW9 ACALL DELAY1 MOV P2,#0FBH MOV P0,#3FH ;SHOW0 ACALL DELAY1 MOV P2,#0F7H MOV P0,#06H ;SHOW1 ACALL DELAY1 DJNZ R2,LOOP17 DJNZ R1,LOOP18 MOV R1,#1 LOOP20:MOV R2,#100 LOOP19:MOV P2,#0FEH MOV P0,#6FH ;SHOW9 ACALL DELAY1 MOV P2,#0FDH MOV P0,#3FH ;SHOW0 ACALL DELAY1 MOV P2,#0FBH MOV P0,#06H ;SHOW1 ACALL DELAY1 MOV P2,#0F7H MOV P0,#5BH ;SHOW2 ACALL DELAY1 DJNZ R2,LOOP19 DJNZ R1,LOOP20 LJMP MAIN DELAY1:MOV R7,#5; DL2:MOV R6,#10; DL1:MOV R5,#10; DJNZ R5,$ DJNZ R6,DL1 DJNZ R7,DL2 RET END