Секундную задержку я делал так.
#define F_CPU 8000000UL // 8 MHz atmega8
#include ‹avr/io.h›
#include ‹util/delay.h›
#include ‹avr/iom8.h›
#include ‹avr/interrupt.h›
ISR(TIMER1_COMPA_vect)
{
// делаем тут что нужно
}
int main(void)
{
//конфигурация таймера 1
TCCR1B = _BV(WGM12) | _BV(CS12); // Run timer 1 in CTC mode, prescaler 256.
OCR1A = F_CPU / 256; // Compare match after one second.
TIMSK |= _BV(OCIE1A); // Compare match 1A interrupts.
sei();
for(;
![Прикольно](images/smilies/icon_wink3.gif)
{
// основной цикл
};
}