keil 错误 C141: syntax error near '}'怎么解决??
#include<reg51.h>#include<intrins.h>#defineuintunsignedintsbitS1=P1^0;sbitS2=P1^1;sbi...
#include<reg51.h>
#include<intrins.h>
#define uint unsigned int
sbit S1=P1^0;
sbit S2=P1^1;
sbit S3=P1^2;
sbit S4=P1^3;
unsigned char keyval;
void delay(uint i,j)
{
for(i=0;i<100;i++)
for(j=0;j<100;j++)
}
void key_scan()
{
P1=0xff;
if((P1&0x0f)!=0x0f)
{
delay(15);
if(S1==0)
keyval=1;
if(S2==0)
keyval=2;
if(S3==0)
keyval=3;
if(S4==0)
keyval=4;
}
}
void main()
{
keyval=0;
while(1);
{
key_scan();
switch(keyval)
{
case 1 :blink();break;
case 2 :extinguish();break;
case 3 :forward();break;
case 4 :backward();break;
}
}
}
void blink()
{
for(i=0;i<2;i++)
{
P1=0x00;
delay();
P1=0xff;
delay();
}
while(1)
{
P1=0xaa;
delay();
P1=0x55;
delay();
}
}
void extinguish()
{
while(1)
P1=0xff;
}
void forward()
{
P1=0xfe;
while(1)
{
delay();
P1=_crol_(P1,1);
}
}
void backward()
{
P1=0xfe;
while(1)
{
delay();
P1=_cror_(P1,1);
}
} 展开
#include<intrins.h>
#define uint unsigned int
sbit S1=P1^0;
sbit S2=P1^1;
sbit S3=P1^2;
sbit S4=P1^3;
unsigned char keyval;
void delay(uint i,j)
{
for(i=0;i<100;i++)
for(j=0;j<100;j++)
}
void key_scan()
{
P1=0xff;
if((P1&0x0f)!=0x0f)
{
delay(15);
if(S1==0)
keyval=1;
if(S2==0)
keyval=2;
if(S3==0)
keyval=3;
if(S4==0)
keyval=4;
}
}
void main()
{
keyval=0;
while(1);
{
key_scan();
switch(keyval)
{
case 1 :blink();break;
case 2 :extinguish();break;
case 3 :forward();break;
case 4 :backward();break;
}
}
}
void blink()
{
for(i=0;i<2;i++)
{
P1=0x00;
delay();
P1=0xff;
delay();
}
while(1)
{
P1=0xaa;
delay();
P1=0x55;
delay();
}
}
void extinguish()
{
while(1)
P1=0xff;
}
void forward()
{
P1=0xfe;
while(1)
{
delay();
P1=_crol_(P1,1);
}
}
void backward()
{
P1=0xfe;
while(1)
{
delay();
P1=_cror_(P1,1);
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询