There are two ways to judge the orientation of crystal oscillator. One is to look for the unfilled corner of the crystal oscillator's pins, the other is to judge by the orientation of characters on the surface. An algorithm, which can be used to detect the orientation of crystal oscillator by character recognition, is brought forward in this paper. This algorithm has been proved efficient through experiment.