设8051单片机的P1的8位接8个发光二极管,正常情况下,二极管常亮;当外部中断0产生中断时,二极管依次循环

2025-04-05 23:14:24
推荐回答(1个)
回答1:

org 0000h
ajmp main
org 0030h
ajmp inter
org 0030h
main:
mov ie,#10000001b
mov r0,#1h

flag:
mov p1,#0ffh
ajmp flag

inter:
mov a,r0
mov p1,a
rl a
lcall delay

reti

delay:
mov r7 ,#20
d1: mov r6,#220
d2: mov r5,#200
djnz r5,$
djnz r6,d3
djnz r7,d1
ret

end