1234567891011121314151617181920212223242526272829303132333435
#define F_CPU 16000000UL #include <avr/io.h> void intzar (void) { unsigned char i = 0; for (i = 0; i < 100; i++) //Makes the delay of 1.6384 sec { TCCR0A = 0xC2; //CTC mode is used. OCR0A = 0xFF; //8 bit timer TCCR0B = 0b00000101; //prescaler of 1024 while ((TIFR0 & 0b00000010) == 0b00000010) { TCCR0B = 0x00; TIFR0 = 0x03; } } } int main(void) { DDRB = 0b10000000; while (1) { PORTB = 0b10000000; intzar(); PORTB = 0b00000000; intzar(); } }