发布时间:2019-08-09 02:58:27
求解一下这是错误 SANLU.C(33): error C141: syntax error near 'char', expected ')'
程序是:
#include"reg51.h" //包括一个51标准内核的头文件
#include "ABSACC.H" //库函数
#define a8255_PA XBYTE[0xD1FF] /*PA 口地址*/
#define a8255_PB XBYTE[0xD2FF] /*PB 口地址*/
#define a8255_PC XBYTE[0xD5FF] /*PC 口地址*/
#define a8255_CON XBYTE[0xD7FF] /*控制字 地址*/
unsigned char Timer_Count=0; //定义变量
unsigned char second=9;
unsigned char light;
unsigned char const num_table[16]= {
0xA0, /*0*/
0xBB, /*1*/
0x62, /*2*/
0x2A, /*3 */
0x39, /*4*/
0x2C, /*5 */
0x24, /*6*/
0xBA, /*7*/
0x20, /*8*/
0x28, /*9 */
0x30, /*A*/
0x25, /*B*/
0xE4,/*C*/
0x23,/*D*/
0x64,/*E*/
0x74,/*F*/
};
void Timer1_Init(void); //函数声明
void GInt_Init(void);
void delay (unsigned int x);
void display (unsigned char placeunsigned char number) ;
unsigned char keyboard();
main() //主程序
{unsigned char flag=0;
light=0xc0;
Timer1_Init();//定时器工作模式设定及初始化
while(1) //主程序循环
{ GInt_Init(); //函数叼用(打开中断及相应的设定)
P1=light;
_display(6,second);
if(second==0)
{second=0x09;
TR1=0;
light=0x7f;
}
flag=keyboard();
if(light==0x3f)
{switch(flag)
{case 1: light= 0xfd,TR1=1; break;
case 2: light= 0xf7, TR1=1 ; break;
case 3:light=0xdf, TR1=1; break;
default : light =0x3f;}
}
if(light==0x7f)
{ switch(flag)
{case 1: light=0xfe; break;
case 2:light=0xfb; break;
case 3:light= 0xef; break;
default : light =0x7f;}
}
}
}
void GInt_Init(void) //打开中断及相应的设定
{ EA = 1;
EX0 = 1;
IT0 = 1;
EX1= 1;
IT1 = 1;
ET1=1;
}
void ISR_Ex0(void) interrupt 0 //外中断 0
{light=0x7f;}
void ISR_Ex1(void) interrupt 2 //外中断?1
{light&=0xbf;}
void Timer1_Init(void) //定时器工作模式设定及初始化
{ TMOD=0x10;
TH1=(65535-50000)/256;
TL1=(65535-50000)%256;
}
void ISR_Timer1(void) interrupt 3 //1秒时间的设定
{Timer_Count++;
if(Timer_Count== 20)
{Timer_Count= 0;
second--; }
Timer1_Init();}
void delay(unsigned int x)//延时
{unsigned char i,j,k;
while(x--)
{ for(i=0;i<=5;i++)
for(j=0;j<=10;j++)
; }
}void display(unsigned char place, unsigned char number)//显示
{ a8255_CON=0x89;
a8255_PA=0xff;
a8255_PB=0xff;
a8255_PA=~(0x01<<(place-1));
a8255_PB=num_table[number];
}
unsigned char keyboard()//键盘
{unsigned char PC_data;
unsigned char j;
unsigned char y=0;
a8255_CON=0x89;
a8255_PA=0xf1;
a8255_PB=0xff;
delay(1);
PC_data=a8255_PC;
for(j =0;j<4;j++)
{if((PC_data&(1<<j))== (1<<j))
y=j+1;}
return(y);}
你的
void display (unsigned char placeunsigned char number) ;
中间少逗号了,正确的
void display (unsigned char placeunsigned ,char number) ;
另外,你的
_display(6,second);
前面多下划线了
最后
{unsigned char i,j,k;
的k也是多余的
删除它们后程序可以编译