void init_TC0(void) { // Set the Timer Mode to CTC TCCR0A |= (1 << WGM01); // Set the value that you want to count to OCR0A = 0xF9; //249 //Set the ISR COMPA vect TIMSK0 |= (1 << OCIE0A); // set prescaler to 1024 and start the timer TCCR0B |= (1 << CS00) | (1 << CS02); }