PWM control of motors