CN105806200A - Encoder parsing method - Google Patents

Encoder parsing method Download PDF

Info

Publication number
CN105806200A
CN105806200A CN201610345063.XA CN201610345063A CN105806200A CN 105806200 A CN105806200 A CN 105806200A CN 201610345063 A CN201610345063 A CN 201610345063A CN 105806200 A CN105806200 A CN 105806200A
Authority
CN
China
Prior art keywords
signal
qep
encoder
value
contrast
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610345063.XA
Other languages
Chinese (zh)
Other versions
CN105806200B (en
Inventor
吴强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qiao Hong Cnc Technology (shanghai) Co Ltd
Original Assignee
Qiao Hong Cnc Technology (shanghai) Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qiao Hong Cnc Technology (shanghai) Co Ltd filed Critical Qiao Hong Cnc Technology (shanghai) Co Ltd
Priority to CN201610345063.XA priority Critical patent/CN105806200B/en
Publication of CN105806200A publication Critical patent/CN105806200A/en
Application granted granted Critical
Publication of CN105806200B publication Critical patent/CN105806200B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01BMEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
    • G01B7/00Measuring arrangements characterised by the use of electric or magnetic techniques
    • G01B7/003Measuring arrangements characterised by the use of electric or magnetic techniques for measuring position, not involving coordinate determination

Abstract

The invention discloses an encoder parsing method.The method includes the steps that original QEP values corresponding to original signals of an encoder are calculated through a QEP circuit; initial position signals of the encoder are obtained according to the original QEP values, sine wave signals of the encoder and cosine wave signals of the encoder; a comparison QEP value is obtained; the QEP value is the sum of the original QEP values and the deviation quantity; second angle signals are obtained; comparison position signals of the encoder are obtained according to the comparison QEP value and the second angle signals; in a cycle, whether the current position meets the first preset condition or not is judged, if the current position meets the first preset condition, the comparison position signals serve as actual position signals of a motor of the encoder, and if the current position does not meet the first preset condition, the original position signals serve as actual position signals of the motor of the encoder.By means of the method, position deviation caused by desynchrony of hardware treatment can be avoided.

Description

A kind of analytic method of encoder
Technical field
The present invention relates to field of computer technology, particularly relate to the analytic method of a kind of encoder.
Background technology
Encoder (encoder) is the equipment that signal (such as bit stream) or data carry out working out, being converted to the signal form that may be used to communication, transmission and storage.For the waveform of encoder output, to carry out resolving be an important step.
In the prior art, the analysis mode for encoder is mainly the sine wave according to encoder output and cosine wave, and concrete analysis mode is as follows:
1) output signal P1 is obtained by QEP circuit counting;
2) by sinusoidal wave and cosine wave, atan2 is utilized to calculate the angle signal P2 that each sine wave period is corresponding with the cosine wave cycle;
3) output signal P1 and angle signal P2 addition being obtained position signalling P, position signalling P is exactly the position of the motor of encoder.
As can be seen here, the precision exporting signal P1 and angle signal P2 determines the precision of position signalling P.
Fig. 1 is the critical point of P1 change and the critical point of P2 change obtain P result figure when being the same time.Fig. 2 is the critical point of P1 change and the critical point of P2 change obtain P result figure when not being the same time.Wherein, horizontal axis representing time, the longitudinal axis represents position.As seen from Figure 1, in the ideal case, if the critical point of the critical point of output signal P1 change and angle signal P2 change is the same time, the position signalling P then obtained does not have burr, but once hardware handles is asynchronous, may result in the critical point of the critical point of output signal P1 change and angle signal P2 change is not the same time, then the position signalling P obtained exists burr, as shown in Figure 2.If, with the calculation of prior art, cause that position signalling P exists burr and is because the nonsynchronous reason of hardware handles.Cause that the physical location calculated exists deviation owing to position signalling P exists burr.
As can be seen here, the problem how avoiding the position deviation caused due to the nonsynchronous reason of hardware handles is those skilled in the art's problem demanding prompt solutions.
Summary of the invention
It is an object of the invention to provide the analytic method of a kind of encoder, for the problem avoiding the position deviation caused due to the nonsynchronous reason of hardware handles.
For solving above-mentioned technical problem, the present invention provides the analytic method of a kind of encoder, including:
Utilize the original QEP value that the primary signal of encoder described in QEP circuit counting is corresponding;
The initial position signal of described encoder is obtained according to described original QEP value, the sine wave signal of described encoder and the cosine wave signal of described encoder;
Obtain contrast QEP value;Described contrast QEP value be described original QEP value and side-play amount and;
Obtain the second angle signal;Wherein, the sine wave signal of the described encoder of delayed half period and cosine wave signal are calculated by atan2 function and obtain by described second angle signal;
The contrast position signalling of described encoder is obtained according to described contrast QEP value, described second angle signal;
Within a cycle, judge whether current location meets the first predetermined condition, if met, then using the described contrast position signalling actual position signal as the motor of described encoder, if do not met, then using the described home position signal actual position signal as the motor of described encoder.
Preferably, described obtain the initial position signal of described encoder according to described original QEP value, the sine wave signal of described encoder and the cosine wave signal of described encoder and specifically include:
Described original QEP value is utilized to obtain the first output signal;Wherein, P1=QEP/4*4, P1 represents described first output signal, and QEP represents original QEP value;
Utilize the first angle signal that the sine wave signal of the atan2 function described encoder of calculating is corresponding with cosine wave signal;Wherein, P2=K*atan2 (cos θ, sin θ), P2 represents described first angle signal, and K is planning coefficient, and cos θ is cosine wave signal, and sin θ is sine wave signal;
Calculate described first output signal and described first angle signal and obtain described initial position signal;Wherein, P=P1+P2, P represents described initial position signal.
Preferably, described side-play amount is 2;
Wherein, QEP '=QEP+2, QEP ' represents described contrast QEP value.
Preferably, P2 '=K*atan2 (cos θ ', sin θ '), wherein, P2 ' represents described second angle signal, and cos θ ' is cosine signal corresponding to the delayed half period of cos θ, sin θ ' for sinusoidal signal corresponding to the delayed half period of sin θ.
Preferably, the described contrast position signalling obtaining described encoder according to described contrast QEP value, described second angle signal specifically includes:
The second output signal is calculated according to described contrast QEP value;Wherein, P1 '=QEP '/4*4, P1 ' represents described second output signal;
Calculate described second output signal and described second angle signal and obtain described contrast position signalling;Wherein, P '=P1 '+P2 ', P ' represents described contrast position signalling.
Preferably, described first predetermined condition is: [90 °, 270 °].
The analytic method of encoder provided by the present invention, obtains contrast QEP value by increasing a side-play amount for original QEP value, thus obtaining the second output signal;Calculate the second angle signal that the sine wave signal of the encoder of delayed half period is corresponding with cosine wave signal, exporting with second, the basis of signal and the second angle signal obtains contrast position signalling.Owing to contrast position signalling only the local different of burr is occurring with initial position signal, other place is all identical, therefore, when current position signal meets the first predetermined condition, choose the contrast position signalling actual position signal as the motor of encoder, if do not met, then using the home position signal actual position signal as the motor of encoder.The method can avoid the position deviation owing to the nonsynchronous reason of hardware handles causes.
Accompanying drawing explanation
In order to be illustrated more clearly that the embodiment of the present invention, the accompanying drawing used required in embodiment will be done simple introduction below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the premise not paying creative work, it is also possible to obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 is the critical point of P1 change and the critical point of P2 change obtain P result figure when being the same time;
Fig. 2 is the critical point of P1 change and the critical point of P2 change obtain P result figure when not being the same time;
Fig. 3 is the flow chart of the analytic method of a kind of encoder provided by the invention;
Fig. 4 is the result figure that a kind of home position provided by the invention signal is corresponding;
Fig. 5 provided by the invention a kind of contrasts the result figure that position signalling is corresponding;
Fig. 6 is a kind of home position provided by the invention signal and the comparison diagram of contrast position signalling.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is only a part of embodiment of the present invention, rather than whole embodiment.Based on the embodiment in the present invention, those of ordinary skill in the art under not making creative work premise, the every other embodiment obtained, broadly fall into scope.
The core of the present invention is to provide the analytic method of a kind of encoder.
In order to make those skilled in the art be more fully understood that the present invention program, below in conjunction with the drawings and specific embodiments, the present invention is described in further detail.
Fig. 3 is the flow chart of the analytic method of a kind of encoder provided by the invention.As it is shown on figure 3, the analytic method of encoder includes:
S10: utilize the original QEP value that the primary signal of QEP circuit counting encoder is corresponding.
Same as the prior art in this step, it is simply that to utilize QEP circuit to be calculated the signal that encoder exports obtaining original QEP value, this original QEP value is corresponding with contrast QEP value hereinafter.
S11: obtain the initial position signal of encoder according to original QEP value, the sine wave signal of encoder and the cosine wave signal of encoder.
Same as the prior art in this step, first it is obtain the first output signal, then obtains the first angle signal again, the first angle signal addition finally exporting signal by first just obtains home position signal.
Wherein, the first output signal is obtained by original QEP value, particularly as follows: P1=QEP/4*4, P1 represent the first output signal, QEP represents original QEP value.
First angle signal utilizes sine wave signal and the cosine wave signal of atan2 function calculation code device, particularly as follows: P2=K*atan2 (cos θ, sin θ), P2 represents the first angle signal, and K is planning coefficient.
After obtaining the first output signal and the first angle signal, the two addition is just obtained home position signal, particularly as follows: P=P1+P2, P represent initial position signal.
S12: obtain contrast QEP value;Contrast QEP value be original QEP value and side-play amount and.
In order to eliminate the asynchronous problem brought of hardware, in the present embodiment, add a contrast QEP value, this contrast QEP value is to be obtained by original QEP value, if side-play amount is 2, then contrast QEP value can be obtained by, particularly as follows: QEP '=QEP+2, QEP ' represents contrast QEP value.
S13: obtain the second angle signal;Wherein, the sine wave signal of the encoder of delayed half period and cosine wave signal are calculated by atan2 function and obtain by the second angle signal.
Second angle signal is corresponding with the first angle signal, second angle signal is the sine wave signal and the cosine wave signal that utilize atan2 function calculation code device, particularly as follows: P2 '=K*atan2 (cos θ ', sin θ '), wherein, P2 ' represents the second angle signal, and cos θ ' is cosine signal corresponding to the delayed half period of cos θ, sin θ ' for sinusoidal signal corresponding to the delayed half period of sin θ.
S14: obtain the contrast position signalling of encoder according to contrast QEP value, the second angle signal.
In this step, the second output signal is calculated according to contrast QEP value;Wherein, P1 ' represents the second output signal, P1 '=QEP '/4*4.
Utilizing the second output signal and the second angle signal to obtain contrast position signalling, contrast position signalling P ' represents, P '=P1 '+P2 '.
S15: within a cycle, it is judged that whether current location meets the first predetermined condition, if met, enters step S16, otherwise, enters step S17;
S16: the position signalling actual position signal as the motor of encoder will be contrasted.
S17: using the home position signal actual position signal as the motor of encoder.
Fig. 4 is the result figure that a kind of home position provided by the invention signal is corresponding.Fig. 5 provided by the invention a kind of contrasts the result figure that position signalling is corresponding.Fig. 6 is a kind of home position provided by the invention signal and the comparison diagram of contrast position signalling.In. fig. 6, it can be seen that, compared with sine wave, within each cycle, [0 °, 360 °] home position signal is at place's generation of each cycle 180 ° burr point, and contrast position signalling is at place's generation of each cycle 0 ° burr point.Therefore choosing the first predetermined condition is: [90 °, 270 °], namely at [90 °, 270 °] in scope time, take the value actual position signal as the motor of encoder of contrast position signalling, at [0,90 °] and [270,360 °] in scope time, take the value actual position signal as the motor of encoder of initial position signal.
The analytic method of encoder provided by the invention, obtains contrast QEP value by increasing a side-play amount for original QEP value, thus obtaining the second output signal;Calculate the second angle signal that the sine wave signal of the encoder of delayed half period is corresponding with cosine wave signal, exporting with second, the basis of signal and the second angle signal obtains contrast position signalling.Owing to contrast position signalling only the local different of burr is occurring with initial position signal, other place is all identical, therefore, when current position signal meets the first predetermined condition, choose the contrast position signalling actual position signal as the motor of encoder, if do not met, then using the home position signal actual position signal as the motor of encoder.The method can avoid the position deviation owing to the nonsynchronous reason of hardware handles causes.
Above the analytic method of encoder provided by the present invention is described in detail.In description, each embodiment adopts the mode gone forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar portion mutually referring to.For device disclosed in embodiment, owing to it corresponds to the method disclosed in Example, so what describe is fairly simple, relevant part illustrates referring to method part.It should be pointed out that, for those skilled in the art, under the premise without departing from the principles of the invention, it is also possible to the present invention carries out some improvement and modification, these improve and modify in the protection domain also falling into the claims in the present invention.
Professional further appreciates that, the unit of each example described in conjunction with the embodiments described herein and algorithm steps, can with electronic hardware, computer software or the two be implemented in combination in, in order to clearly demonstrate the interchangeability of hardware and software, generally describe composition and the step of each example in the above description according to function.These functions perform with hardware or software mode actually, depend on application-specific and the design constraint of technical scheme.Professional and technical personnel specifically can should be used for using different methods to realize described function to each, but this realization is it is not considered that beyond the scope of this invention.
The method described in conjunction with the embodiments described herein or the step of algorithm can directly use the software module that hardware, processor perform, or the combination of the two is implemented.Software module can be placed in any other form of storage medium known in random access memory (RAM), internal memory, read only memory (ROM), electrically programmable ROM, electrically erasable ROM, depositor, hard disk, moveable magnetic disc, CD-ROM or technical field.

