单片机4程序.C(7): error C129: missing ';' before '_at_0x0000'为什么?
#include<reg51.h>#defineucharunsignedchardatauchara,b,j;sbitP3_4=P3^4;sbitP3_5=P3^5;x...
#include<reg51.h>
#define uchar unsigned char
data uchar a,b,j;
sbit P3_4=P3^4;
sbit P3_5=P3^5;
xdata uchar buf1[10]_at_0x0000;
xdata uchar buf2[10]_at_0x2000;
xdata uchar buf3[10]_at_0x4000;
uchar code ;
table[16]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
void delay(k)
data uchar k;
{data uchar m;
while(k--)
for(m=0;m<10;m++);}
void main()
{
data uchar i;
EX1=1;
EA=1;
IT1=1;
while(1)
{for(i=0;i<10;i++) buf1[i]=i+0x10;
for(i=0;i<10;i++) buf2[i]=2*i+0x20;
for(i=0;i<10;i++) buf3[i]=3*i+0x40;
b=P3;
b=b&0x03;
if(b==0)a=buf1[j];
if(b==1)a=buf2[j];
if(b==2)a=buf3[j];
P3_5=0;
P1=table[a/16];
P3_4=1;
delay(5);
P3_4=0;
P1=table[a%16];
P3_5=1;
delay(5);}
}
void int1_isr() interrupt2
{ j++;
if(j==10)j=0;
} 展开
#define uchar unsigned char
data uchar a,b,j;
sbit P3_4=P3^4;
sbit P3_5=P3^5;
xdata uchar buf1[10]_at_0x0000;
xdata uchar buf2[10]_at_0x2000;
xdata uchar buf3[10]_at_0x4000;
uchar code ;
table[16]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
void delay(k)
data uchar k;
{data uchar m;
while(k--)
for(m=0;m<10;m++);}
void main()
{
data uchar i;
EX1=1;
EA=1;
IT1=1;
while(1)
{for(i=0;i<10;i++) buf1[i]=i+0x10;
for(i=0;i<10;i++) buf2[i]=2*i+0x20;
for(i=0;i<10;i++) buf3[i]=3*i+0x40;
b=P3;
b=b&0x03;
if(b==0)a=buf1[j];
if(b==1)a=buf2[j];
if(b==2)a=buf3[j];
P3_5=0;
P1=table[a/16];
P3_4=1;
delay(5);
P3_4=0;
P1=table[a%16];
P3_5=1;
delay(5);}
}
void int1_isr() interrupt2
{ j++;
if(j==10)j=0;
} 展开
2个回答
展开全部
#include<reg51.h>
#define uchar unsigned char
data uchar a,b,j;
sbit P3_4=P3^4;
sbit P3_5=P3^5;
xdata uchar buf1[10] _at_ 0x0000;
xdata uchar buf2[10] _at_ 0x2000;
xdata uchar buf3[10] _at_ 0x4000;
uchar code table[16]={
0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e}
;
void delay(k)data uchar k;
{
data uchar m;
while(k--)for(m=0;
m<10;
m++);
}
void main()
{
data uchar i;
EX1=1;
EA=1;
IT1=1;
while(1){
for(i=0;i<10;i++)
buf1[i]=i+0x10;
for(i=0;i<10;i++)
buf2[i]=2*i+0x20;
for(i=0;i<10;i++)
buf3[i]=3*i+0x40;
b=P3;
b=b&0x03;
if(b==0)a=buf1[j];
if(b==1)a=buf2[j];
if(b==2)a=buf3[j];
P3_5=0;
P1=table[a/16];
P3_4=1;
delay(5);
P3_4=0;
P1=table[a%16];
P3_5=1;
delay(5);
}
}
void int1_isr() interrupt 2
{
j++;
if(j==10)j=0;
}
#define uchar unsigned char
data uchar a,b,j;
sbit P3_4=P3^4;
sbit P3_5=P3^5;
xdata uchar buf1[10] _at_ 0x0000;
xdata uchar buf2[10] _at_ 0x2000;
xdata uchar buf3[10] _at_ 0x4000;
uchar code table[16]={
0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e}
;
void delay(k)data uchar k;
{
data uchar m;
while(k--)for(m=0;
m<10;
m++);
}
void main()
{
data uchar i;
EX1=1;
EA=1;
IT1=1;
while(1){
for(i=0;i<10;i++)
buf1[i]=i+0x10;
for(i=0;i<10;i++)
buf2[i]=2*i+0x20;
for(i=0;i<10;i++)
buf3[i]=3*i+0x40;
b=P3;
b=b&0x03;
if(b==0)a=buf1[j];
if(b==1)a=buf2[j];
if(b==2)a=buf3[j];
P3_5=0;
P1=table[a/16];
P3_4=1;
delay(5);
P3_4=0;
P1=table[a%16];
P3_5=1;
delay(5);
}
}
void int1_isr() interrupt 2
{
j++;
if(j==10)j=0;
}
更多追问追答
追问
大哥,您没帮我解决啊
追答
已经编译通过,
_at_ 左右少了空格,
interrupt 后少空格。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2014-05-11
展开全部
uchar xdata buf1[10] _at_0x0000;
追问
还是不对,还是同样的错误啊
追答
#include<reg51.h>
#define uchar unsigned char
uchar data a,b,j;
sbit P3_4=P3^4;
sbit P3_5=P3^5;
uchar xdata buf1[10] _at_ 0x0000;
uchar xdata buf2[10] _at_ 0x2000;
uchar xdata buf3[10] _at_ 0x4000;
uchar code table[16]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
void delay(k)
data uchar k;
{
data uchar m;
while(k--)
for(m=0;m<10;m++);
}
void main()
{
data uchar i;
EX1=1;
EA=1;
IT1=1;
while(1)
{for(i=0;i<10;i++) buf1[i]=i+0x10;
for(i=0;i<10;i++) buf2[i]=2*i+0x20;
for(i=0;i<10;i++) buf3[i]=3*i+0x40;
b=P3;
b=b&0x03;
if(b==0)a=buf1[j];
if(b==1)a=buf2[j];
if(b==2)a=buf3[j];
P3_5=0;
P1=table[a/16];
P3_4=1;
delay(5);
P3_4=0;
P1=table[a%16];
P3_5=1;
delay(5);}
}
void int1_isr() interrupt 2
{ j++;
if(j==10)j=0;
} 改好了 有些地方缺了空格 不知道你是不是直接复制的
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询