怎么编译时老是有错误,求高人指点
#include <intrins.h>
#define RX P0_0
#define TX P0_1
#define BEEP P0_2
unsigned int time=0;
unsigned int timer=0;
unsigned char posit=0;
unsigned int k;
bit flag_beep;
unsigned long S=0;
bit flag =0;
unsigned char const discode[] ={0x05,0xDD,0x46,0x54,0x9C,0x34,0x24,0x5D,0x04,0x14,0xfe};
unsigned char const positon[4]={ 0x04,0x10,0x40,0x80};
unsigned char disbuff[4] ={ 0,0,0,0,};
void DIDI();
void Display(void) //扫描数码管
{
if(posit==0)
{P2=(discode[disbuff[posit]])&0xfb;}
else
{P2=discode[disbuff[posit]];}
P1=~positon[posit];
if(++posit>=4)
posit=0;
}
void Conut(void)
{
time=TH0*256+TL0;
TH0=0;
TL0=0;
//time=23529;
S=(time*0.17); //算出来是CM
if((S>=7000)||flag==1) //超出测量范围显示“-”
{
flag=0;
flag_beep=0;
disbuff[0]=10; //“-”
disbuff[1]=10; //“-”
disbuff[2]=10; //“-”
disbuff[3]=10; //“-”
BEEP=1;
}
else
{
disbuff[0]=S/1000;
disbuff[1]=S/100%10;
disbuff[2]=S/10%10;
disbuff[3]=S%10;
}
}
void zd0() interrupt 1 //T0中断用来计数器溢出,超过测距范围
{
flag=1; //中断溢出标志
}
void zd3() interrupt 3 //T1中断用来扫描数码管和计800 ms启动模块
{
TH1=0xf8;
TL1=0x30;
Display();
DIDI();
timer++;
if(timer>=400)
{
timer=0;
TX=1; //800 ms 启动一次模块
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
TX=0;
}
}
void main( void )
{
TMOD=0x11; //设T0为方式1,GATE=1;
TH0=0;
TL0=0;
TH1=0xf8; //2 MS定时
TL1=0x30;
ET0=1; //允许T0中断
ET1=1; //允许T1中断
TR1=1; //开启定时器
EA=1; //开启总中断
while(1)
{
while(!RX); //当RX为零时等待
TR0=1; //开启计数
while(RX); //当RX为1计数并等待
TR0=0; //关闭计数
Conut(); //计算
}
}
void DIDI()
{
if(S<1000)
{
BEEP=0;
}
else
{
k++;
// if(k>=500)
// {
// k=0;
// flag_beep=!flag_beep;
//}
if((S>=1000)&&(S<2000))//1 m~2 m
{
if(k>=500)
{
k=0;
flag_beep=!flag_beep;
}
}
if((S>=2000)&&(S<3000))//2 m~3 m
{
if(k>=300)
{
k=0;
flag_beep=!flag_beep;
}
}
if((S>=3000)&&(S<4000))//3 m~4 m
{
if(k>=200)
{
k=0;
flag_beep=!flag_beep;
}
}
if((S>=4000)&&(S<=5000))//4 m~5 m
{
if(k>=100)
{
k=0;
flag_beep=!flag_beep;
}
}
if(flag_beep)
BEEP=0;
else
BEEP=1;
}
}
把错误提示也发出来啊,提问也要描述清楚啊
初学 求高人指点
CODE.C(1): warning C500: MISSING DEVICE (SECURITY KEY NOT FOUND)
CODE.C(10): error C100: unprintable character 0xA1 skipped
CODE.C(10): error C100: unprintable character 0xA1 skipped
CODE.C(10): error C100: unprintable character 0xA1 skipped
CODE.C(10): error C100: unprintable character 0xA1 skipped
CODE.C(42): error C202: 'P0_2': undefined identifier
CODE.C(67): error C202: 'P0_1': undefined identifier
CODE.C(89): error C202: 'P0_1': undefined identifier
CODE.C(108): error C202: 'P0_0': undefined identifier
CODE.C(110): error C202: 'P0_0': undefined identifier
CODE.C(121): error C202: 'P0_2': undefined identifier
CODE.C(164): error C202: 'P0_2': undefined identifier
CODE.C(166): error C202: 'P0_2': undefined identifier
Target not created
你这错误也太多了啊,很多很低级啊
#define RX P0_0 有这样的定义吗?
P0_0在单片机中怎么识别啊,P0^0这样才行啊
基础不过关,先去补补吧