A kind of incremental encoder disconnection detection method and system
【Technical field】
The present invention relates to a kind of incremental encoder, it is specifically designed a kind of incremental encoder disconnection detection method and is
System.
【Background technology】
Prior art in motion control and Electrified Transmission field, because incremental encoder is durable, shock resistance, be difficult by
Interference, the advantages of precision is high, it is used widely.It is particularly applicable in the drive control of servomotor, but if increment type
A certain of encoder broken string, then driver cannot correct drive control servomotor.If can not quickly and accurately enter
Row alarm, situations such as may damaging servo-driver or motor driving occur can cause serious consequence.
【The content of the invention】
In order to solve the problem of a certain broken string of incremental encoder in the prior art is unable to Rapid Alarm, the present invention is implemented
Example provides a kind of incremental encoder disconnection detection method and system.
The embodiment of the present invention solves above-mentioned technical problem and adopts the technical scheme that a kind of incremental encoder broken string inspection
Survey method, including:
A phases and B phase differential signals are respectively converted into A phases and B phase single-ended signals;
The sequential of A phases and B phase single-ended signals is encoded;
Continuously there is identical number of times in the coding that counting period is set, and sets it to errors number;
When the speed that the errors number is more than set threshold value and motor is not zero, fault-signal is exported.
It is described to include A phases and the sequential of B phase single-ended signals progress coding step:A phases sequential and B phase sequential are organized in one
Rise and form coding A0B0、A1B1To AnBn。
Continuously there is identical number of times in the coding that the counting period is set, and sets it to errors number step bag
Include:When spaced coding is differed, errors number is started from scratch.
The incremental encoder disconnection detection method also includes:Z phase differential signals are respectively converted into the single-ended letter of Z phases
Number;
The umber of pulse that record encoder is often enclosed;
4 times of frequency counters of real-time A phases or B phases are triggered to start counting up;
When not receiving Z phase signals high level and real-time A phases or the frequency multiplication counter records number of B phases 4 are more than and often enclose pulse
Fault-signal is exported when several 1.5 times.
The real-time 4 times of frequency counters of triggering, which start counting up step, to be included:When receiving Z phase signals high level hour counters
Reset.
The present invention also provides a kind of incremental encoder broken wire detection system, including:
Differential signal converting unit, for A phases and B phase differential signals to be respectively converted into A phases and B phase single-ended signals;
AB phase coding units, for the sequential of A phases and B phase single-ended signals to be encoded;
AB phases encode judging unit, for judging whether spaced coding continuously occurs;
AB phases mistake coding count unit, encodes judging unit for AB phases and judges that the counting period coding of setting continuously goes out
The number of times of its appearance is calculated now, and sets it to errors number;
AB phase fault judging units, for judging when the errors number is more than the speed of set threshold value and motor
When being not zero, fault-signal is exported.
Institute AB phases coding unit weaves together A phases sequential and B phase sequential to form coding A0B0、A1B1To AnBn。
The AB phases encode judging unit and judge that spaced coding when differing, sends a signal to AB phase mistakes
Coding count unit, the wrong coding count unit of the AB phases is reset.
Z phase differential signals are respectively converted into Z phase single-ended signals by the differential signal converting unit, in addition to:Encoder
Pulse counter, for recording the umber of pulse that encoder is often enclosed;4 times of frequency counters of A phases or B phases, for recording A phases or B in real time
The umber of pulse of phase;Z phase signals judging units, for judging whether to receive Z phase signals high level;Z phase fault judging units, are used for
Fault-signal is exported when not receiving Z phase signals high level and 4 times of frequency counters are more than 1.5 times of often circle umber of pulse.
The Z phase signals judging unit judges to receive Z phase signals high level, sends a signal to A phases or the frequency multiplication of B phases 4 is counted
Device, the frequency multiplication counter O reset of A phases or B phases 4.
A kind of incremental encoder disconnection detection method of the embodiment of the present invention and system, compared with prior art, the present invention
Embodiment is encoded to A phases and B phase sequential, judges whether encoder breaks by detecting coding, detection method ratio
It is relatively accurate, and encoder can be detected when motor is rotated and reverse, in any situation and any state
It can fast and accurately judge whether a certain single-ended signal of encoder has disconnection fault.
【Brief description of the drawings】
Technical scheme in order to illustrate the embodiments of the present invention more clearly, makes required in being described below to embodiment
Accompanying drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for
For those of ordinary skill in the art, on the premise of not paying creative work, other can also be obtained according to these accompanying drawings
Accompanying drawing:
Fig. 1 is the flow chart of a kind of incremental encoder A phases of the embodiment of the present invention and B phase wire break detection methods;
Fig. 2 is a kind of incremental encoder A phases of the embodiment of the present invention and B phase time diagrams;
Fig. 3 is a kind of flow chart of incremental encoder Z phase wire break detection methods of the embodiment of the present invention;
Fig. 4 is a kind of incremental encoder A phases of the embodiment of the present invention and B phase broken wire detection system block diagrams;
Fig. 5 is a kind of incremental encoder Z phases broken wire detection system block diagram of the embodiment of the present invention.
【Embodiment】
Below in conjunction with the accompanying drawing of the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Ground is described, it is clear that described embodiment is only a part of embodiment of the present invention, rather than whole embodiments.Based on this
Embodiment in invention, the every other reality that those of ordinary skill in the art are obtained under the premise of creative work is not made
Example is applied, the scope of protection of the invention is belonged to.
A kind of incremental encoder disconnection detection method of embodiment one, the embodiment of the present invention, as shown in figure 1, including:
S11:A phases and B phase differential signals are respectively converted into A phases and B phase single-ended signals;
Specifically by differential signal A+, A- is converted to A phase single-ended signals, by differential signal B+, and B- is converted to the single-ended letter of B phases
Number.
S12:The sequential of A phases and B phase single-ended signals is encoded;
It is specific to weave together A phases sequential and B phase sequential to form coding A0B0、A1B1To AnBn。
S13:Continuously there is identical number of times in the coding that counting period is set, and sets it to errors number;
A phases sequential and B phase sequential are specifically woven together into the code storage to be formed in a register, the counting period is set
Coding continuously there is identical number of times, such as work as A0B0And A2B2Errors number is designated as 1 time when identical.
For example:As shown in Fig. 2 the sequential of AB signals is 00-01-11-10 when rotating forward, it is assumed that when AB signals wherein single line
When disconnection, signal can be changed into often being 1 or being often 0, and the signal of output can be caused to be changed into 00-01-00-01 and continuously become
Change, can occur that servomotor is started with maximum speed according to the signal of feedback for digital control system if not handling
Rotate, it may appear that break lathe.When the state twice of assay intervals is identical, we are designated as occurring errors number once.
When detection method of the embodiment of the present invention is equally applicable to reversion.
S14:Judge whether the errors number is more than set threshold value;
It is preferred that, the number of times of the threshold value is set as 2500 times, i.e., be considered when continuously there are 2500 mistakes
Encoder feedback signal occurs in that sequential is abnormal.
S15:When the speed that the errors number is more than set threshold value and motor is not zero, into step S16;
Specifically, when relative to motor zero-speed, because system has PID regulations, so in the presence of when zero-speed is shaken
Also easily occur mistake sequential, therefore in this program consider zero-speed when will not walk about, it is necessary to when zero-speed screen
Cover this detection.
S17:In the step S14 when spaced coding is differed, errors number is started from scratch.
S16:Export fault-signal.
As shown in figure 3, the incremental encoder disconnection detection method also includes:
S21:Z phase differential signals are respectively converted into Z phase single-ended signals;
Specifically by differential signal Z+, Z- is converted to Z phase single-ended signals
S22:The umber of pulse that record encoder is often enclosed;
S23:4 times of frequency counters of real-time A phases or B phases are triggered to start counting up;
S24:Judge whether to receive Z phase signals high level;
S25:When judging not receive Z phase signals high level and real-time A phases or the frequency multiplication counter records number of B phases 4 are more than
Often enter step S26 during circle 1.5 times of umber of pulse;
S26:Export fault-signal.
S27:When judgement receives the clearing of Z phase signals high level hour counter in step S24.
Because each circle just has a Z signal for incremental encoder, so when the counting of quadruple in detection
In be also not received by the high level of Z signals when count value is to 1 circle half, it is believed that be not receive Z signals, now break
Servo is opened to enable and display alarm.
A kind of incremental encoder disconnection detection method of the embodiment of the present invention, compared with prior art, the embodiment of the present invention
A phases and B phase sequential are encoded, judge whether encoder breaks by detecting coding, Comparison between detecting methods are accurate,
And encoder can be detected when motor is rotated and reverse, can be quick in any situation and any state
Accurately judge whether a certain single-ended signal of encoder has disconnection fault.
Embodiment two, the present invention also provide a kind of incremental encoder broken wire detection system, as shown in Figure 4 and Figure 5, bag
Include:
Differential signal converting unit, for A phases and B phase differential signals to be respectively converted into A phases and B phase single-ended signals;
AB phase coding units, for the sequential of A phases and B phase single-ended signals to be encoded;
AB phases encode judging unit, for judging whether spaced coding continuously occurs;
AB phases mistake coding count unit, encodes judging unit for AB phases and judges that the counting period coding of setting continuously goes out
The number of times of its appearance is calculated now, and sets it to errors number;
AB phase fault judging units, for judging when the errors number is more than the speed of set threshold value and motor
When being not zero, fault-signal is exported.
Institute AB phases coding unit weaves together A phases sequential and B phase sequential to form coding A0B0、A1B1To AnBn。
The AB phases encode judging unit and judge that spaced coding when differing, sends a signal to AB phase mistakes
Coding count unit, the wrong coding count unit of the AB phases is reset.
Z phase differential signals are respectively converted into Z phase single-ended signals by the differential signal converting unit, in addition to:Encoder
Pulse counter, for recording the umber of pulse that encoder is often enclosed;4 times of frequency counters of A phases or B phases, for recording A phases or B in real time
The umber of pulse of phase;Z phase signals judging units, for judging whether to receive Z phase signals high level;Z phase fault judging units, are used for
Fault-signal is exported when not receiving Z phase signals high level and 4 times of frequency counters are more than 1.5 times of often circle umber of pulse.
The Z phase signals judging unit judges to receive Z phase signals high level, sends a signal to A phases or the frequency multiplication of B phases 4 is counted
Device, the frequency multiplication counter O reset of A phases or B phases 4.
A kind of incremental encoder broken wire detection system of the embodiment of the present invention, compared with prior art, the embodiment of the present invention
A phases and B phase sequential are encoded, judge whether encoder breaks by detecting coding, Comparison between detecting methods are accurate,
And encoder can be detected when motor is rotated and reverse, can be quick in any situation and any state
Accurately judge whether a certain single-ended signal of encoder has disconnection fault.
In the above-described embodiments, exemplary description only has been carried out to the embodiment of the present invention, but those skilled in the art exist
The embodiment of the present invention can be entered in the case where not departing from the spirit and scope of the embodiment of the present invention after reading present patent application
The various modifications of row.