Claims (6)

1. the analytic method of an encoder, it is characterised in that including:
Utilize the original QEP value that the primary signal of encoder described in QEP circuit counting is corresponding;
The initial position signal of described encoder is obtained according to described original QEP value, the sine wave signal of described encoder and the cosine wave signal of described encoder;
Obtain contrast QEP value;Described contrast QEP value be described original QEP value and side-play amount and;
Obtain the second angle signal;Wherein, the sine wave signal of the described encoder of delayed half period and cosine wave signal are calculated by atan2 function and obtain by described second angle signal;
The contrast position signalling of described encoder is obtained according to described contrast QEP value, described second angle signal;
Within a cycle, judge whether current location meets the first predetermined condition, if met, then using the described contrast position signalling actual position signal as the motor of described encoder, if do not met, then using the described home position signal actual position signal as the motor of described encoder.
2. the analytic method of encoder according to claim 1, it is characterised in that described obtain the initial position signal of described encoder according to described original QEP value, the sine wave signal of described encoder and the cosine wave signal of described encoder and specifically include:
Described original QEP value is utilized to obtain the first output signal;Wherein, P1=QEP/4*4, P1 represents described first output signal, and QEP represents original QEP value;
Utilize the first angle signal that the sine wave signal of the atan2 function described encoder of calculating is corresponding with cosine wave signal;Wherein, P2=K*atan2 (cos θ, sin θ), P2 represents described first angle signal, and K is planning coefficient, and cos θ is cosine wave signal, and sin θ is sine wave signal;
Calculate described first output signal and described first angle signal and obtain described initial position signal;Wherein, P=P1+P2, P represents described initial position signal.
3. the analytic method of encoder according to claim 2, it is characterised in that described side-play amount is 2;
Wherein, QEP '=QEP+2, QEP ' represents described contrast QEP value.
4. the analytic method of encoder according to claim 3, it is characterized in that, P2 '=K*atan2 (cos θ ', sin θ '), wherein, P2 ' represents described second angle signal, and cos θ ' is cosine signal corresponding to the delayed half period of cos θ, sin θ ' for sinusoidal signal corresponding to the delayed half period of sin θ.
5. the analytic method of encoder according to claim 4, it is characterised in that the described contrast position signalling obtaining described encoder according to described contrast QEP value, described second angle signal specifically includes:
The second output signal is calculated according to described contrast QEP value;Wherein, P1 '=QEP '/4*4, P1 ' represents described second output signal;
Calculate described second output signal and described second angle signal and obtain described contrast position signalling;Wherein, P '=P1 '+P2 ', P ' represents described contrast position signalling.
6. the analytic method of encoder according to claim 4, it is characterised in that described first predetermined condition is: [90 °, 270 °].
CN201610345063.XA 2016-05-23 2016-05-23 A kind of analytic method of encoder Active CN105806200B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610345063.XA CN105806200B (en) 2016-05-23 2016-05-23 A kind of analytic method of encoder

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610345063.XA CN105806200B (en) 2016-05-23 2016-05-23 A kind of analytic method of encoder

