標(biāo)題:
error C141: syntax error near 'unsigned'
[打印本頁]
作者:
beautifulfish
時(shí)間:
2020-12-23 15:09
標(biāo)題:
error C141: syntax error near 'unsigned'
求大佬幫看看這個(gè)程序怎么改嗎?謝謝各位了!
報(bào)錯(cuò)的內(nèi)容是:011.c(99): error C141: syntax error near 'unsigned'
代碼如下:
#include<reg51.h>
sbit A1=P1^0;
sbit B1=P1^1;
sbit C1=P1^2;
sbit D1=P1^3;
#define WDM P0
#define KeyP3 P3
sbit DuanSuo=P2^2;
sbit WeiSuo=P2^3;
unsigned char Speed=1;
bit StopFlag=1;
unsigned char code DWtable[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
unsigned char code WMtable[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char TData[8];
#define A_ON {A1=1;B1=0;C1=0;D1=0;}
#define B_ON {A1=0;B1=1;C1=0;D1=0;}
#define C_ON {A1=0;B1=0;C1=1;D1=0;}
#define D_ON {A1=0;B1=0;C1=0;D1=1;}
#define AB_ON {A1=1;B1=1;C1=0;D1=0;}
#define BC_ON {A1=0;B1=1;C1=1;D1=0;}
#define CD_ON {A1=0;B1=0;C1=1;D1=1;}
#define DA-ON {A1=1;B1=0;C1=0;D1=1;}
#define ABCD_OFF {A1=0;B1=0;C1=0;D1=0;}
void DelayUs(unsigned char tu)
{
while(--tu);
}
void DelayMs(unsigned char tm)
{
while(tm--);
{
DelayUs (248);
DelayUs (248);
}
}
void Display(unsigned char ShiWei,unsigned char WeiShu)
{
static unsigned char i;
WDM=WMtable[i+ShiWei];
WeiSuo=1;
WeiSuo=0;
WDM=TData[i];
DuanSuo=1;
DuanSuo=0;
i++;
if(i==WeiShu)
{
i=0;
}
}
void T0Int_S (void)
{
TMOD=0X01;
TH0=0;
TL0=0;
EA=1;
ET0=1;
TR0=1;
}
void T0Int_Z (void) interrupt 1
{
static unsigned char times,i;
TH0=(65536-2000)/256;
TL0=(65536-2000)%256;
Display(0,8);
if(StopFlag==0)
{
if(times==(20-Speed))
{
times=0;
switch(i)
{
case 0:A_ON;i++;break;
case 1:B_ON;i++;break;
case 2:C_ON;i++;break;
case 3:D_ON;i++;break;
case 4:i=0;break;
default:break;
}
}
times++;
}
unsigned char KeyS(void)//報(bào)錯(cuò)的是這行,應(yīng)該怎么改,謝謝!
{
unsigned char keyZ;
if(KeyP3!=0xff)
{
DelayMs(10);
if(KeyP3!=0Xff)
{
keyZ=KeyP3;
while(KeyP3!=0xff);
switch(keyZ)
{
case 0xfe:return 1;break;
case 0xfd:return 2;break;
case 0xfb:return 3;break;
case 0xf7:return 4;break;
case 0xef:return 5;break;
case 0xdf:return 6;break;
case 0xbf:return 7;break;
case 0x7f:return 8;break;
default:return 0;break;
}
}
}
return 0;
}
void main()
{
unsigned char num;
T0Int_S();
ABCD_OFF
while(1)
{
num=KeyS();
if(num==1)
{
if(Speed<18)
Speed++;
}
else if(num==2)
{
if(Speed>1)
Speed--;
}
else if(num==3)
{
ABCD_OFF
StopFlag=1;
}
else if(num==4)
{
StopFlag=0;
}
TData[0]=DMtable[Speed/10];
TData[1]=DMtable[Speed%10];
}
}
復(fù)制代碼
作者:
beautifulfish
時(shí)間:
2020-12-23 15:40
我解決了,是因?yàn)樽兞慷x要放在最前頭,打擾了各位了
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1