In this paper, we first introduce the basic working principle of optical-electrical encoder that is a kind of digital displacement sensor. Then we present guidelines for designing optical-electrical encoder pulse counting card based on PC-bus, including such aspects as counting mode, pulse signal shaping and antijamming, data latching, I/O address allocating, read/write register format, timer and interrupt, etc. Finally we present an approach to design the driving program. To implement high precision and stability encoder signal detection and position servo control, this paper supplies references.