当开关接高电平时,做霹雳灯,当接低电平时做奇偶灯变换,有没有人帮看一下代码有什么问题吗?```
#include <reg51.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
uchar tab[]={0x7e,0xbd,0xdb,0xe7,0xdb,0xbd};
sbit key=P0^7;
uchar a;
void delay(uint b)
{
uchar t;
while (b--)
{
for(t=0;t<120;t++);
}
}
void main()
{
unsigned char zt=0;
while(1)
{
if(key==1){zt=0;}
if(key==0){zt=1;}
switch(zt)
{
case 0:
P1=0x55;
while(1)
{
delay(500);
P1=crol(P1,1);
}
break;
case 1:
while(1)
{
for(a=0;a<6;a++)
{
P1=tab[a];
delay(500);
}
}
break;
}
}
}
```