错误提示:syntax error near 'sfr'是怎么回事?
*************************************************************
#include<reg52.h>
sbit P1_1=P1^1;
sbit P1_0=P1^0;
sbit LEFTDETECT=P1^2;
sbit RIGHTDETECT=P3^5;
sbit LEFTLAUNCH=P1^3;
sbit RIGHTLAUNCH=P3^6;
#define KpL -70
#define KpR 70
#define SetPoint 2 //暂定值,根据实际情况要改的
#define CenterPulse 1500
unsigned int time;//全局变量
int leftdistance,rightdistance; //左边和右边距离
int delaycount,distanceleft,distanceright,irdetectleft,irdetectright;//这四个定义的我好像没用到
unsigned int frequency[5]={29370,31230,33050,35700,38460};
void delay_nus(unsigned int i)
{
i=i/10;
while(--i);
}
void delay_nms(unsigned int n)
{
n=n+1;
while(--n)
delay_nus(900);
}
void initial(void) //串口初始化
{
IE=0x82;
TCON=0x00;
TMOD=0x01;
}
void frequencyout(unsigned int frequency)
{
time=256-(50000/frequency);
TH0=0xff;//不参与计数
TL0=time;
TR0=1;
delay_nus(800);
TR0=0;
}
void timer0_interrupt(void)interrupt 1
{
LEFTLAUNCH=~LEFTLAUNCH;
RIGHTLAUNCH=~RIGHTLAUNCH;
TH0=0xff;
TL0=time;
}
void get_distances()
{
unsigned char count;
leftdistance=0;
rightdistance=0;
for(count=0;count<5;count++)
{
frequencyout(frequency[count]);
if(LEFTDETECT==1)
leftdistance++;
if(RIGHTDETECT==1)
rightdistance++;
}
}
void send_pulse(unsigned int pulseleft,unsigned int pulseright)
{
P1_1=1;
delay_nus(pulseleft);
P1_1=0;
P1_0=1;
delay_nus(pulseright);
P1_0=0;
delay_nms(18);
}
int main(void)
{
unsigned int pulseleft,pulseright;
initial();
while(1)//为了能够90秒时停,此处需修改
{
get_distances();
pulseleft=(SetPoint-leftdistance)*KpL+CenterPulse;
pulseright=(SetPoint-rightdistance)*KpR+CenterPulse;
send_pulse(pulseleft,pulseright);
}
}
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&7错误提示:syntax error near 'sfr'是怎么回事?