Adjustable PWM function