How many analog outputs?

I've been experimenting with the analogWrite function, I have a bunch of LED's hooked up to pins 9 to 13. I have timers incrementing counters for each pin from 0 to 255, then back down from 255 to 0 this repeats continuously. Each pin has its own unique counter, the timers are running every 5ms.

Pins 9 and 10 seem to be changing at the same frequency, however pins 12 and 13 change at a different frequency, I'm not sure why, the timers and counters are incrementing at the same frequency as 9 and 10.

I cannot use pin 11, any attempt to use this causes the whole application to fail.

Is there any set-up I need to perform in order to use pins as analog outputs? Is there any reason why the PWM works differently on pins 12 and 13?

Thank you

If you use arduino UNO, only pins 3,5,6,9,10,11 are able to provide hardware PWM (analogueWrite). Use these pins or software PWM.

I'm using an Arduino Uno 3 and I read from the reference:

this function works on pins 3, 5, 6, 9, 10, and 11

However, I can confirm that I have it working on 9, 10 but not 11.

Actually, I can see what is happening on 12 and 13...its just switching on and off like a digital output, presumably at 0 and 255.

But for some reason 11 isn't working.

I have timers incrementing counters for each pin from 0 to 255, then back down from 255 to 0 this repeats continuously.

There are timers involved in PWM. Different timers for different pairs of pins. If you have stolen the timer for another purpose, you sacrifice PWM on those pins.

That could be true...my timers all use a single interrupt:

TCNT2 = 0x00;
OCR2A = 250;		        // 1 ms @ Fosc = 16 MHz
TCCR2A = 0x02;          // WGM: No wave generation
TCCR2B = 0x04;          // START Timer, prescaler = 64
TIMSK2 = (1 << TOIE2);  // Enable interrupt when Timer reaches OCRA

I'll have a look at the source to see if there is a conflict.

Thank you,