Rewritten PWM using timer.