新手上路
- 积分
- 24
- 金钱
- 24
- 注册时间
- 2020-7-19
- 在线时间
- 3 小时
|
2金钱
enenene 写了这个 一部分然后主函数中 不加多页面切换的时候8个都显示正常,但是加了之后前7个正常最后一个消隐了和没弄一样。之后我自己从第一个调试发现只让第一个亮但是最后一个也亮、只让第二个亮最后一个也亮就是不太明显。后几个都这样。。这是咋回事。一下午了 害。
void Display()
{
static u8 i=0;
switch (1)
{
case 0:
GPIO_DIG = smgduan[LEDBuf[0]];
GPIO_PLACE = weixuan[0];
delay(1);
GPIO_DIG = 0x00;
GPIO_PLACE =0x00;
i++;
break;
case 1:
GPIO_DIG = smgduan[LEDBuf[1]];
GPIO_PLACE = weixuan[1];
delay(1);
GPIO_DIG = 0x00;
GPIO_PLACE =0x00;
i++;
break;
case 2:
GPIO_DIG = smgduan[LEDBuf[2]];
GPIO_PLACE = weixuan[2];
delay(1);
GPIO_DIG = 0x00;
GPIO_PLACE =0x00;
i++;
break;
case 3:
GPIO_DIG = smgduan[LEDBuf[3]];
GPIO_PLACE = weixuan[3];
delay(1);
GPIO_DIG = 0x00;
GPIO_PLACE =0x00;
i++;
break;
case 4:
GPIO_DIG = smgduan[LEDBuf[4]];
GPIO_PLACE = weixuan[4];
delay(1);
GPIO_DIG = 0x00;
GPIO_PLACE =0x00;
i++;
break;
case 5:
GPIO_DIG = smgduan[LEDBuf[5]];
GPIO_PLACE = weixuan[5];
delay(1);
GPIO_DIG = 0x00;
GPIO_PLACE =0x00;
i++;
break;
case 6:
GPIO_DIG = smgduan[LEDBuf[6]];
GPIO_PLACE = weixuan[6];
delay(1);
GPIO_DIG = 0x00;
GPIO_PLACE =0x00;
i++;
break;
/*case 7:
GPIO_DIG = smgduan[LEDBuf[7]];
GPIO_PLACE = weixuan[7];
delay(1);
GPIO_DIG = 0x00;
GPIO_PLACE =0x00;
i=0;
break;*/
default:break;
}
}
void main()
{
u16 i;
for(i=0;i<5000;i++)
{
Display();
}
while(1)
{
switch (wnd)
{
case 0:
LEDBuf[0] =0;
LEDBuf[1] =1;
LEDBuf[2] =2;
LEDBuf[3] =3;
LEDBuf[4] =4;
LEDBuf[5] =8;
LEDBuf[6] =3;
LEDBuf[7] =4;
for(i=0;i<5000;i++)
{
Display();
}
wnd++;
break;
case 1:
LEDBuf[0] =2;
LEDBuf[1] =3;
LEDBuf[2] =5;
LEDBuf[3] =7;
LEDBuf[4] =6;
LEDBuf[5] =8;
LEDBuf[6] =3;
LEDBuf[7] =4;
for(i=0;i<5000;i++)
{
Display();
}
wnd=0;
break;
case 2:break;
case 3:break;
case 4:break;
case 5:break;
default:
break;
}
}
}
|
|