In the above schematic that IanP has provided you can control the duty cycle using the R1 pot,
the frequency is determined with the values of R1 and C1 and the duty cycle with the position of R1.
use freq=1.44/(R1*C1) to find the values you should use or for a given resistance and frequency C1= 1.44/( R1*freq )
You can always use a timer and change manually the output state in specific values of the timer
so that you have a pwm output with the frequency that you want but you have to execute the code
that creates the PWM constantly, it will not be "automated" like the PWM module where you just set a value and let is work.
Now I am using a I2C control PWM IC - DS1050 Maxim which can interface with Micro and generates 10Khz pwm also duty cycle varies from 0% to 100%.
Thanks.