编译通过,为什么等不闪烁, 程序哪边出了什么问题?
#include <avr/io.h>
#include <avr/interrupt.h>
#include <ctype.h> // 字符操作函数
int main(void)
{
DDRA = 0xff; // PA4 输出,输出高 (灯)
PORTA = 0xff;
TCNT0 = 111;
TIMSK |= ( 1<< TOIE0);
sei();
TCCR0 = 0x05; //1024/7.3728
while(1);
}
volatile unsigned int cnt = 0;
SIGNAL( SIG_OVERFLOW0 )
{
TCNT0 = 111; //1024*(255-111)/7.3728 = 20.000 ms
cnt++ ;
if ( cnt>=50 ) //20*50 = 1000 MS
{
cnt = 0;
PORTA ^= ( 1 << 4 ) ; // PA4 取反
}
}
|