I'm doing a project that requires a lot of PWM's and I've gotten 6 of the 9 PWM capable pins to work, but I'm struggling to get the last 3 running.
To get the OC1A-C Pins running a PWM, I did this:
DDRB = 0xE0 //Pins B7,B6 & B5 to output TCCR1A |= (1 << COM1A1) | (1 << COM1A0) |(1 << COM1B1) | (1 << COM1B0) | (1 << COM1C1) | (1 << COM1C0) | (1 << WGM10); TCCR1B |= (1 << WGM12) | (1 << CS11); //Test PWM Values OCR1A = 0x10; OCR1B = 0x20; OCR1C = 0x30;
However, when I try to do the the same for OC2A and OC2B, nothing happens:
DDRB = 0x10 //B4 to output DDRD = 0x02 //D1 to output TCCR2A |= (1 << COM2A1) | (1 << COM2A0) |(1 << COM2B1) | (1 << COM2B0) | (1 << WGM20); TCCR2B |= (1 << WGM22) | (1 << CS21); //Test PWM Values OCR2A = 0x40; OCR2B = 0x50;
So what else do I need to set to get the PWM on those pins working?