#include <at89x52.h>
void DELAY() //延时函数
{ unsigned char i,j;
for(i=0;i<250;i++)
{
for(j=0;j<200;j++);
}
}
void main() //程序从这里开始执行
{
while(1) //这句的作用就是反复的执行下面这个{}中包含的4句
{
P1_0=1; //(1)熄灭灯
DELAY(); //(2)延时一段时间
P1_0=0; //(3)点亮灯
DELAY(); //(4)延时一段时间
}
}
这一句把上面的i,for(i=0;i<250;i++)删掉改成
#include<reg51.h>
sbit P1_0=P1^0;
void DELAY() //延时函数
{ unsigned char i;
for(i=0;i<250;i++)
}
void main() //程序从这里开始执行
{
while(1) //这句的作用就是反复的执行下面这个{}中包含的4句
{
P1_0=1; //(1)熄灭灯
DELAY(); //(2)延时一段时间
P1_0=0; //(3)点亮灯
DELAY(); //(4)延时一段时间
}
}为什么错误 新手 |