Motor speed control using PWM control