A motor controller accepts ac voltage at any frequency within a wide range and automatically generates an alternating polarity load-voltage having a preselected frequency, regardless of the frequency of the input voltage. The motor controller includes a dc-ac inverter which operates under the control of an EPROM to automatically generate the alternating polarity load-voltage at the desired frequency.