这程序哪里错了,提示错误:TEXT1.C(3): error C129: missing ';' before 'snred',求大神解答!!!
#include<reg51.h>#include<stdio.h>Sbitsnred=P1^0;Sbitsnyellow=P1^1;Sbitsngreen=P1^2;S...
#include<reg51.h>
#include<stdio.h>
Sbit snred=P1^0;
Sbit snyellow=P1^1;
Sbit sngreen=P1^2;
Sbit ewred=P1^3;
Sbit ewyellow=1^4;
Sbit ewgreen=P1^5;
void delay20()
{
unsigned int i,j;
for(i=0;i<5000;i++)
for(j=0;j<500;j++)
;
}
unsigned char data bHasInt0=0;
void START(void) interrupt 0
{
while(bHasInt0!=1)
{snyellow=0;
ewred=0;
ewgreen=1;
snred=1;
delay20();
ewgreen=0;
ewyellow=1;
delay5();
ewyellow=0;
ewred=1;
snred=0;
sngreen=1;
delay20();
sngreen=0;
snyellow=1;
delay5();
}
}
void STOP (void) interrupt 1
{bHasInt0=1;
snred=0;
snyellow=0;
sngreen=0;
ewred=0;
ewyellow=0;
ewgreen=0;
}
void main()
{
snred=0;
snyellow=0;
sngreen=0;
ewred=0;
ewyellow=0;
ewgreen=0;
EX1=1;
EA=1;
} 展开
#include<stdio.h>
Sbit snred=P1^0;
Sbit snyellow=P1^1;
Sbit sngreen=P1^2;
Sbit ewred=P1^3;
Sbit ewyellow=1^4;
Sbit ewgreen=P1^5;
void delay20()
{
unsigned int i,j;
for(i=0;i<5000;i++)
for(j=0;j<500;j++)
;
}
unsigned char data bHasInt0=0;
void START(void) interrupt 0
{
while(bHasInt0!=1)
{snyellow=0;
ewred=0;
ewgreen=1;
snred=1;
delay20();
ewgreen=0;
ewyellow=1;
delay5();
ewyellow=0;
ewred=1;
snred=0;
sngreen=1;
delay20();
sngreen=0;
snyellow=1;
delay5();
}
}
void STOP (void) interrupt 1
{bHasInt0=1;
snred=0;
snyellow=0;
sngreen=0;
ewred=0;
ewyellow=0;
ewgreen=0;
}
void main()
{
snred=0;
snyellow=0;
sngreen=0;
ewred=0;
ewyellow=0;
ewgreen=0;
EX1=1;
EA=1;
} 展开
1个回答
2012-12-16
展开全部
你的sbit是大写的,换成小写的试试。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询