Publications (2)

Publication Number Publication Date
CN105806200A true CN105806200A (en) 2016-07-27
CN105806200B CN105806200B (en) 2018-09-28

Family

ID=56452658

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610345063.XA Active CN105806200B (en) 2016-05-23 2016-05-23 A kind of analytic method of encoder

Country Status (1)

Country Link
CN (1) CN105806200B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109654988A (en) * 2018-11-01 2019-04-19 汉宇集团股份有限公司 Motor in electric automobile position detection method of calibration and system, electric car
JP2021179374A (en) * 2020-05-14 2021-11-18 株式会社小野測器 Testing system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6525502B1 (en) * 1999-09-02 2003-02-25 Aspen Motion Technologies, Inc. Closed loop control of motor position and velocity
CN102840874A (en) * 2011-06-22 2012-12-26 合康变频科技(武汉)有限公司 Frequency division method and system for any integer of orthogonal photoelectric encoder
CN103017800A (en) * 2011-09-27 2013-04-03 比亚迪股份有限公司 Method and device used for decoding orthogonal coding signal
CN205193510U (en) * 2015-11-20 2016-04-27 泉州装备制造研究所 Novel aircraft electrical power generating system tests platform device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6525502B1 (en) * 1999-09-02 2003-02-25 Aspen Motion Technologies, Inc. Closed loop control of motor position and velocity
CN102840874A (en) * 2011-06-22 2012-12-26 合康变频科技(武汉)有限公司 Frequency division method and system for any integer of orthogonal photoelectric encoder
CN103017800A (en) * 2011-09-27 2013-04-03 比亚迪股份有限公司 Method and device used for decoding orthogonal coding signal
CN205193510U (en) * 2015-11-20 2016-04-27 泉州装备制造研究所 Novel aircraft electrical power generating system tests platform device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
秦晓飞等: "交流伺服系统振动鲁棒M/T测速算法", 《电机与控制学报》 *
谷海涛等: "正交解码电路和捕获单元在转角和转速测量中的应用", 《检测技术》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109654988A (en) * 2018-11-01 2019-04-19 汉宇集团股份有限公司 Motor in electric automobile position detection method of calibration and system, electric car
JP2021179374A (en) * 2020-05-14 2021-11-18 株式会社小野測器 Testing system
JP7100677B2 (en) 2020-05-14 2022-07-13 株式会社小野測器 Test system

