keil错误C(3): error C141: syntax error near ';' TEXT1.C(8): error C129: missing ';'before 'count'
下面是程序:请各位前辈高手帮忙看看哪里错了啊,改了一晚上还没弄好啊#include<reg52.H>unsignedcharcodedispbit[]={0x01,0x0...
下面是程序:请各位前辈高手帮忙看看哪里错了啊 ,改了一晚上还没弄好啊
#include<reg52.H>
unsigned char code dispbit[]={0x01,0x02,0x04,0x08};
unsigned char code;
dispcode[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07, 0x7F};
unsigned char disp[8];
unsigned char temp[8];
unsigned char dispcount;
unsigned char T0 count;
unsigned char time count;
void initial();
void delay();
void data display();
bit flag;
sbit key=P3^4;
unsigned long x,freq;
void initial(void)
{
P0=0x3F;
P2=0xFF;
TMOD=0x15;
TH0=0;
TL0=0;
TH1=(65536-4000)/256;
TL1=(65536-4000)%256;
TR1=1;
TR0=1;
ET0=1;
ET1=1;
EA=1;
}
voiddata display()
{
unsignedchar i;
for(i=0;i<4;i++);
{
temp[i]=0;
}
i=0;
while(x/10);
{
temp[i]=x%10;
x=x/10;
i++;
}
temp[i]=x;
for(i=0;i<4;i++);
{
dispbuf[i]=temp[i];
}
for(dispcount=0;dispcount<4;dispcount++);
{
P0=dispcode[dispbuf[dispcount]];
P2=dispbit[dispcount];
Delay();
}
}
voiddelay(unsigned char t)
{
unsigned char k,j;
for(k=0;k<t;k++);
for(j=0;j<125;j++);
}
void t1(void)interrupt 3 using 0
{
TH1=(65536-4000)/256;
TL1=(65536-4000)%256;
Time count++;
freq=T0 count*65536+TH0*256+TL0;
while(timecount==10)
{TR0=0;TR1=0;
}
}
void t0(void)interrupt 1 using 0
{
T0 count++;
}
voidmain(void)
{
while(1)
{
if(key==1)
{
Time count=0;
T0 count=0;
initial();
}
else
{
x=freq;
x=x*20;
data display();
}
}
}
实在没有财富值了都用完了剩下的都奉献上了 真的是没办法啊 求帮忙啊 展开
#include<reg52.H>
unsigned char code dispbit[]={0x01,0x02,0x04,0x08};
unsigned char code;
dispcode[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07, 0x7F};
unsigned char disp[8];
unsigned char temp[8];
unsigned char dispcount;
unsigned char T0 count;
unsigned char time count;
void initial();
void delay();
void data display();
bit flag;
sbit key=P3^4;
unsigned long x,freq;
void initial(void)
{
P0=0x3F;
P2=0xFF;
TMOD=0x15;
TH0=0;
TL0=0;
TH1=(65536-4000)/256;
TL1=(65536-4000)%256;
TR1=1;
TR0=1;
ET0=1;
ET1=1;
EA=1;
}
voiddata display()
{
unsignedchar i;
for(i=0;i<4;i++);
{
temp[i]=0;
}
i=0;
while(x/10);
{
temp[i]=x%10;
x=x/10;
i++;
}
temp[i]=x;
for(i=0;i<4;i++);
{
dispbuf[i]=temp[i];
}
for(dispcount=0;dispcount<4;dispcount++);
{
P0=dispcode[dispbuf[dispcount]];
P2=dispbit[dispcount];
Delay();
}
}
voiddelay(unsigned char t)
{
unsigned char k,j;
for(k=0;k<t;k++);
for(j=0;j<125;j++);
}
void t1(void)interrupt 3 using 0
{
TH1=(65536-4000)/256;
TL1=(65536-4000)%256;
Time count++;
freq=T0 count*65536+TH0*256+TL0;
while(timecount==10)
{TR0=0;TR1=0;
}
}
void t0(void)interrupt 1 using 0
{
T0 count++;
}
voidmain(void)
{
while(1)
{
if(key==1)
{
Time count=0;
T0 count=0;
initial();
}
else
{
x=freq;
x=x*20;
data display();
}
}
}
实在没有财富值了都用完了剩下的都奉献上了 真的是没办法啊 求帮忙啊 展开
1个回答
展开全部
你这程序问题也太多了,表面上是提示这两行,可以改了这两行后,随之又出现更多的错误。大体是这么几类:变量名T0 count,两个单词之间不能有空格,可以用下划线,改成T0_count
还有 time count, 也要加下划线: time_count,大小写字母是有区别的,改在Time_count.子程序名
data display(),同样两个单词之间不能有空格,要么连上,要么用下划线,如datadisplay(),或者就用display()定义,何必加个data。还有就不一一列举了,给你改好的,编译通过的,自己看吧。
#include<reg52.H>
unsigned char code dispbit[]={0x01,0x02,0x04,0x08};
unsigned char code dispcode[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07, 0x7F};//中间多;
unsigned char dispbuf[8]; //变量名与程序中的不符
unsigned char temp[8];
unsigned char dispcount;
unsigned char T0_count; //两个单词之间不能有空格
unsigned char Time_count; //两个单词之间不能有空格
void initial();
void delay(unsigned char t); //括号内缺少变量说明
void datadisplay();
bit flag;
sbit key=P3^4;
unsigned long x,freq;
void initial(void)
{
P0=0x3F;P2=0xFF;TMOD=0x15;
TH0=0;TL0=0;
TH1=(65536-4000)/256;
TL1=(65536-4000)%256;
TR1=1;TR0=1;
ET0=1;ET1=1;EA=1;
}
void datadisplay()
{unsigned char i; //空格
for(i=0;i<4;i++);
{temp[i]=0;}i=0;
while(x/10);
{
temp[i]=x%10;
x=x/10; i++;
}
temp[i]=x;
for(i=0;i<4;i++);
{ dispbuf[i]=temp[i];
}
for(dispcount=0;dispcount<4;dispcount++);
{
P0=dispcode[dispbuf[dispcount]];
P2=dispbit[dispcount];delay(10);//delay(10)要代实参,那个实参形自己调整大小
}
}
void delay(unsigned char t)
{unsigned char k,j;
for(k=0;k<t;k++);
for(j=0;j<125;j++);
}
void t1(void)interrupt 3 using 0
{
TH1=(65536-4000)/256;
TL1=(65536-4000)%256;
Time_count++; //两个单词之间不能有空格
freq=T0_count*65536+TH0*256+TL0; //两个单词之间不能有空格
while(Time_count==10) //两个单词之间不能有空格
{
TR0=0;TR1=0;
}
}void t0(void)interrupt 1 using 0
{
T0_count++;} //两个单词之间不能有空格
void main(void)
{
while(1)
{
if(key==1)
{
Time_count=0; //两个单词之间不能有空格
T0_count=0; //两个单词之间不能有空格
initial();}
else
{
x=freq; x=x*20;
datadisplay();
}
}
}
还有 time count, 也要加下划线: time_count,大小写字母是有区别的,改在Time_count.子程序名
data display(),同样两个单词之间不能有空格,要么连上,要么用下划线,如datadisplay(),或者就用display()定义,何必加个data。还有就不一一列举了,给你改好的,编译通过的,自己看吧。
#include<reg52.H>
unsigned char code dispbit[]={0x01,0x02,0x04,0x08};
unsigned char code dispcode[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07, 0x7F};//中间多;
unsigned char dispbuf[8]; //变量名与程序中的不符
unsigned char temp[8];
unsigned char dispcount;
unsigned char T0_count; //两个单词之间不能有空格
unsigned char Time_count; //两个单词之间不能有空格
void initial();
void delay(unsigned char t); //括号内缺少变量说明
void datadisplay();
bit flag;
sbit key=P3^4;
unsigned long x,freq;
void initial(void)
{
P0=0x3F;P2=0xFF;TMOD=0x15;
TH0=0;TL0=0;
TH1=(65536-4000)/256;
TL1=(65536-4000)%256;
TR1=1;TR0=1;
ET0=1;ET1=1;EA=1;
}
void datadisplay()
{unsigned char i; //空格
for(i=0;i<4;i++);
{temp[i]=0;}i=0;
while(x/10);
{
temp[i]=x%10;
x=x/10; i++;
}
temp[i]=x;
for(i=0;i<4;i++);
{ dispbuf[i]=temp[i];
}
for(dispcount=0;dispcount<4;dispcount++);
{
P0=dispcode[dispbuf[dispcount]];
P2=dispbit[dispcount];delay(10);//delay(10)要代实参,那个实参形自己调整大小
}
}
void delay(unsigned char t)
{unsigned char k,j;
for(k=0;k<t;k++);
for(j=0;j<125;j++);
}
void t1(void)interrupt 3 using 0
{
TH1=(65536-4000)/256;
TL1=(65536-4000)%256;
Time_count++; //两个单词之间不能有空格
freq=T0_count*65536+TH0*256+TL0; //两个单词之间不能有空格
while(Time_count==10) //两个单词之间不能有空格
{
TR0=0;TR1=0;
}
}void t0(void)interrupt 1 using 0
{
T0_count++;} //两个单词之间不能有空格
void main(void)
{
while(1)
{
if(key==1)
{
Time_count=0; //两个单词之间不能有空格
T0_count=0; //两个单词之间不能有空格
initial();}
else
{
x=freq; x=x*20;
datadisplay();
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询