From the datasheet and online examples, I just don't understand how to enable PWM on a specific pin on an Atmega32U4
.. while maintaining the other pins on the same port, as general I/O
- how can I find a chart of which pin is linked to which pwm register ? (not in the doc)
- how to use 1 port pin as pwm and the other pins (same port) as regular output ?
- I need to PWM 3 pins, same frequency, but different duty cycle
here is one of the code I found online
TCCR1A = 0;
TCCR1B = 0;
TCCR1A |= (1 << WGM11) | (1 << WGM10);
TCCR1B |= (0 << WGM13) | (1 << WGM12);
TCCR1B |= (0 << CS12) | (0 << CS11) | (1 << CS10); // 0 0 1 ... clkIO/1 (No prescaling)
TCCR1A |= (1 << COM1A1) | (0 << COM1A0);
DDRB |= (1 << DDB5); // so pin 5 will PWM, but I also want to use other pins on port B (WITHOUT PWM)
is it even possible to pwm on one pin only and use the other pins as regular I/O ??
thanks for your help