汇编:
org 0000h
ajmp main
org 0100h
main: mov A,#80h
mov p1,a
lcall delay
loop: rr a
mov p1,a
lcall delay
ajmp loop
delay: mov r7,#250
d1: mov r6,#250
d2: djnz r6,d2
djnz r7,d1
ret
end
C代码:
#include<reg52.h>
#include<stdio.h>
void delay()
{
unsigned char i,j;
for(i=1;i<=250;++i)
for(j=1;j<=250;++j);
}
void main()
{
while(1)
{
P0=0x00;
delay();
P0=0xff;
delay();
}
}
文章评论(0条评论)
登录后参与讨论