|
这个小程序数码管的我怎么运行,也显示错误,请高手指教一下!
#include
#include
unsigned char const TABLER[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09}
void main(void)
{
unsigned char i=0;
DDRA=0xff;
DDRB=0xff;
while(1)
{
for(i=0;i<10;i++)
{
PORTA=TABLE;
PORTB |=_BV(PB0);
PORTB &=~BV(PB1);
PORTB &=~BV(PB2);
PORTB &=~BV(PB3);
_delay_ms(2000);
PORTA=TABLE;
PORTB |=_BV(PB1);
PORTB &=~BV(PB0);
PORTB &=~BV(PB2);
PORTB &=~BV(PB3);
_delay_ms(2000);
PORTA=TABLE;
PORTB |=_BV(PB2);
PORTB &=~BV(PB0);
PORTB &=~BV(PB1);
PORTB &=~BV(PB3);
_delay_ms(2000);
PORTA=TABLE;
PORTB |=_BV(PB3);
PORTB &=~BV(PB0);
PORTB &=~BV(PB1);
PORTB &=~BV(PB2);
_delay_ms(2000);
}
}
}
|
|