i am Using all 15 Channels of PWM on Arduino mega2560 and i need to set their frequency to 40hz constant... please anyone tell me how can i do that i will be very Thankful.
Use a timer library, or take over the timers by directly manipulating the timer control registers (see the sections of the datasheet on the timers). You can change the clock prescaler, as well as the number that the timer counts up to before going back to 0 (you have to change the WGM to one of the ones that lets you adjust that - and you may not be able to get that on all the mega's timers - most of the Mega's timers are the 16-bit ones, but timer 0 and 2 are 8-bit ones with different featuresets). Between manipulating TOP and the prescalar, you can get PWM at 40hz (or almost any other frequency you want).
You'd need to write a replacement for analog write, naturally, since you're counting to a number other than 255.