Also Published As

Publication number Publication date
CN105806200B (en) 2018-09-28

Similar Documents

Publication Publication Date Title
CN110850378B (en) Automatic calibration method and device for roadside radar equipment
CN101523224A (en) Realtime spectrum trigger system on realtime oscilloscope
CN104852662B (en) The measuring method and system of permagnetic synchronous motor static inductance parameter
CN103365965B (en) A kind of aggregation process method and apparatus of data
CN105806200A (en) Encoder parsing method
CN107623745A (en) A kind of monitoring method, system and computer-readable recording medium
CN103530812A (en) Power grid state similarity quantitative analyzing method based on locality sensitive hashing
CN110542832A (en) Method and device for positioning high-resistance grounding fault section of power distribution network and storage medium
CN107944731A (en) The method for building up and device of typical project cost template
CN102043090A (en) Measurement system for frequency-shift signal parameter of track circuit
CN104483836A (en) Online steady state processing method of telemetry data
CN104569581A (en) Multi-level set and single-cycle estimation method of power grid frequency measuring
CN109308291A (en) Smoothing method, device, terminal and the computer readable storage medium of map track
CN1605878A (en) Feeder line singlephase fault and multiphase fault distance measuring method based on wavelet decomposition frequency band feature
CN107124357A (en) A kind of cloud computing intelligent gateway
CN104601567A (en) Indexed security measurement system based on power information network security event mining
CN106405287A (en) Dominant harmonic wave source tracking method suitable for daily electric energy quality monitoring system application
WO2015124047A1 (en) Method and device for waveform analysis
CN110222063A (en) It is related to the Knowledge Sharing data query method and its equipment of block chain
CN105302691A (en) Metadata performance monitoring method and system
CN104849684A (en) Oscilloscope, correcting unit, and method of automatically correcting horizontal center of oscilloscope
CN109358942A (en) A kind of method, device and equipment of the monitoring page of adjustment management equipment software
CN108055257A (en) A kind of FPGA auxiliary high-performance calculation methods and FPGA
CN104849530A (en) MOA resistive current cardinal wave measuring method
CN113030648A (en) Method and device for determining position of fault point of power cable and terminal equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant