KEIL 编程求救
本程序用的是AT89S52,程序警告以及源程序如下:
警告:
源程序如下:
#include <reg52.h>
#define uint unsigned intsbit zuohw=P1^3;
sbit youhw=P1^2;
sbit youdetect=P1^4;
sbit zuodetect=P1^5;
sbit zuo=P1^1;
sbit you=P1^0;
uint n=0,m=0;
void delay_nus(uint nus) //延时1us程序
{
nus=nus/10;
while(--nus);
}
void init() //T0,T1中断初始化
{
TMOD=0x11;
TH1=0xfe;
TL1=0x73;
TH0=0xfc;
TL0=0xe6;
ET1=1;
ET0=1;
EA=1;
TR1=1;
TR0=1;
}
void hongwai() //发射38.5KHz红外线程序,周期为26us
{
m=0;
while(1)
{
zuohw=1;
delay_nus(12);
zuohw=0;
youhw=1;
youhw=0;
delay_nus(13);
if(m==1)
break;
}
}
void servo_speed(int left,int right)//单独控制左右轮前进速度,赋值范围-20——20
{
m=0;
n=0;
while(1)
{
if(n<=(30-left))
zuo=1;
else
zuo=0;
if(n<=(30+right))
you=1;
else
you=0;
if(m==100) //当time为20时,左右轮产生一个脉冲
break;
}
hongwai();
}
void servo_forward() //无障碍物,前进
{
while(1)
{
if(youdetect|zuodetect==1)
break;
else continue;
servo_speed(20,20);
}
}
void servo_backward()//单独控制左右轮前进速度,赋值范围-20——20
{
while(1)
{
if(youdetect&zuodetect==1)
continue;
else break;
servo_speed(-20,-20);
}
}
void servo_leftobstacle() //左侧有障碍物
{
while(1)
{
if(youdetect==1)
continue;
else break;
servo_speed(20,10); //左侧有障碍物,右转
}
}
void servo_rightobstacle() //右侧有障碍物,左转
{
while(1)
{
if(zuodetect==1)
continue;
else break;
servo_speed(10,20); //右侧有障碍物,右转
}
}
void main()
{
init();
while(1)
{
servo_forward();//前进并红外探测
servo_backward(); //检测到前方有障碍物,后退病继续探测
servo_leftobstacle();//左侧有障碍物,右转
servo_rightobstacle(); //右侧有障碍物,左转
}
}
void t1() interrupt 3 //50us定时
{
TH1=0xff;
TL1=0xd8;
n++;
if(n==400)
n=0;
}
void t0() interrupt 1 //定时1ms
{
TH0=0xfc;
TL0=0xe6;
m++;
}
求解为何会产生这样的警告!万分感谢!