1、51单片机心形灯汇编程序ORG 0000HMAIN: MOV R1,#08H MOV A,#7FHDAN2: MOV P2,A CALL DELAY RR A DJNZ R1,DAN2 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#7FHDAN3: MOV P3,A CALL DELAY RR A DJNZ R1,DAN3 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#7FHDAN4: MOV P1,A
2、CALL DELAY RR A DJNZ R1,DAN4 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#0FEHDAN1: MOV P0,A ACALL DELAY RL A DJNZ R1,DAN1 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH ;单个跑马灯 MOV R1,#08H MOV A,#7FHDAN22: MOV P2,A CALL DELAY1 RR A DJNZ R1,DAN22 MOV P0,#0FFH MOV P1,#0F
3、FH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#7FHDAN33: MOV P3,A CALL DELAY1 RR A DJNZ R1,DAN33 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#7FHDAN44: MOV P1,A CALL DELAY1 RR A DJNZ R1,DAN44 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#0FEHDAN11:
4、 MOV P0,A ACALL DELAY1 RL A DJNZ R1,DAN11 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH ;单个跑马灯 MOV R1,#08H MOV A,#7FHDAN222: MOV P2,A CALL DELAY2 RR A DJNZ R1,DAN222 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#7FHDAN333: MOV P3,A CALL DELAY2 RR A DJNZ R1,DAN333 MOV P
5、0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#7FHDAN444: MOV P1,A CALL DELAY2 RR A DJNZ R1,DAN444 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#0FEHDAN111: MOV P0,A ACALL DELAY2 RL A DJNZ R1,DAN111 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH ;单个跑马
6、灯 MOV R1,#08H MOV A,#7FHD1AN22: MOV P2,A CALL DELAY3 RR A DJNZ R1,D1AN22 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#7FHD1AN33: MOV P3,A CALL DELAY3 RR A DJNZ R1,D1AN33 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#7FHD1AN44: MOV P1,A CALL DELAY3 R
7、R A DJNZ R1,D1AN44 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#0FEHD1AN11: MOV P0,A ACALL DELAY3 RL A DJNZ R1,D1AN11 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH ;单个跑马灯 MOV R1,#08H MOV A,#7FHDAN2A: MOV P2,A CALL DELAY4 RR A DJNZ R1,DAN2A MOV P0,#0FFH MOV P1,#0FFH MO
8、V P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#7FHDAN3A: MOV P3,A CALL DELAY4 RR A DJNZ R1,DAN3A MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#7FHDAN4A: MOV P1,A CALL DELAY4 RR A DJNZ R1,DAN4A MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H ;单个跑马灯 MOV A,#0FEHDAN1
9、A: MOV P0,A ACALL DELAY4 RL A DJNZ R1,DAN1A MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#7FHDAN2A1: MOV P2,A CALL DELAY4 RR A DJNZ R1,DAN2A1 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#7FHDAN3A1: MOV P3,A CALL DELAY4 RR A DJNZ R1,DAN3A1 MOV P0,#0F
10、FH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H MOV A,#7FHDAN4A1: MOV P1,A CALL DELAY4 RR A DJNZ R1,DAN4A1 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#12H MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H ;单个跑马灯 MOV A,#0FEHDAN1A1: MOV P0,A ACALL DELAY4 RL A DJNZ R
11、1,DAN1A1 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#4JIAOTI: ;交替闪烁 MOV P0,#01010101B MOV P1,#01010101B MOV P2,#01010101B MOV P3,#01010101B CALL DELAY MOV P0,#10101010B MOV P1,#10101010B MOV P2,#10101010B MOV P3,#10101010B CALL DELAY DJNZ R1,JIAOTI MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0
12、FFH MOV P3,#0FFH MOV R1,#08HQUAN: ;闪烁的频率由慢变快 MOV P0,#00H MOV P1,#00H MOV P2,#00H MOV P3,#00H CALL DELAY MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH CALL DELAY DJNZ R1,QUAN MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV R1,#08H ;渐渐变亮,然后熄灭 MOV A,#07FHJIAN2: MOV P2,A ACALL DELAY1 RR A
13、ANL A,P2 DJNZ R1,JIAN2 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#00H MOV P3,#0FFH MOV R1,#08H MOV A,#07FHJIAN3: MOV P3,A ACALL DELAY1 RR A ANL A,P3 DJNZ R1,JIAN3 MOV P0,#0FFH MOV P1,#0FFH MOV P2,#00H MOV P3,#00H MOV R1,#08H MOV A,#07FH JIAN4: MOV P1,A ACALL DELAY1 RR A ANL A,P1 DJNZ R1,JIAN4 MOV P0,#0FFH MO
14、V P1,#00H MOV P2,#00H MOV P3,#00H MOV R1,#08H MOV A,#0FEHJIAN1: MOV P0,A ACALL DELAY1 RL A ANL A,P0 DJNZ R1,JIAN1 MOV P0,#00H MOV P1,#00H MOV P2,#00H MOV P3,#00H MOV P0,#10101010B MOV P1,#01010101B MOV P2,#01010101B MOV P3,#01010101B ANL P2,#00010101B CALL DELAY ANL P2,#00000101B CALL DELAY ANL P2,#
15、00000001B CALL DELAY ANL P2,#00000000B CALL DELAY ANL P3,#00010101b CALL DELAY ANL P3,#00000101b CALL DELAY ANL P3,#00000001b CALL DELAY ANL P3,#00000000b CALL DELAY ANL P1,#00010101b CALL DELAY ANL P1,#00000101b CALL DELAY ANL P1,#00000001b CALL DELAY ANL P1,#00000000b CALL DELAY ANL P0,#10101000B
16、CALL DELAY ANL P0,#10100000B CALL DELAY ANL P0,#10000000B CALL DELAY ANL P0,#00000000B CALL DELAY ORL P0,#01000000b CALL DELAY ORL P0,#01010000b CALL DELAY ORL P0,#01010100b CALL DELAY ORL P0,#01010101b CALL DELAY ORL P1,#00000010b CALL DELAY ORL P1,#00001010b CALL DELAY ORL P1,#00101010b CALL DELAY
17、 ORL P1,#10101010b CALL DELAY ORL P3,#00000010b CALL DELAY ORL P3,#00001010b CALL DELAY ORL P3,#00101010b CALL DELAY ORL P3,#10101010b CALL DELAY ORL P2,#00000010b CALL DELAY ORL P2,#00001010b CALL DELAY ORL P2,#00101010b CALL DELAY ORL P2,#10101010b CALL DELAY ANL P0,#00010101B ANL P2,#00101010B CA
18、LL DELAY ANL P0,#00000101B ANL P2,#00001010B CALL DELAY ANL P0,#00000001B ANL P2,#00000010B CALL DELAY ANL P0,#00000000B ANL P2,#00000000B CALL DELAY ANL P1,#10101000B ANL P3,#00101010B CALL DELAY ANL P1,#10100000B ANL P3,#00001010B CALL DELAY ANL P1,#10000000B ANL P3,#00000010B CALL DELAY ANL P1,#0
19、0000000B ANL P3,#00000000B CALL DELAY ORL P1,#01000000B ORL P3,#00000001B CALL DELAY ORL P1,#01010000B ORL P3,#00000101B CALL DELAY ORL P1,#01010100B ORL P3,#00010101B CALL DELAY ORL P1,#01010101B ORL P3,#01010101B CALL DELAY ORL P0,#00000000B ORL P2,#00000001B CALL DELAY ORL P0,#00001010B ORL P2,#0
20、0000101B CALL DELAY ORL P0,#00101010B ORL P2,#00010101B CALL DELAY ORL P0,#10101010B ORL P2,#01010101B CALL DELAY ORL P0,#11000000B ORL P2,#11000000B CALL DELAY ORL P0,#11110000B ORL P2,#11110000B CALL DELAY ORL P0,#11111100B ORL P2,#11111100B CALL DELAY ORL P0,#11111111B ORL P2,#11111111B CALL DELA
21、Y ORL P1,#00000011B ORL P3,#11000000B CALL DELAY ORL P1,#00001111B ORL P3,#11110000B CALL DELAY ORL P1,#00111111B ORL P3,#11111100B CALL DELAY ORL P1,#11111111B ORL P3,#11111111B CALL DELAY ANL P1,#01111111B ANL P3,#11111110B CALL DELAY ANL P1,#00111111B ANL P3,#11111100B CALL DELAY ANL P1,#00011111
22、B ANL P3,#11111100B CALL DELAY ANL P1,#00001111B ANL P3,#11110000B CALL DELAY ANL P1,#00000111B ANL P3,#11100000B CALL DELAY ANL P1,#00000011B ANL P3,#11000000B CALL DELAY ANL P1,#00000001B ANL P3,#10000000B CALL DELAY ANL P1,#00000000B ANL P3,#00000000B CALL DELAY ANL P0,#11111110B ANL P2,#11111110
23、B CALL DELAY ANL P0,#11111100B ANL P2,#11111100B CALL DELAY ANL P0,#11111000B ANL P2,#11111000B CALL DELAY ANL P0,#11110000B ANL P2,#11110000B CALL DELAY ANL P0,#11100000B ANL P2,#11100000B CALL DELAY ANL P0,#11000000B ANL P2,#11000000B CALL DELAY ANL P0,#10000000B ANL P2,#10000000B CALL DELAY ANL P
24、0,#00000000B ANL P2,#00000000B CALL DELAY MOV R1,#4JIAOT: ;交替闪烁 MOV P0,#00110011B MOV P1,#00110011B MOV P2,#00110011B MOV P3,#00110011B CALL DELAY MOV P0,#11001100B MOV P1,#11001100B MOV P2,#11001100B MOV P3,#11001100B CALL DELAY DJNZ R1,JIAOT MOV P0,#0FFH MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH MOV
25、R1,#6SIGE: MOV P0,#11111110B MOV P1,#01111111B MOV P2,#01111111B MOV P3,#01111111B CALL DELAY1 MOV P0,#11111100B MOV P1,#00111111B MOV P2,#00111111B MOV P3,#00111111B CALL DELAY1 MOV P0,#11111000B MOV P1,#00011111B MOV P2,#00011111B MOV P3,#00011111B CALL DELAY1 MOV P0,#11110000B MOV P1,#00001111B MOV P2,#00001111B MOV P3,#00001111B CALL DELAY1 MOV P0,#11100000B MOV P1,#00000111B MOV P2,#00000111B MOV P3,#00000111B CALL DELAY1 MOV P0,#11000000B MOV P1,#000000111B MOV P2,#00000011B MOV P3,#00000011B CALL DELAY1
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1