#include "reg51.h"
sbit P1_0=P1^0;
sbit P1_1=P1^1;
sbit P1_2=P1^2;
sbit P0_0=P0^0;
sbit P0_1=P0^1;
sbit P0_2=P0^2;
sbit P0_3=P0^3;
sbit P0_4=P0^4;
sbit P0_5=P0^5;
sbit P0_6=P0^6;
sbit P0_7=P0^7;
void mdelay(unsigned int delaytime)
{ unsigned int k=0;
for(;delaytime>0;delaytime--)
{ for(k=0;k<500;k++)
{;}
}
}
void main ()
{ unsigned char k;
P1_0=1;
P1_1=0;
P1_2=0;
for(;;)
{
P3=0x0f;
k=P3|0xfe;
if(k!=0xff)
{
P0_0=~P0_0;
mdelay(20 );
P0_0=~P0_0;
P0_1=~P0_1;
mdelay(20 );
P0_1=~P0_1;
P0_2=~P0_2;
mdelay(20 );
P0_2=~P0_2;
P0_3=~P0_3;
mdelay(20 );
P0_3=~P0_3;
P0_4=~P0_4;
mdelay(20 );
P0_4=~P0_4;
P0_5=~P0_5;
mdelay(20 );
P0_5=~P0_5;
P0_6=~P0_6;
mdelay(20 );
P0_6=~P0_6;
P0_7=~P0_7;
mdelay(20 );
P0_7=~P0_7;
}
}
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>