The phase discriminator of incremental rotary encoder
Technical field
The present invention relates to a kind of circuit of electronic technology field, specifically is a kind of phase discriminator of incremental rotary encoder.
Background technology
At present, along with the continuous appearance of electronic product and emerging digital product, its good looking appearance, and traditional adjusting knob---potentiometer is an analog element, and range of adjustment is narrow, and consistance is poor, can't satisfy the demands.Modern digital product, man-machine interface design adopt single knob to cooperate button to realize mostly, promptly select the parameter that will revise by the switching of button, regulate incremental rotary encoder and carry out the modification of parameter.For different parameters, different scopes is arranged, so use single knob to regulate just to require this knob be " non-memory type ", so incremental rotary encoder has obtained using widely.What incremental rotary encoder was exported is pulse signal, and promptly digital signal can be easily by computer Recognition, and error is little, and the precision height can adapt to different range of adjustment.But, now mostly adopt " software " to realize the purpose of " phase demodulation " for the identification of incremental rotary encoder signal, can increase the burden of single-chip microcomputer or other main control microprocessors like this, the software phase demodulation need be through constantly groping to determine the condition of logic determines simultaneously, otherwise can cause miscount, thereby cause error.
Retrieval through the prior art document is found, in " computer automatic analysis and control " 2000, Vol8, No.3, " a kind of realization of high precision rotary encoder single-chip microcomputer counting circuit " literary composition of the last publication of P51-52, this article has been introduced a kind of incremental rotary encoder single-chip microcomputer counting circuit, and this circuit comprises direction identification circuit, two-way counting circuit.But this counting circuit more complicated is used a large amount of chips, adopts the mode of parallel bus to insert single-chip microcomputer, has taken a large amount of mouth lines, the resource of having wasted single-chip microcomputer.
Summary of the invention
The objective of the invention is at the deficiencies in the prior art and defective, a kind of phase discriminator of incremental rotary encoder is provided, it can be connected with single-chip microcomputer or other microprocessor chips such as DSP etc. easily, the effective recognition sense of rotation, finish counting, and hardware circuit is simplified greatly.
The present invention is achieved by the following technical solutions, the present invention includes: shaping circuit, XOR circuit, RCD disappear and tremble holding circuit and J-K master-slave flip-flop circuit.Wherein shaping circuit two-way pulse waveform that incremental rotary encoder is produced is carried out shaping and is made irregular waveform rule, is convenient to the identification of subsequent conditioning circuit; XOR is carried out in the two-way pulse of XOR circuit after to shaping, removes two-way pulse overlap part, makes the two-way pulse become single pulse.Thereby RCD disappears and trembles single pulse that holding circuit produces XOR circuit and carry out filtering delay-time and handle and make pulse be more suitable for the requirement of subsequent conditioning circuit.Thereby the pulse after J-K master-slave flip-flop circuit is handled by foregoing circuit discern judge incremental rotary encoder sense of rotation promptly clockwise or rotation counterclockwise, and make other digit chips identifications of being more convenient for of the waveform of incremental rotary encoder output.
Described shaping circuit is made up of 42 inputs or door 74LS32 and resistance R 4, R5.The A phase signals of incremental rotary encoder output is received 9,10 pin of 74LS32, and connect with signal 12,13 pin of 74LS32 of B cushion, and shaping is by 8, the 11 pin output of 74LS32.Resistance R 4, R5 are current-limiting resistances.Resistance R 4 one ends are connected the A place, other end ground connection.Resistance R 5 one ends are connected the B place, other end ground connection.
Described RCD disappears and trembles holding circuit, is made up of resistance R 1, R2, R3, capacitor C 1, C2, C3, diode D1, D2, D3.Resistance R 1, R2, R3 one end link to each other with the anode of diode D1, D2, D3 respectively, and the other end links to each other with the anode of capacitor C 1, C2, C3.The negativing ending grounding of capacitor C 1, C2, C3.Electric capacity charges by resistance, and when pulse high level disappeared, electric capacity was by resistance and diode discharge, thereby reached the effect that disappears and tremble.
In order accurately to judge the direction that incremental rotary encoder is stirred; the phase place of avoiding the two-way pulse of the incremental rotary encoder output that the inconsistency of components and parts causes be not strict in advance or the phenomenon that lags behind; thereby designed to disappear and trembled holding circuit, the feature of this circuit is that three's filter constant must be greater than the recurrence interval of incremental rotary encoder.
Described XOR circuit is made up of 42 inputs or door 74LS32,42 input nand gate 74LS132.74LS32 realizes or logic that 74LS132 realizes NAND Logic, and 1 pin of 74LS32,2 pin link to each other with 1 pin, 2 pin of 74LS132 respectively.3 pin of 74LS32 link to each other with 5 pin of 74LS132; 3 pin of 74LS132 link to each other with 4 pin of 74LS132, through the 6 pin output of 74LS132, thereby realize logical xor function.
Output two-way pulse A, B when incremental rotary encoder is stirred, if 1/4 cycle of the phase-lead B of A when stirring clockwise, on the contrary 1/4 cycle of the phase lag B of A.Utilize these characteristics of this incremental rotary encoder to judge, but the real-time of handling like this detecting require very high by the precedence relationship that detects the two-way impulse phase.The pulse that lags behind if can keep the pulse that phase place shifts to an earlier date is removed, and so only detects the direction of stirring that single pulse just also can be judged incremental rotary encoder, has saved the time of system.Require the present invention to design XOR circuit based on this.
Described J-K master-slave flip-flop circuit adopts the 74LS78 chip to realize.In order to detect stirring direction and can counting of incremental rotary encoder, designed J-K master-slave flip-flop 74LS78 circuit to the pulse that incremental rotary encoder produces.
The invention has the advantages that hardware circuit is simplified greatly, only need two signal wires just can be connected, realize the judgement of the sense of rotation of rotary incremental rotary encoder with other digital circuit.Thereby can simplify the program of single-chip microcomputer or other main control microprocessors greatly, improve the reliability of counting, speed is fast.Simultaneously, the present invention has good portability, needs only the Q1 with the present invention's output, 13 pin of Q2[74LS78,8 pin] being connected with other digital circuits gets final product.
Description of drawings
Fig. 1 is circuit theory diagrams of the present invention.
Embodiment
As shown in Figure 1, the present invention includes: shaping circuit 1, XOR circuit 2, RCD disappear and tremble holding circuit 3 and J-K master-slave flip-flop circuit 4.Wherein the two-way pulse waveform that produces of the 1 pair of incremental rotary encoder of shaping circuit is carried out shaping and is made irregular waveform rule, is convenient to the identification of subsequent conditioning circuit; XOR is carried out in two-way pulse after 2 pairs of shapings of XOR circuit, removes two-way pulse overlap part, makes the two-way pulse become single pulse.Thereby RCD disappears and trembles single pulse that 3 pairs of XOR circuit of holding circuit 2 produce and carry out filtering delay-time and handle and make pulse be more suitable for the requirement of subsequent conditioning circuit.Thereby the pulse after J-K master-slave flip-flop circuit 4 is handled by foregoing circuit discern judge incremental rotary encoder sense of rotation promptly clockwise or rotation counterclockwise, and make other digit chips identifications of being more convenient for of the waveform of incremental rotary encoder output.
Described shaping circuit is made up of 42 inputs or door 74LS32 and resistance R 4, R5.The A phase signals of incremental rotary encoder output is received 9,10 pin of 74LS32, and connect with signal 12,13 pin of 74LS32 of B cushion, and shaping is by 8, the 11 pin output of 74LS32.Resistance R 4, R5 are current-limiting resistances.Resistance R 4 one ends are connected the A place, other end ground connection.Resistance R 5 one ends are connected the B place, other end ground connection.
Described RCD disappears and trembles holding circuit, is made up of resistance R 1, R2, R3, capacitor C 1, C2, C3, diode D1, D2, D3.Resistance R 1, R2, R3 one end link to each other with the anode of diode D1, D2, D3 respectively, and the other end links to each other with the anode of capacitor C 1, C2, C3.The negativing ending grounding of capacitor C 1, C2, C3.Capacitor C 1, C2, C3 are by resistance R 1, R2, R3 charging, and when pulse high level disappeared, capacitor C 1, C2, C3 discharged, thereby reach the effect that disappears and tremble by resistance R 1, R2, R3 and diode D1, D2, D3.
Described XOR circuit is made up of 42 inputs or door 74LS32,42 input nand gate 74LS132.74LS32 realizes or logic that 74LS132 realizes NAND Logic, and 1 pin of 74LS32,2 pin link to each other with 1 pin, 2 pin of 74LS132 respectively.3 pin of 74LS32 link to each other with 5 pin of 74LS132; 3 pin of 74LS132 link to each other with 4 pin of 74LS132, through the 6 pin output of 74LS132, thereby realize logical xor function.
Described J-K master-slave flip-flop circuit adopts the 74LS78 chip to realize.In order to detect stirring direction and can counting of incremental rotary encoder, designed J-K master-slave flip-flop 74LS78 circuit to the pulse that incremental rotary encoder produces.74LS78 is two principal and subordinate's J-K flip flops.2 pin, 6 pin are prefabricated end SD; 5 pin are public removing end CD; 1 pin is common clock CLK; 3 pin, 7 pin are input J1, J2; 14 pin, 7 pin are input K1, K2 end.74LS78 adopts the power supply of 5V power supply.
42 inputs or door 74LS32,42 input nand gate 74LS132, the integrated control chip of two principal and subordinate's J-K flip flop 74LS78, each integrated control chip is produced by ST company.