Controlling a DC motor by PWM at constant speed