When using encoder sensor in precise measurement, the shaking of rotation axis can cause change of output waveform of sensor and wrong count. The paper began with analysis of waveform, then put forward a method based on software, which solves the above-mentioned problems and simplifies the design of circuit.