This paper presents a motor controller based on PIC. Deferent from the traditional regular control pattern, the motor controller adopts changeable control pattern that enables a robot to use the different control mode according to the different external environment. The hardware, software architecture, algorithm of motion control, calibration, position limit, and communication are described. The experiments of position, velocity and current control are given, and the application of the motor controller is introduced.