写的yy应用程序出错中一直出错,"undefined identifier",怎么弄啊?!

VC &&&&最新内容
VC &&&&随机内容在keil中编译以下程序时出现所有定义变量都是undefined identifier是什么原因啊? 急!!_百度知道
在keil中编译以下程序时出现所有定义变量都是undefined identifier是什么原因啊? 急!!
#include&reg51.h&#define uchar unsigned char#define uint unsigned intsbit lcdrs =p3^0;sbit lcdrw =p3^1;sbit lcden=p3^2;sbit d1=p1^0;sbit d2=p1^1;uchar code t0[]=&the temperature&;uchar code t1[]=&is
&;uchar code wendu[]=&&;//乱码sbit DQ=p3^7;//定义ds18b20总线IO//液晶显示模块void delay(uint z){
for (x=100;x&1;x--)
for (y=z;y&1;y--);供海垛剿艹济讹汐番搂}void write_com(uchar com){
lcden=0;}void write_date(uchar date){ lcdrs=1; p2= delay(5);
lcden=0;}void init_lcd(){ lcden=0; lcdrw=0;write_com(0x38);write_com(0x01);write_com(0x0c);write_com(0x06);write_com(0x80);for (i=0;i&16;i++){
write_date(t0[i]);
delay(0);}write_com(0x80+0x40);for(i=0;i&16;i++){write_date(t1[i]);delay(0);}}//温度采集模块void tmpDelay(int num)//延时函数{while(num--);}void Init_DS18B20()//初始化DS1820{unsigned char x=0;DQ=1;//DQ复位tmpDelay(8);//稍作延时DQ=0;//单片机将DQ拉低tmpDelay(80);//精确延时 大于480usDQ=1;//拉高总线tmpDelay(14);x=DQ;tmpDelay(20);}unsigned char ReadOneChar()//读一个字节{unsigned char i=0;unsigned char dat=0;for(i=8;i&0;i--){DQ=0;//给脉冲信号dat&&=1;DQ=1;//给脉冲信号if(DQ)dat|=0x80;tmpDelay(4);}return(dat);}void WriteOneChar(unsigned char dat)//写一个字节{unsigned char i=0;for (i=8;i&0;i--){DQ=0;DQ=dat&0x01;tmpDelay(5);DQ=1;dat&&1;}}unsigned int Readtemp()//读取温度{unsigned char a=0;unsigned char b=0;unsigned int t=0;float tt=0;Init_DS18B20();WriteOneChar(0xCC);//跳过读序列号的操作WriteOneChar(0x44);//启动温度转换Init_DS18B20();WriteOneChar(0xCC);//跳过列号的操作WriteOneChar(0xBE);//读取温度寄存器a=ReadOneChar();//连续读两个字节数据//读低八位b=ReadOneChar();//高八位t=b;t&&=8;t=t|a;//两字节合成一个整型变量tt=t*0.0625;//得到真实十进制温度值,因为DS18B20可以精确到0.0625度,所以读回数据的最低位代表是0.0625度t=tt*10+0.5;//放大十,这样做的目的将小数点后第一位也转换为可显示数字,同时进行一个四舍五入操作return(t);}void display(){unsigned int num,num1;unsigned int shi,ge,num=Readtemp();num1=num/10;if(num1&37){d1=0;d2=1;delay(500);}if(num1&10){d1=1;d2=0;delay(500);}else{d1=1;d2=1;}shi=num/100;ge=num/10%10;xiaoshu=num%10;write_com(0x80+0x40+5);write_date(wendu[shi]);write_com(0x80+0x40+6);write_date(wendu[ge]);write_com(0x80+0x40+7);write_date(0x2e);write_com(0x80+0x40+8);write_date(wendu[xiaoshu]);}void main(){init_lcd();while(1){display();delay(10);}}
//没问题了,你的P口应该用大写。#include&reg51.h&#define uchar unsigned char#define uint unsigned intsbit lcdrs =P3^0;sbit lcdrw =P3^1;sbit lcden=P3^2;sbit d1=P1^0;sbit d2=P1^1;uchar code t0[]=&the temperature&;uchar code t1[]=&is
&;uchar code wendu[]=&&;//乱码sbit DQ=P3^7;//定义ds18b20总线IO//液晶显示模块void delay(uint z){
for (x=100;x&1;x--)
for (y=z;y&1;y--);}void write_com(uchar com){
lcden=0;}void write_date(uchar date){ lcdrs=1; P2= delay(5);
lcden=0;}void init_lcd(){ lcden=0; lcdrw=0;write_com(0x38);write_com(0x01);write_com(0x0c);write_com(0x06);write_com(0x80);for (i=0;i&16;i++){
write_date(t0[i]);
delay(0);}write_com(0x80+0x40);for(i=0;i&16;i++){write_date(t1[i]);delay(0);}}//温度采集模块void tmpDelay(int num)//延时函数{while(num--);}void Init_DS18B20()//初始化DS1820{unsigned char x=0;DQ=1;//DQ复位tmpDelay(8);//稍作延时DQ=0;//单片机将DQ拉低tmpDelay(80);//精确延时 大于480usDQ=1;//拉高总线tmpDelay(14);x=DQ;tmpDelay(20);}unsigned char ReadOneChar()//读一个字节{unsigned char i=0;unsigned char dat=0;for(i=8;i&0;i--){DQ=0;//给脉冲信号dat&&=1;DQ=1;//给脉冲信号if(DQ)dat|=0x80;tmpDelay(4);}return(dat);}void WriteOneChar(unsigned char dat)//写一个字节{unsigned char i=0;for (i=8;i&0;i--){DQ=0;DQ=dat&0x01;tmpDelay(5);DQ=1;dat&&1;}}unsigned int Readtemp()//读取温度{unsigned char a=0;unsigned char b=0;unsigned int t=0;float tt=0;Init_DS18B20();WriteOneChar(0xCC);//跳过读序列号的操作WriteOneChar(0x44);//启动温度转换Init_DS18B20();WriteOneChar(0xCC);//跳过列号的操作WriteOneChar(0xBE);//读取温度寄存器a=ReadOneChar();//连续读两个字节数据//读低八位b=ReadOneChar();//高八位t=b;t&&=8;t=t|a;//两字节合成一个整型变量tt=t*0.0625;//得到真实十进制温度值,因为DS18B20可以精确到0.0625度,所以读回数据的最低位代表是0.0625度t=tt*10+0.5;//放大十,这样做的目的将小数点后第一位也转换为可显示数字,同时进行一个四舍五入操作return(t);}void display(){unsigned int num,num1;unsigned int shi,ge,num=Readtemp();num1=num/10;if(num1&37){d1=0;d2=1;delay(500);}if(num1&10){d1=1;d2=0;delay(500);}else{d1=1;d2=1;}shi=num/100;ge=num/10%10;xiaoshu=num%10;write_com(0x80+0x40+5);write_date(wendu[shi]);write_com(0x80+0x40+6);write_date(wendu[ge]);write_com(0x80+0x40+7);write_date(0x2e);write_com(0x80+0x40+8);write_date(wendu[xiaoshu]);}void main(){init_lcd();while(1){display();delay(10);}}
来自团队:
其他类似问题
为您推荐:
keil的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁使用keil uvision4写程序时,总是提示这样的错误_嵌入式吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:32,672贴子:
使用keil uvision4写程序时,总是提示这样的错误收藏
我自己写程序时候,总是出现 error C202: 'P2_2': undefined identifier和warning C317: attempt to redefine macro 'stop'
这到底是怎么回事?该怎样解决啊?而且,我把头文件也放进电脑了。
P2_2没定义,,你是不是定义了两个stop?
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或小木虫 --- 500万硕博科研人员喜爱的学术科研平台
&&查看话题
用keil写程序,不会做,毕设要用,主程序不会写,子程序也有错,求帮忙
#include&reg51.h&
#include&intrins.h&
#define uchar unsigned char
#define uint unsigned int
uchar code table={0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39};
uchar code tab=&Shenyangligong&&University&;
uchar code table1=&Gas&&strength0.5%&;
sbit lcdrs=P3^0;& &
sbit lcdrw=P3^1;
sbit lcden=P3^2;
sbit start=P3^4;
sbit eoc=P3^3;& & & &&&
sbit oe=P3^5;
sbit CLK=P3^6;
uchar shi,ge,shi1,bai1,
void delay(uint z)
& & & & uint x,y;
& & & & for(x=z;x&0;x--)
& & & & & & & & for(y=110;y&0;y--);
void dely500(void)
& & & & for(i=250;i&0;i--)
& & & & & & & & _nop_();
void write_com(uchar com)
& & & & lcdrs=0;
& & & & P1=
& & & & delay(1);
& & & & lcden=1;
& & & & delay(1);
& & & & lcden=0;
void write_data(uchar date)
& & & & lcdrs=1;
& & & & P1=
& & & & delay(1);
& & & & lcden=1;
& & & & delay(1);
& & & & lcden=0;
void init()& & & && &
& & & & oe=0;
& & & & lcden=0;
& & & & lcdrw=0;
& & & & write_com(0x38);
& & & & write_com(0x0c);
& & & & write_com(0x06);
& & & & write_com(0x01);
& & & & write_com(0x80);
& & & & temp=0;
& & & & TMOD=0x01;
& & & & TH0=()/256;
& & & & TL0=()%256;
& & & & EA=1;
& & & & ET0=1;
& & & & TR0=1;
void voltage(uchar ge,uchar shi,uchar bai1)
& & & & & & & & shi=temp/1000;
& & & & & & & & ge=temp%;
& & & & & & & & shi1=temp%100/10;
& & & & & & & & bai1=temp%10;
& & & & & & & & write_com(0x80);
& & & & & & & & for(num=0;num&16;num++)
& & & & & & & & {
& & & & & & & & & & & & write_data(tab);
& & & & & & & & }
& & & & & & & & write_com(0xc0);
& & & & & & & & for(num=0;num&6;num++)
& & & & & & & & {
& & & & & & & & & & & & write_data(table1);
& & & & & & & & }
& & & & & & & & write_com(0xc7);
& & & & & & & & write_data(table);
& & & & & & & & delay(1);
& & & & & & & & write_com(0xc8);
& & & & & & & & write_data(table);
& & & & & & & & delay(1);
& & & & & & & & write_com(0xc9);
& & & & & & & & write_data('.');
& & & & & & & & delay(1);
& & & & & & & & write_com(0xca);
& & & & & & & & write_data(table);
& & & & & & & & delay(1);
& & & & & & & & write_com(0xcb);
& & & & & & & & write_data(table);
& & & & & & & & delay(1);
& & & & & & & & write_com(0xcc);
& & & & & & & & for(num=0;num&2;num++)
& & & & & & & & {
& & & & & & & & & & & & write_data(table1);
& & & & & & & & }
& & & & & & & & start=0;
& & & & & & & & start=1;
& & & & & & & & start=0;
& & & & & & & & while(!eoc);& & & &
& & & & & & & & oe=1;
& & & & & & & & temp=P2;
& & & & & & & & oe=0;
& & & & & & & & temp=(temp*2*1*98.);
& & & & & & & & if(temp&=200)
& & & & & & & & {
& & & & & & & & & & & & for(count=200;count&0;count--)
& & & & & & & & & & & & {
& & & & & & & & & & & & & & & & P0_7=~P0_7;
& & & & & & & & & & & & & & & & dely500();
& & & & & & & & & & & & }
& & & & & & & & & & & & for(count=200;count&0;count--)
& & & & & & & & & & & & {
& & & & & & & & & & & & & & & & P0_7=~P0_7;
& & & & & & & & & & & & & & & & dely500();
& & & & & & & & & & & & & & & & dely500();
& & & & & & & & & & & & }
& & & & & & & & }
void timer0() interrupt 1
& & & & TH0=()/256;
& & & & TL0=()%256;
& & & & CLK=~CLK;& & & &
void main()
& & & & init();
& && & & & while(1)
& && & & & { & & & &
& & & & & & & & voltage(ge,shi,bai1);
Build target 'Target 1'
compiling wasi.c...
wasi.c(129): error C202: 'P0_7': undefined identifier
wasi.c(135): error C202: 'P0_7': undefined identifier
Target not created.
是用LCD1602显示?没看说明rs,rw,en三个端口的使用意思要去了解
研究生必备与500万研究生在线互动!
扫描下载送金币

我要回帖

更多关于 kindle应用程序出错 的文章

 

随机推荐