A motor controller includes an inverter circuit, a speed detector, an
amplifier, a voltage detector, and an offset voltage addition circuit.
The inverter circuit drives a motor based on a PWM signal. The speed
detector generates an actual speed signal corresponding to an actual
speed of the motor. The amplifier outputs a differential voltage by
amplifying a difference between the actual speed signal and a target
speed signal. The voltage detector outputs a switch signal for switching
rotation direction of the motor. The switch signal has a first level,
when the differential voltage is equal to or greater than a predetermined
value. The switch signal has a second level, when the differential
voltage is less than the predetermined value. The offset voltage addition
circuit adds an offset voltage to the differential voltage according to
the signal level of the switch signal.