Hello I have some problems to understand how to bind a Timer to a Pin and because of that my code isn't running...
#include <avr/io.h>
void init_PWM(void)
{
TCCR0A|=(1<<WGM00)|(1<<WGM01)|(1<<COM0A1)|(1<<CS00);
//Set OC0 PIN as output. It is PB3 on ATmega16 ATmega32
DDRB|=(1<<PB7);
}
void setPWM(uint8_t duty)
{
OCR0A = duty;
}
void main (void)
{
uint8_t brightness = 0;
init_PWM();
for (brightness=0; brightness<=255; brightness++)
{
setPWM(brightness);
_delay_ms(100);
}
}
My problem is how to assign the timer to PB7 ?
My goal is blinking LED on PB7 with FastPWM Mode...
Thanks in advance