Mega 16bit PWM

In the ATmega 2560 processor manual it is described that timers 1,3,4 and 5 can be set to 8, 9 or 10 bit resolution PWM by configuring bits WGMn0 and 1 accordingly.

Why then does analogWriteResolution() not work when you select the Mega as the processor board?

analogWriteResolution

You use analogWrite() to set the duty cycle.

Because?

anlogWriteResolution does not work for the Mega. you therefore cannot use a higher resolution for the analogWrite function. the maximum DC you can specify for analogWrite is 255. This is 8 bits of resolution while the 2560 manual specify that you can set the 16 bit timers to 9 or 10 bit resolution but the analogWrite function only allows 255 as maximum DC while a 10 bit resolution (as specified in the 2560 manual) will allow a DC of 1023.

Why cant you set the resolution for the Mega with analogWriteResolution to 10 bits as allowed by the 2560 manual?

It looks like analogWriteResolution() is not supported on AVR boards such as the Mega.

But why then does the Atmega2560 datasheet specify that the PWM resolution can be 8,9 or 10 bits if the IDE does not allow this?

KerneelsM:
But why then does the Atmega2560 datasheet specify that the PWM resolution can be 8,9 or 10 bits if the IDE does not allow this?

You have that backwards. Just because the hardware can do it, doesn't mean the standard Arduino core is required to support it. If you want the higher resolution, follow the datasheet and set up the timer's registers accordingly.