51单片机用汇编实现LED1亮1秒,灭3秒循环执行?

2025-04-05 07:56:38
推荐回答(1个)
回答1:

ORG 0000H START: MOV P0,#0FEH LCALL DELAY1 MOV P0,#01H LCALL DELAY1 LCALL DELAY SJMP START DELAY1: push 03h push 04h push 05h mov r3,#100 d1: mov r4,#20 d2: mov r5,#248 d3: djnz r5,d3 nop djnz r4,d2 djnz r3,d1 pop 05h pop 04h pop 03h ret delay: push 03h push 04h push 05h mov r3,#50 d1: mov r4,#20 d2: mov r5,#248 d3: djnz r5,d3 nop djnz r4,d2 djnz r3,d1 pop 05h pop 04h pop 03h ret end