#include "avr/io.h"
  
  void delay_1ms ( );
  
  int main ()
  {
    ddrb = (1<<5);
    while (1)
    {
      portb = portb ^ (1<<5);
      delay_1ms ( );
    }
    return 0;
  }
  void delay_1ms ( )
  {
    icr1h = 0x27;
    icr1l = 0x0f;  
    tcnt1h = 0;
    tcnt1l = 0;
    tccr1a = 0x02;  
  
    tccr1b = 0x19;  
    while((tifr&(1<<icf1)) == 0);
    tifr = (1<<icf1);
    tccr1b = 0;
    tccr1a = 0;  
  }