大佬,我想动态数码管对应位由0到7,再由7到0,一直循环,可是只能循环一次,这是那里的问题呢?void smg_display(void)
{
u8 i=0;
for(i=0;i<8;i++)
{
switch(i)
{
case 0: LSC=1;LSB=1;LSA=1;break;
case 1: LSC=1;LSB=1;LSA=0;break;
case 2: LSC=1;LSB=0;LSA=1;break;
case 3: LSC=1;LSB=0;LSA=0;break;
case 4: LSC=0;LSB=1;LSA=1;break;
case 5: LSC=0;LSB=1;LSA=0;break;
case 6: LSC=0;LSB=0;LSA=1;break;
case 7: LSC=0;LSB=0;LSA=0;break;
}
SMG_A_DP_PORT=gsmg_code[i];
delay_10us(100000);
SMG_A_DP_PORT=0X00;
}
for(i=7;i>=0;i--)//·´ÏòÊä³öfor(i=7;i>=0;i--)
{
switch(i)//λѡ
{
case 0: LSC=1;LSB=1;LSA=1;break;
case 1: LSC=1;LSB=1;LSA=0;break;
case 2: LSC=1;LSB=0;LSA=1;break;
case 3: LSC=1;LSB=0;LSA=0;break;
case 4: LSC=0;LSB=1;LSA=1;break;
case 5: LSC=0;LSB=1;LSA=0;break;
case 6: LSC=0;LSB=0;LSA=1;break;
case 7: LSC=0;LSB=0;LSA=0;break;
}
SMG_A_DP_PORT=gsmg_code[i];
delay_10us(100000);
SMG_A_DP_PORT=0X00;
}
}
void main()
{
SMG_A_DP_PORT=gsmg_code[0];
while(1)
{
smg_display();
}
}
|