Getting Started

(lily) #1

Chapter 7: Microcontroller Interrupts and Timers


TCCR0A = (0<<FOC0A)|(0<<WGM01)|(1<<WGM00)|(1<<CS01);


void setOCR0A(unsigned char count)
{
// Sets the compare value
OCR0A = count;
}


// Interrupt occurs twice per Millisec, timed for PWM
SIGNAL(SIG_OUTPUT_COMPARE0)
{
// Toggle PORtD pin 0
if(PORTD &= 1) cbi(PORTD, 0);
else sbi(PORTD, 0);
}


}

Free download pdf