51单片机编程中断问题34: error C141: syntax error near 'if'为什么if错了(keil)
#include"reg52.h"#include<intrins.h>#defineuintunsignedint#defineucharunsignedcharuin...
#include "reg52.h"
#include <intrins.h>
#define uint unsigned int
#define uchar unsigned char
uint K1;
uchar BZ;
sbit P2_0=P2^0;
void YanShi(void)
{
uint a,b;
for(a=250;a>0;a--)
for(b=0;b<250;b++);
}
void AnJian(void) interrupt 0
{
if(K1==1)
{
BZ=0;
}
else
{
BZ=1;
}
}
void main(void)
{
K1=0;
IT0=1;
EX0=1;
EA=1;
while(1)
{
YanShi()
if(BZ==1)
{
P2_0=~P2_0;
K1=1;
}
YanShi()
if(BZ==1)
{
P2_0=~P2_0;
}
}
} 展开
#include <intrins.h>
#define uint unsigned int
#define uchar unsigned char
uint K1;
uchar BZ;
sbit P2_0=P2^0;
void YanShi(void)
{
uint a,b;
for(a=250;a>0;a--)
for(b=0;b<250;b++);
}
void AnJian(void) interrupt 0
{
if(K1==1)
{
BZ=0;
}
else
{
BZ=1;
}
}
void main(void)
{
K1=0;
IT0=1;
EX0=1;
EA=1;
while(1)
{
YanShi()
if(BZ==1)
{
P2_0=~P2_0;
K1=1;
}
YanShi()
if(BZ==1)
{
P2_0=~P2_0;
}
}
} 展开
2个回答
展开全部
if前面少了一个分号。。。
while(1)
{
YanShi()//此处
if(BZ==1)
{
P2_0=~P2_0;
K1=1;
}
YanShi()//此处
if(BZ==1)
{
P2_0=~P2_0;
}
}
while(1)
{
YanShi()//此处
if(BZ==1)
{
P2_0=~P2_0;
K1=1;
}
YanShi()//此处
if(BZ==1)
{
P2_0=~P2_0;
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询