keil编程错误大神给指导下啊 TXT.C(35): error C141: syntax error near '&&'
以下为错误TXT.C(35):errorC141:syntaxerrornear'&&'TXT.C(36):errorC141:syntaxerrornear'LED2'...
以下为错误
TXT.C(35): error C141: syntax error near '&&'
TXT.C(36): error C141: syntax error near 'LED2'
TXT.C(47): error C141: syntax error near '!'
Target not created
源程序
# include<reg52.h>
# include<absacc.h>
# define uchar unsigned char
# define AD XBYTE[0x7FF8]
sbit led1=P2^0;
sbit led2=P2^1;
sbit led3=P2^2;
sbit led4=P2^3;
sbit led5=P2^4;
sbit led6=P2^5;
sbit ad_busy=P3^2;
bit bk=1;
unsigned char ad_data,LED1,LED2,LED3,LED4,LED5,LED6;
uchar code led_segment[12]=
{0x3F,0x06,0x58,0x4F,0x66,0x7D,0x07,0x7F,0x6F,0x00,0x00};
void delay(unsigned int i)
{
while(i)
{
i--;
}
}
void display(void)
{
LED1=ad_data%10;
LED2=(ad_data/10)%10;
LED3=ad_data/100;
P2=0xff;
delay(2);
P1=led_segment[LED1];
led1=0;
delay(100);
led1=1;
if(LED3==0)&&(LED2==0)
LED2=10;
P1=led_segment[LED2];
led2=0;
delay(100);
led2=1;
if(LED3==0)
LED3=10;
P1=led_segment[LED3];
led3=0;
delay(100);
led3=1;
bk!bk;
}
void ad0808(void) interrupt 0
{
EA=0;
EX0=0;
ad_data=0;
ad_busy=0;
while(1)
{
if(bk)
{
AD=0;
}
display();
}
} 展开
TXT.C(35): error C141: syntax error near '&&'
TXT.C(36): error C141: syntax error near 'LED2'
TXT.C(47): error C141: syntax error near '!'
Target not created
源程序
# include<reg52.h>
# include<absacc.h>
# define uchar unsigned char
# define AD XBYTE[0x7FF8]
sbit led1=P2^0;
sbit led2=P2^1;
sbit led3=P2^2;
sbit led4=P2^3;
sbit led5=P2^4;
sbit led6=P2^5;
sbit ad_busy=P3^2;
bit bk=1;
unsigned char ad_data,LED1,LED2,LED3,LED4,LED5,LED6;
uchar code led_segment[12]=
{0x3F,0x06,0x58,0x4F,0x66,0x7D,0x07,0x7F,0x6F,0x00,0x00};
void delay(unsigned int i)
{
while(i)
{
i--;
}
}
void display(void)
{
LED1=ad_data%10;
LED2=(ad_data/10)%10;
LED3=ad_data/100;
P2=0xff;
delay(2);
P1=led_segment[LED1];
led1=0;
delay(100);
led1=1;
if(LED3==0)&&(LED2==0)
LED2=10;
P1=led_segment[LED2];
led2=0;
delay(100);
led2=1;
if(LED3==0)
LED3=10;
P1=led_segment[LED3];
led3=0;
delay(100);
led3=1;
bk!bk;
}
void ad0808(void) interrupt 0
{
EA=0;
EX0=0;
ad_data=0;
ad_busy=0;
while(1)
{
if(bk)
{
AD=0;
}
display();
}
} 展开
2个回答
展开全部
改成这样:
if((LED3==0)&&(LED2==0))
和
bk=!bk;
if((LED3==0)&&(LED2==0))
和
bk=!bk;
追问
多谢大神啦~修改了以后显示没有错误了呢。。但是出现了这样是为什么啊?单片机编程好难T_T
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: MAIN
MODULE: D:\KEIL\C51\LIB\C51S.LIB (?C_INIT)
追答
晕了,你的main函数呢,任何C语言的程序,都有且只有一个main函数的
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询