#define F_CPU 8000000UL
#include <avr/io.h>
/*
* main -- Main program
*/
int main(void)
{
/* Set OC1A pin to be an output */
DDRD|=(1<<5);
/* Set output compare register value */
OCR1A = 4000;
/* Set timer counter control registers A and B so that
* - mode is - clear counter on compare match
* - output compare match action is to toggle pin OC1A
* - correct clock prescale value is chosen.
* TCCR1C can just stay as default value (0).
*/
TCCR1A |=(1<<COM0A0) | (1<<WGM12);
TCCR1B |= (0<<CS12) | (1<<CS11) | (1<<CS10) | (1<<WGM12) | (1<<WGM12);
while(1){
}
}
I have a led linked to the OC1A port, yet it never flashes, some help would be much appreciated.
I have scoured the data sheet and do not comprehend what else must be done in order to make the led flash, i am sure it would be simple for someone with any c knowledge.