灯少,过程简单,可用查表法:
code uchar tab[] {0x00, 0x01,0x03,0x07,0x0f,0x0f,0x07,0x03,0x01,0x00,0x0f,0x00,0x0f,0x00,0x0f,0x00,0x0f};
void delay(uchar i){
uchar j;
for(; i>0; i--)
for(j 0; j < 100;j++);
}
void main(){
uchar i;
while(1){
P0 tab[i];
i (i+1) % 17;
delay(100);
}
}