航标灯题目求大神帮我一下
#include"reg51.h"#define COUNT_50MS 50000
unsigned char key,i;
struct IALA
{
unsigned char gcd;
unsigned char state[6];
};
const struct IALA IALA4[4]={{0,0,0,0,0,0,0},{10,1,3,0,0,0,0},{10,1,1,1,7,0,0},{10,1,2,1,2,1,5}};
struct Turn
{
unsigned int STATE[6];
};
struct Turn Counter50ms;
gcd =IALA4[key].gcd;
sum=0;
for(i=0;i<6;i++)
{
sum=sum+gcd*IALA4[key].state[i];
Counter50ms.STATE[i]=sum;
}
void T0_ISR(void) interrupt 1
{
//
TF0=0; //自动清中断标志
static unsigned int j;
unsigned char k;
TH0=(65536-COUNT_50MS)/256;
TL0=(65536-COUNT_50MS)%256;
j++;
if(OPCON==0) //黑夜、暗照度
{
for(k=0;k<2;k++)
{
if(j==Counter50ms.STATE[2*k])
{
D=0; //熄灭LED灯
}
if(j==Counter50ms.STATE[2*k+1])
{
D=1; //点亮LED灯
}
}
if(j==Counter50ms.STATE[4])
{
D=0; //熄灭LED灯
}
if(j>=Counter50ms.STATE[5])
{
D=1; //点亮LED灯
i=0;
}
i++;
}
else //白天、亮照度
{
D=0; //熄灭LED灯
}
}
void main(void)
{
{
TMOD=(TMOD&0xf0)|0x01;
TH0=(65536-COUNT)/256;
TL0=(65536-COUNT)%256;
ET0=1; //中断使能
EA=1;
TR0=1; //T0启动
P1_0=0;
while(1)
{ key=0;
if(P1^0==0&p1^1==0)
key==0;
if(P1^0==0&p1^1==1)
key==1;
if(P1^0==1&p1^1==0)
key==2;
if(P1^0==1&p1^1==1)
key==3;
}
}
}
{
TMOD=(TMOD&0xf0)|0x01;
TH0=(65536-COUNT)/256;
TL0=(65536-COUNT)%256;
ET0=1; //中断使能
EA=1;
TR0=1; //T0启动
P1_0=0;
while(1) //等待TF0的到来
{
;
}
}
有4个错误求解怎么改