以下程序已经通过实验验证---可放心使用 【P1口输出实验程序】-----跑马灯-------------------------------------------------------- ORG 0000H LJMP START ORG 0100H START: MOV SP,#60H MOV A,#0FFH MOV P1,A ACALL Delay CLR C START1: MOV A,#0H MOV P1,A ACALL DELAY LJMP START1 Delay: MOV R5,#2 ;延时 Delay1: MOV R6,#0 Delay2: MOV R7,#0 DJNZ R7,$ DJNZ R6,Delay2 DJNZ R5,Delay1 RET END 【P1口输入、输出实验程序】-----跑马灯-------------------------------------------------------- ORG 0000H LJMP START ORG 0100H START: MOV SP,#60H MOV A,#0FFH MOV P1,A CLR C START1: MOV P1,#00H ACALL Delay MOV R0,#0 CLR C LOOP1: RLC A MOV P1,A ACALL Delay INC R0 CJNE R0,#0BH,LOOP1 CLR C MOV A,#0FFH MOV R0,#0 LOOP2: RRC A MOV P1,A ACALL Delay INC R0 CJNE R0,#0BH,LOOP2 SETB C MOV R0,#0 MOV A,#03FH LOOP3: RRC A MOV P1,A INC R0 CJNE R0,#07H,LOOP3 SJMP START1 Delay: MOV R5,#2 ;延时 Delay1: MOV R6,#0 Delay2: MOV R7,#0 DJNZ R7,$ DJNZ R6,Delay2 DJNZ R5,Delay1 RET END
|
简洁版|文理人 ( 京ICP备19054389号-3 )
GMT+8, 2024-3-29 17:36 , Processed in 0.096316 second(s), 18 queries .
Powered by Discuz! X3.4
© 2008-2013 WenLiRen