程序功能:I/O口输出点亮LED,并间隔0.2秒闪烁!
(P1.0引脚接LED)
LED EQU P1.0 ;宏定义
ORG 0000H
LJMP MAIN
ORG 0200H
MAIN: SETB LED ;不亮
CALL DELAY ;延时0.2秒
CLR LED ;亮
CALL DELAY ;延时0.2秒
AJMP MAIN
DELAY: MOV 50H,#200;延时子程序,定时0.2秒
DELAYms:MOV 52H,#20
DELAYa: MOV 51H,#20
DJNZ 51H,$
DJNZ 52H,DELAYa
DJNZ 50H,DELAYms
RET
END
时间: 2024-10-11 20:48:10