JP2741431B2 - Encoder that detects the movement position from any reference point - Google Patents

Encoder that detects the movement position from any reference point

Info

Publication number
JP2741431B2
JP2741431B2 JP3498691A JP3498691A JP2741431B2 JP 2741431 B2 JP2741431 B2 JP 2741431B2 JP 3498691 A JP3498691 A JP 3498691A JP 3498691 A JP3498691 A JP 3498691A JP 2741431 B2 JP2741431 B2 JP 2741431B2
Authority
JP
Japan
Prior art keywords
value
interpolation
sine wave
counter
wave
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.)
Expired - Lifetime
Application number
JP3498691A
Other languages
Japanese (ja)
Other versions
JPH04254708A (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.)
FANUC Corp
Original Assignee
FANUC Corp
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 FANUC Corp filed Critical FANUC Corp
Priority to JP3498691A priority Critical patent/JP2741431B2/en
Publication of JPH04254708A publication Critical patent/JPH04254708A/en
Application granted granted Critical
Publication of JP2741431B2 publication Critical patent/JP2741431B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Length Measuring Devices With Unspecified Measuring Means (AREA)
  • Transmission And Conversion Of Sensor Element Output (AREA)
  • Optical Transform (AREA)

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【産業上の利用分野】本発明は、回転軸の回転位置や移
動体の移動位置を検出するエンコーダに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an encoder for detecting a rotational position of a rotating shaft and a moving position of a moving body.

【0002】[0002]

【従来の技術】従来のエンコーダは、光学的若しくは磁
気的にコードが付されたコード板を回転軸若しくは移動
体に取り付け、該コード板のコードを検出する検出回路
を設け、上記回転軸,移動体が移動することによって上
記検出回路から発生する90度位相差のある正弦波信号
と余弦波信号を波形整形器で矩形波に整形し、該矩形波
の立ち上がり、立ち下がりをカウンタで計数することに
よって、正弦波1周期内を4分割した単位で上記回転軸
若しくは移動体の位置を検出するようにしている。
2. Description of the Related Art A conventional encoder mounts a code plate optically or magnetically provided with a code on a rotating shaft or a moving body, and has a detection circuit for detecting a code on the code plate. A sine wave signal and a cosine wave signal having a phase difference of 90 degrees generated from the detection circuit by the movement of the body are shaped into a rectangular wave by a waveform shaper, and the rise and fall of the rectangular wave are counted by a counter. Thus, the position of the rotation axis or the moving body is detected in units obtained by dividing one cycle of the sine wave into four.

【0003】また、上記正弦波sinθ,余弦波cos
θの値を縦軸、横軸に取り、リサジュー図形を描かせる
と円を描くことになるので、この正弦波sinθ,余弦
波cosθの値より、正弦波1サイクル中の回転角が分
かることになる。そこで、この2つの正弦波の値によっ
て正弦波1サイクルの内挿補間位置信号に基づいて位置
を検出するものも公知である。この場合、正弦波信号、
余弦波信号を矩形波に波形整形し、この矩形波の立ち上
がり、立ち下がりをカウンタでカウントして、正弦波1
周期内を4分割してカウントすると、カウンタの下位2
ビットをNL 、それ以外の上位のビットをNH とする
と、下位2ビットが0〜3まで変化する間は、正弦波1
サイクル内であり、下位2ビット以外の上位ビットの値
によって正弦波の数を示すことになる。一方、内挿補間
値をMとし正弦波1サイクル内をLに分割した位置を示
すものとすれば、上記カウンタの下位2ビット以外の上
位ビットの値で示される値と内挿補間値Mによって正弦
波1サイクルをL分割した位置までの高分解能の位置を
検出することができる。すなわち、位置Pは次の第1式
で求められることになる。
In addition, the sine wave sinθ and the cosine wave cos
When the value of θ is plotted on the vertical and horizontal axes and a Lissajous figure is drawn, a circle is drawn. Therefore, the rotation angle in one cycle of the sine wave can be determined from the values of the sine wave sin θ and cosine wave cos θ. Become. Therefore, a method of detecting a position based on an interpolation position signal of one cycle of a sine wave based on the values of the two sine waves is also known. In this case, a sine wave signal,
The cosine wave signal is shaped into a rectangular wave, and the rising and falling edges of the rectangular wave are counted by a counter, and the sine wave 1
When counting within a period divided into four, the lower 2
Assuming that the bit is NL and the other upper bits are NH, while the lower two bits change from 0 to 3, the sine wave 1
Within the cycle, the value of the upper bits other than the lower 2 bits indicates the number of sine waves. On the other hand, assuming that the interpolation value is M and the position where one cycle of the sine wave is divided into L is indicated by the value indicated by the value of the upper bits other than the lower 2 bits of the counter and the interpolation value M, A high-resolution position up to a position obtained by dividing one cycle of a sine wave into L can be detected. That is, the position P is obtained by the following first equation.

【0004】 P=NH ・L+M …(1) 一方、カウンタの下位2ビットの値が「0」になったと
き、すなわち、正弦波信号1サイクルを計数したとき、
内挿補間値Mも「0」になっていなければならない。内
挿開始の基準点位置が正弦波のゼロクロス点でなけれ
ば、正確な位置は検出できないことになる。そのため、
基準位置は正弦波のゼロクロス点(正弦波の始点)に正
確に調整する必要がある。
P = NH · L + M (1) On the other hand, when the value of the lower two bits of the counter becomes “0”, that is, when one cycle of the sine wave signal is counted,
The interpolation value M must also be "0". If the reference point position of the interpolation start is not the zero cross point of the sine wave, an accurate position cannot be detected. for that reason,
The reference position must be accurately adjusted to the zero cross point of the sine wave (the starting point of the sine wave).

【0005】[0005]

【発明が解決しようとする課題】しかし、基準位置と正
弦波のゼロクロス点を正確に合致させることは非常に難
しく、内挿補間値Mの演算遅れやその他の理由で、内挿
補間値Mの「0」とカウンタの下位2ビットの「0」が
合致しない場合がある。図5および図6はこのずれが生
じたときの関係を説明する図である。図5の(a)は正
弦波を示し、同(b)は内挿補間値Mを示し、同(c)
はカウンタの値を示している。カウンタの下位2ビット
NL が「0」で、下位2ビット以外の上位ビットの値N
H がnであるとき、内挿補間値Mは本来0〜(L/4)
の値でなければならない。しかし、図5(b)に示すよ
うに内挿補間値Mが内挿補間値の最大値Lに近い値であ
った場合、上記1式で位置を計算すると、 P=n・L+M=約(n+1)L となり、約1サイクル大きい値を位置Pとして検出して
しまう。
However, it is very difficult to accurately match the reference position with the zero-cross point of the sine wave. Due to the delay in the calculation of the interpolated interpolation value M and other reasons, the interpolation of the interpolated interpolation value M is difficult. In some cases, "0" does not match the lower two bits "0" of the counter. FIG. 5 and FIG. 6 are diagrams for explaining the relationship when this shift occurs. 5A shows a sine wave, FIG. 5B shows an interpolation value M, and FIG.
Indicates the value of the counter. When the lower two bits NL of the counter are "0" and the value N of the upper bits other than the lower two bits is N,
When H is n, the interpolated interpolation value M is originally 0 to (L / 4)
Must be a value of However, when the interpolation value M is close to the maximum value L of the interpolation value as shown in FIG. 5B, when the position is calculated by the above equation, P = n · L + M = about ( n + 1) L, and a value larger by about one cycle is detected as the position P.

【0006】また、図6に示すように、カウンタの下位
2ビットNL が「3」で、下位2ビット以外の上位ビッ
トの値NH が(n−1)の時、内挿補間値Mの値が
「0」に近い値であったとすると(正常であれば、M=
(3L/4)〜Lである)、1式の演算により、位置P
は次のようになり、約1サイクル分小さい値となる。
As shown in FIG. 6, when the lower two bits NL of the counter are "3" and the value NH of the upper bits other than the lower two bits is (n-1), the value of the interpolation value M is calculated. Is close to "0" (if normal, M =
(3L / 4) to L) The position P
Is as follows, and is smaller by about one cycle.

【0007】 P=(n−1)・L+M=約(n−1)・L そこで、本願出願人は、上記基準点と正弦波ゼロクロス
点のずれを補正するエンコーダを開発し、すでに特願平
2−312650号(特開平4−184217号公報)
として特許出願した。
P = (n−1) · L + M = approximately (n−1) · L Accordingly, the present applicant has developed an encoder that corrects the deviation between the reference point and the sine wave zero-crossing point, and has already disclosed in Japanese Patent Application No. Hei. 2-312650 (JP-A-4-184217)
As a patent application.

【0008】本願発明はさらに改良したもので、正弦波
ゼロクロス点と基準点(内挿補間の開始点)がずれてい
ても(内挿分割の1単位のずれ)、正確に位置を検出で
き、かつ任意の点を基準位置として位置を検出できるエ
ンコーダを提供することを目的とするものである。
The present invention is a further improvement in that even if the sine wave zero-cross point and the reference point (the start point of interpolation) are shifted (shift of one unit of interpolation division), the position can be detected accurately. It is another object of the present invention to provide an encoder capable of detecting a position using an arbitrary point as a reference position.

【0009】[0009]

【課題を解決するための手段】本発明は、コード板の移
動により、正弦波と余弦波を出力し、該正弦波,余弦波
から正弦波サイクルを4倍カウント(若しくは2倍)す
るカウンタと、上記正弦波と余弦波から正弦波1サイク
ル内を内挿補間する内挿補間手段を有し、上記カウンタ
の計数値と内挿補間手段の内挿値により移動位置を検出
するエンコーダの改良にかかわるもので、任意の基準位
置の上記カウンタの計数値と内挿補間値を記憶する記憶
手段と、上記カウンタと内挿補間手段より検出される計
数値と内挿補間値、及び上記記憶手段に記憶されたの計
数値と内挿補間値より現在位置と基準位置の正弦波始点
位置間の差を少数点以下を四捨五入して求め、該差に内
挿分割数を乗じた値に、検出されている内挿補間値から
上記基準位置の内挿補間値を減じた値を加算して移動位
置を算出し出力する手段を設けることにより、任意の基
準点からの移動位置を正確に検出するようにした。
According to the present invention, there is provided a counter which outputs a sine wave and a cosine wave by moving a code plate, and counts (or doubles) a sine wave cycle four times (or twice) from the sine wave and the cosine wave. An interpolating means for interpolating one cycle of the sine wave from the sine wave and the cosine wave, and an encoder for detecting a moving position based on the count value of the counter and the interpolated value of the interpolating means. The storage means for storing the count value and the interpolation value of the counter at an arbitrary reference position, the count value and the interpolation value detected by the counter and the interpolation means, and the storage means. From the stored count value and the interpolation value, the difference between the sine wave starting point position of the current position and the reference position is rounded down to the decimal point, and the difference is multiplied by the number of interpolation divisions. Out of the reference position from the interpolation value By providing a means for calculating and outputting the moving position by adding the value obtained by subtracting the interpolated values, and so as to accurately detect the moving position from an arbitrary reference point.

【0010】[0010]

【作用】図1は本発明の原理作用を説明する説明図で、
任意に設定された基準位置Psにおけるカウンタ(正弦
波を4倍にカウントするカウンタ)の値をNs内挿補間
値をMsとし、現在位置Prとして検出した上記カウン
タの値をNr、内挿補間値をMr、及び内挿補間分割数
をLとすると、設定基準位置Psにおける正弦波Csの
始点(ゼロクロス点で内挿補間の開始点)の位置Pss
は次の2式で表される。
FIG. 1 is an explanatory view for explaining the principle operation of the present invention.
The value of the counter at the arbitrarily set reference position Ps (counter for counting the sine wave quadruple) is Ns, the interpolation value is Ms, the value of the counter detected as the current position Pr is Nr, and the interpolation value is Nr. Is the position of the start point of the sine wave Cs at the set reference position Ps (the start point of the interpolation at the zero crossing point), where
Is represented by the following two equations.

【0011】 Pss=[(Ns/4)×L−Ms]/L …(2) また、現在位置Prにおける正弦波Crの始点の位置P
rsは次の3式で表される。
Pss = [(Ns / 4) × L−Ms] / L (2) Further, the position P of the start point of the sine wave Cr at the current position Pr
rs is represented by the following three equations.

【0012】 Prs=[(Nr/4)×L−Mr]/L …(3) そして、現在位置Prと設定基準位置間の正弦波サイク
ル数Kを上記現在位置Prの正弦波始点位置Prsから
設定基準位置Psの正弦波始点位置Pssを減じて小数
点以下を四捨五入して求める。正弦波サイクル数Kの値
は次の4式となる。
Prs = [(Nr / 4) × L−Mr] / L (3) Then, the sine wave cycle number K between the current position Pr and the set reference position is calculated from the sine wave start position Prs of the current position Pr. The sine wave starting point position Pss of the setting reference position Ps is subtracted, and the decimal part is rounded off. The value of the sine wave cycle number K is expressed by the following four equations.

【0013】 K=Prs−Pss =[(Nr−Ns)×(L/4)−Mr+Ms]/L …(4) (小数点以下四捨五入) 次に、上記正弦波サイクル数Kの値に内挿分割数Lを乗
じ、現在位置として検出されている内挿補間値Mrから
設定基準位置の内挿補間値Msを減じた値を加算するこ
とによって現在位置Prは次の5式のようにして求めら
れる。
K = Prs−Pss = [(Nr−Ns) × (L / 4) −Mr + Ms] / L (4) (rounded off to the decimal point) By multiplying the number L and adding a value obtained by subtracting the interpolation value Ms at the set reference position from the interpolation value Mr detected as the current position, the current position Pr is obtained as in the following five equations. .

【0014】 Pr=K×L+Mr−Ms …(5) 次に上記2〜5式で求められる現在位置Prが正確に求
められる理由について説明する。
Pr = K × L + Mr−Ms (5) Next, the reason why the current position Pr obtained by the above equations 2 to 5 is accurately obtained will be described.

【0015】図2に示すように設定基準位置Psや現在
位置Prがカウンタの切換え位置にあるとき(これら切
換え位置にないときは検出位置誤差は格別生じないが、
設定基準位置Ps,現在位置Prは任意の位置をとり得
るものであるので、これら切換え位置にある場合も想定
しておかねばならない。)、基準位置Psのカウンタの
値Nsは「ns」か若しくは「ns+1」をとり得る。
そして、そのときの内挿補間値Msは「ms」若しくは
「ms+1」の値をとり得る。また、現在位置Prのカ
ウンタの値も「nr」か「nr+1」の値をとり得る
し、内挿補間値Mrも「mr」,「mr+1」の値をと
り得る。その結果現在値のカウンタの値Nr及び内挿補
間値Mrから、設定基準位置のカウンタの値Ns及び内
挿補間値Msをそれぞれ減じた値は次のようになる。
As shown in FIG. 2, when the set reference position Ps or the current position Pr is at the switching position of the counter (when the setting reference position Ps or the present position Pr is not at the switching position, the detection position error does not occur particularly,
Since the set reference position Ps and the current position Pr can take arbitrary positions, it is necessary to assume that these positions are at these switching positions. ), The value Ns of the counter at the reference position Ps can be “ns” or “ns + 1”.
Then, the interpolation value Ms at that time can take a value of “ms” or “ms + 1”. Further, the value of the counter at the current position Pr can also take the value of “nr” or “nr + 1”, and the interpolation value Mr can take the values of “mr” and “mr + 1”. As a result, values obtained by subtracting the counter value Ns and the interpolation value Ms at the set reference position from the current value Nr and the interpolation value Mr of the counter are as follows.

【0016】 Ns−Nr=nr−ns=n (nr−ns=nとおく) =nr−ns−1=n−1 =nr+1−ns=n+1 =nr+1−ns−1=n Mr−Ms=mr−ms=m (mr−ms=mとおく) =mr−ms−1=m−1 =mr+1−ms=m+1 =mr+1−ms−1=m 以上のように、(Ns−Nr)の値はn−1,n,n+
1の3通り、(Mr−Ms)の値はm−1,m,m+1
の3通りをとり得ることになる。そのため、上記4式で
求める四捨五入する前のKの値の最大値Kmax は次の6
式のようになる。
Ns−Nr = nr−ns = n (nr−ns = n) = nr−ns−1 = n−1 = nr + 1−ns = n + 1 = nr + 1−ns−1 = n Mr−Ms = mr -Ms = m (assuming mr-ms = m) = mr-ms-1 = m-1 = mr + 1-ms = m + 1 = mr + 1-ms-1 = m As described above, the value of (Ns-Nr) is n-1, n, n +
1, the value of (Mr-Ms) is m-1, m, m + 1
It can take three ways. Therefore, the maximum value Kmax of the value of K before rounding obtained by the above equation (4) is
It looks like an expression.

【0017】 Kmax =[(n+1)×(L/4)−(m−1)]/L =(1/L)[(n×L/4)−m]+[(1/4)+(1/L)] …(6) また最小値Kmin は次の7式となる。Kmax = [(n + 1) × (L / 4) − (m−1)] / L = (1 / L) [(n × L / 4) −m] + [(1/4) + ( 1 / L)] (6) The minimum value Kmin is given by the following equation (7).

【0018】 Kmin =[(n−1)×(L/4)−(m+1)]/L =(1/L)[(n×L/4)−m]−[(1/4)+(1/L)] …(7) 一方、正弦波のゼロクロス点と内装基準位置が合致して
正確な値が出力されていて、NS=ns,Ms=ms,
Nr=nr,Mr=mrであるとすると、設定基準位置
Psから現在位置Prまでの正弦波サイクル数Kの値は
次の8式の値となる。
Kmin = [(n−1) × (L / 4) − (m + 1)] / L = (1 / L) [(n × L / 4) −m] − [(1/4) + ( 1 / L)] (7) On the other hand, the zero-cross point of the sine wave matches the interior reference position, and an accurate value is output. NS = ns, Ms = ms,
Assuming that Nr = nr and Mr = mr, the value of the sine wave cycle number K from the set reference position Ps to the current position Pr is the value of the following equation (8).

【0019】 K=Prs−Pss =[(nr−ns)×(L/4)−mr+ms]/L =[n×(L/4)−m]/L …(8) 上記8式で示すKの値は、正弦波のゼロクロス点と内挿
基準位置が合致し、設定基準位置Psから現在位置Pr
までの正弦波の始点間のサイクル数であるから、整数で
ある。このことは6式、7式における右辺第1項は上記
8式から整数であることを示し、Kmax ,Kmin の
[(1/4)+(1/L)]は少数部であることが分か
る。内挿分割数Lの値は正弦波はカウンタで4分割して
いるのであるから、内挿分割数Lの値は正弦波を4分割
以上に分割するものであるのでL>4である。その結果
上記少数部は、[(1/4)+(1/L)]<0.5と
なる。すなわち、8式で示されるKの値をK0(整数)
とすると、上記Kのとり得る範囲は次のようになる。
K = Prs−Pss = [(nr−ns) × (L / 4) −mr + ms] / L = [n × (L / 4) −m] / L (8) K represented by the above equation (8) Is determined when the zero-cross point of the sine wave matches the interpolation reference position, and the current position Pr
It is an integer since it is the number of cycles between the start points of the sine wave up to. This means that the first term on the right side in Equations 6 and 7 is an integer from Equation 8, and that [(1/4) + (1 / L)] of Kmax and Kmin is a decimal part. . Since the value of the interpolation division number L is obtained by dividing the sine wave into four by the counter, the value of the interpolation division number L divides the sine wave into four or more divisions, so that L> 4. As a result, [(1/4) + (1 / L)] <0.5 for the above-mentioned minority part. That is, the value of K expressed by equation 8 is represented by K0 (integer)
Then, the possible range of K is as follows.

【0020】K0−0.5<K<K0+0.5 このことはKの値を四捨五入すれば、必ずK0となり、
正弦波のゼロクロス点と内挿基準位置がずれていても、
上記4式の演算を行ない四捨五入することによって正確
な正弦波サイクル数K0を求めることができる。現在位
置Prは5式に示すように、この正確な正弦波サイクル
数K0に内挿分割数Lを乗じ、さらに、現在位置の内挿
補間値mrから設定基準位置Psの内挿補間値msを減
じた値を加算した値となるので、内挿補間値mr,ms
の差の誤差は最大で内挿分割単位で「2」であるから大
きな検出誤差はなくなる。
K0−0.5 <K <K0 + 0.5 This means that if the value of K is rounded off, it always becomes K0,
Even if the zero-cross point of the sine wave is shifted from the interpolation reference position,
By performing the calculation of the above four equations and rounding off, the exact number of sine wave cycles K0 can be obtained. As shown in Equation 5, the current position Pr is obtained by multiplying the accurate sine wave cycle number K0 by the interpolation division number L, and further calculating the interpolation value ms of the set reference position Ps from the interpolation value mr of the current position. The value obtained by adding the subtracted value is the interpolation value mr, ms
Since the error of the difference is "2" at the maximum in the unit of interpolation division, there is no large detection error.

【0021】また、基準位置Psは任意に設定できるの
で、動作開始直後に基準位置をPsを決めそのときのカ
ウンタの値,内挿補間値の値を記憶させておけばよい。
Since the reference position Ps can be set arbitrarily, the reference position Ps is determined immediately after the operation starts, and the value of the counter and the value of the interpolation value at that time may be stored.

【0022】[0022]

【実施例】図3は本発明の一実施例のロータリエンコー
ダのブロック図である。図3中、1はコード板で、該コ
ード板1は回転軸等に固着され、回転軸が回転すること
によってコード板1も回転し、このコード板1に配設さ
れたコードを検出する検出回路2からは従来のロータリ
エンコーダと同様に、90度位相差がある正弦波(疑似
正弦波)sinθ,余弦波cosθを出力する。この2
つの正弦波,余弦波は波形整形回路3で矩形波に整形さ
れ、カウンタ4でこの2つの矩形波のエッジ、すなわ
ち、立ち上がり、立ち下がりが計数される。そして、入
力ポート5を介してマイクロコンピュータ(MPU)1
0に入力される。
FIG. 3 is a block diagram of a rotary encoder according to one embodiment of the present invention. In FIG. 3, reference numeral 1 denotes a code plate. The code plate 1 is fixed to a rotating shaft or the like, and the rotation of the rotating shaft causes the code plate 1 to rotate, thereby detecting a code disposed on the code plate 1. The circuit 2 outputs a sine wave (pseudo sine wave) sinθ and a cosine wave cosθ having a phase difference of 90 degrees, similarly to the conventional rotary encoder. This 2
The two sine waves and cosine waves are shaped into rectangular waves by the waveform shaping circuit 3, and the edges of the two rectangular waves, that is, the rising and falling edges, are counted by the counter 4. Then, the microcomputer (MPU) 1 via the input port 5
Input to 0.

【0023】一方、上記正弦波,余弦波はタイミングパ
ルス発生器12から出力されるタイミングパルスによっ
てサンプルホールド回路6,7でサンプルホールドさ
れ、このサンプルホールドされた正弦波,余弦波の値
は、アナログ/ディジタル変換器(A/D変換器)8,
9でディジタル値に変換されMPU10に入力される。
On the other hand, the sine and cosine waves are sampled and held by the sample and hold circuits 6 and 7 by timing pulses output from the timing pulse generator 12, and the values of the sampled and held sine and cosine waves are analog. / Digital converter (A / D converter) 8,
At 9, it is converted into a digital value and input to the MPU 10.

【0024】上記検出回路2、波形整形回路3、カウン
タ4はバッテリバックアップされており、電源がOFF
になっても、コード板1の回転を検出できるようになっ
ている。そのため、電源がOFFの状態で回転軸が回転
してもカウンタ4は回転位置を検出しており、電源復旧
時にはこのカウンタ4の値とA相,B相の信号によって
得られる内挿位置によって正確に位置を検出できるよう
になっている。
The detection circuit 2, the waveform shaping circuit 3, and the counter 4 are backed up by a battery, and are turned off.
, The rotation of the code plate 1 can be detected. Therefore, even if the rotary shaft rotates while the power is off, the counter 4 detects the rotation position, and when the power is restored, the counter 4 accurately determines the value of the counter 4 and the interpolation position obtained from the A-phase and B-phase signals. Position can be detected.

【0025】MPU10は、本実施例において、後述す
る設定基準位置Psと上記カウンタ4,A/D変換器
8,9の値より移動位置Prを算出し出力する手段を構
成するもので、プロセッサ(CPU)、入力回路,出力
回路等で構成されている。11はMPU10のプロセッ
サが実施するプログラムや正弦波,余弦波の値より正弦
波1周期内の内挿位置を割り出すためのテーブル等を記
憶するROM,および各種演算データの一時記憶等に利
用されるRAM等で構成されたメモリである。
In this embodiment, the MPU 10 constitutes means for calculating and outputting the movement position Pr from a set reference position Ps, which will be described later, and the values of the counters 4 and the A / D converters 8 and 9. CPU), an input circuit, an output circuit, and the like. A ROM 11 stores a program executed by the processor of the MPU 10, a table for determining an interpolation position within one cycle of the sine wave from the values of the sine wave and the cosine wave, and a temporary storage of various operation data. This is a memory configured by a RAM or the like.

【0026】回転軸およびコード板1が回転し、検出回
路2から正弦波信号,余弦波信号が出力されると、該各
信号は波形整形回路3で波形整形され矩形波に変換さ
れ、この各矩形波のエッジがカウンタ4で計数されるこ
とになる。そのため、カウンタ4は正弦波1サイクルで
4パルスを計数することになり、1サイクルを4倍の値
で検出することになる。
When the rotation axis and the code plate 1 are rotated and a sine wave signal and a cosine wave signal are output from the detection circuit 2, the respective signals are shaped by a waveform shaping circuit 3 and converted into rectangular waves. The edge of the rectangular wave is counted by the counter 4. Therefore, the counter 4 counts four pulses in one cycle of the sine wave, and detects one cycle as a quadruple value.

【0027】一方、サンプルホールド回路6,7はタイ
ミングパルス発生器12からのタイミングパルスによっ
て正弦波,余弦波をサンプルホールドしA/D変換器
8,9がこのホールド値をディジタル値に変換し出力す
る。また、タイミングパルスはMPU10にも入力さ
れ、MPU10はサンプルパルスが入力されると、位置
Prを算出し出力する。
On the other hand, the sample and hold circuits 6 and 7 sample and hold sine and cosine waves according to the timing pulse from the timing pulse generator 12, and the A / D converters 8 and 9 convert the hold values into digital values and output them. I do. The timing pulse is also input to the MPU 10, and when the sample pulse is input, the MPU 10 calculates and outputs the position Pr.

【0028】正弦波信号,余弦波は90度位相差があ
る。そのため、例えば正弦波の値を横軸、余弦波の値を
縦軸に取ってリサジュー図形を描かせると円となり、正
弦波,余弦波の値の組み合わせは正弦波1サイクル内の
位相位置を表すことになる。そこで、正弦波1サイクル
の360度をL分割し、各正弦波,余弦波の値の組み合
わせに応じて分割位置をメモリ11のROM内に記憶さ
せておき、正弦波,余弦波の値に応じてメモリ11から
読み出すことによって、1サイクルをL分割した位置、
すなわち内挿補間値を検出することができる。若しく
は、従来から行われているニュートン法によって正弦
波、余弦波の値から、1サイクル内の内挿位置を演算す
ることもできる。
The sine wave signal and cosine wave have a phase difference of 90 degrees. Therefore, for example, when a Lissajous figure is drawn by taking the value of the sine wave on the horizontal axis and the value of the cosine wave on the vertical axis, a circle is formed, and the combination of the sine wave and cosine wave values represents the phase position in one cycle of the sine wave. Will be. Therefore, 360 degrees of one cycle of the sine wave are divided into L, and division positions are stored in the ROM of the memory 11 according to the combination of the values of each sine wave and cosine wave. Read from the memory 11 to obtain a position obtained by dividing one cycle into L,
That is, an interpolation value can be detected. Alternatively, the interpolation position within one cycle can be calculated from the values of the sine wave and the cosine wave by the Newton's method conventionally used.

【0029】次に本実施例の動作を説明する。まず、該
エンコーダに電源をいれたとき、基準位置Psを設定す
る。この基準位置Psは任意の位置でよく、例えば、エ
ンコーダが取り付けられた回転軸の特定位置を基準位置
として入力しておく。基準位置が入力されるとMPU1
0は入力されたときのカウンタ4の値Ns及び、A/D
変換器から出力されている正弦波,余弦波の値より求め
られる内挿補間位置Msをメモリ11内に記憶しこの値
Ns,Msが設定基準位置Psとなる。
Next, the operation of this embodiment will be described. First, when power is supplied to the encoder, a reference position Ps is set. The reference position Ps may be an arbitrary position. For example, a specific position of the rotary shaft to which the encoder is attached is input as a reference position. When the reference position is input, MPU1
0 is the value Ns of the counter 4 when it is input, and A / D
The interpolation interpolation position Ms obtained from the values of the sine and cosine waves output from the converter is stored in the memory 11, and these values Ns and Ms become the set reference positions Ps.

【0030】次に、MPU10は図4に示す処理を開始
し、サンプルパルス発生器12から発生するサンプルパ
ルスを検出する毎に(ステップS1)、カウンタ4の値
Nrを入力ポート5を介して読み込むと共に、A/D変
換器8,9の値を読み込み内挿補間値Mrを算出する
(ステップS2)。次に、設定された基準位置の値N
s,Msと読み取ったカウンタ値Nr,内挿補間値Mr
及び内挿分割数Lより、4式の演算を行い、小数点以下
を四捨五入し、正弦波サイクル数Kを求め、求められた
正弦波サイクル数Kと内挿補間値Ms,Mr、内挿分割
数Lより5式の演算を行なって現在位置Prを求め出力
する(ステップS3)。以下この処理をサンプルパルス
を検出する毎に行なう。
Next, the MPU 10 starts the processing shown in FIG. 4, and reads the value Nr of the counter 4 through the input port 5 every time a sample pulse generated from the sample pulse generator 12 is detected (step S1). At the same time, the values of the A / D converters 8 and 9 are read to calculate an interpolation value Mr (step S2). Next, the value N of the set reference position
s, Ms, the read counter value Nr, and the interpolated interpolation value Mr
And the interpolation division number L, the arithmetic operation of Equation 4 is performed, and the decimal part is rounded off to obtain a sine wave cycle number K. The calculated sine wave cycle number K, the interpolation values Ms and Mr, and the interpolation division number are calculated. The current position Pr is obtained by performing the calculation of equation (5) from L and output (step S3). Hereinafter, this process is performed every time a sample pulse is detected.

【0031】次に、本実施例によると、誤差が大きく生
じないことを示す一例を説明する。例えば、内挿分割数
L=100とし、図2において設定基準位置Psのカウ
ンタ4の値nsが「10」であったとする。このカウン
タの値ns=10に対応する内挿補間値msは0〜24
であるはずであるが、誤差がいることにより、内挿補間
値msが1〜25をとり得ることがある。そうすると、
カウンタ4の値nsも「10」か「11」か分からなく
なる。すなわち、図2に示すような設定基準位置ではカ
ウンタの値Nsと内挿補間値Msの組み合わせは次の4
通りが考えられる。 (Ns,Ms)=(10,24),(10,25),
(11,24),(11,25) 同様に、現在位置Prも図2に示すような状態で、カウ
ンタ4の値nrが「16」であると、カウンタの値Ns
と内挿補間値Msの組み合わせは次の4通りが考えられ
る。 (Nr,Mr)=(16,74),(16,74),
(17,75),(17,75) このカウンタの値Ns,Nr、内挿補間値Ms,Mrの
どの組み合わせにおいても、上述した4式で算出する正
弦波サイクル数Kの値は常に同じでなければならない。
さもないと、5式に示すように現在位置Prは正弦波1
サイクル分ずれることになる。そこで、 Nr−Ns=5,6,7の3通りであり、 Mr−Ms=49,50,51の3通りである。
Next, an example will be described in which this embodiment shows that a large error does not occur. For example, assume that the number of interpolation divisions L is 100 and the value ns of the counter 4 at the set reference position Ps in FIG. 2 is “10”. The interpolation value ms corresponding to the counter value ns = 10 is 0 to 24.
However, there is a case where the interpolation value ms can be 1 to 25 due to the presence of an error. Then,
The value ns of the counter 4 is not known whether it is "10" or "11". That is, at the setting reference position as shown in FIG. 2, the combination of the counter value Ns and the interpolation value Ms is
The street is conceivable. (Ns, Ms) = (10, 24), (10, 25),
(11, 24), (11, 25) Similarly, when the current position Pr is also as shown in FIG. 2 and the value nr of the counter 4 is “16”, the value Ns of the counter is
And the interpolated interpolation value Ms are considered in the following four combinations. (Nr, Mr) = (16, 74), (16, 74),
(17, 75), (17, 75) Regardless of the combination of the counter values Ns and Nr and the interpolation values Ms and Mr, the value of the sine wave cycle number K calculated by the above equation (4) is always the same. There must be.
Otherwise, as shown in Equation 5, the current position Pr is a sine wave 1
It will be shifted by a cycle. Therefore, there are three types of Nr-Ns = 5, 6, 7 and three types of Mr-Ms = 49, 50, 51.

【0032】上記Kの値が最大となる組み合わせはNr
−Ns=7でMr−Ms=49のときであり、 K=(7×25−49)/100=1 (1.26を四
捨五入) 上記Kの値が最小となる組み合わせはNr−Ns=5で
Mr−Ms=51のときであり、 K=(5×25−51)/100=1 (0.75を四
捨五入) となりKの値は常に一定となる。その結果5式で算出さ
れる現在位置Prは(Mr−Ms)によって生じる誤差
だけとなり、大きな影響はない。
The combination that maximizes the value of K is Nr
−Ns = 7 and Mr−Ms = 49, K = (7 × 25−49) / 100 = 1 (rounds 1.26) The combination that minimizes the value of K is Nr−Ns = 5 At the time of Mr−Ms = 51, and K = (5 × 25−51) / 100 = 1 (round off 0.75), and the value of K is always constant. As a result, the current position Pr calculated by equation (5) is only an error caused by (Mr−Ms), and has no significant effect.

【0033】なお、上記実施例では、タイミングパルス
発生器12を設けるようにしたが、このタイミングパル
ス発生器12の代わりに、MPU10から所定周期毎
(図4に示す処理周期毎)信号を出力させ、この信号
で、サンプルホールドさせると共にその後わずかな遅延
をおいて入力回路12,13からデータを読み込み図4
に示す処理を実施するようにしてもよい。
In the above embodiment, the timing pulse generator 12 is provided, but instead of the timing pulse generator 12, a signal is output from the MPU 10 at predetermined intervals (every processing interval shown in FIG. 4). The data is read from the input circuits 12 and 13 with this signal, sampled and held and with a slight delay thereafter.
May be performed.

【0034】さらに、上記実施例では、検出回路2、波
形整形回路3、カウンタ4をバッテリバックアップする
ようにしたが、バッテリバックアップしないときには、
電源投入後にエンコーダで移動位置を検出する移動する
回転軸もしくは移動体を特定位置に位置決めし、この位
置を基準位置としてカウンタの値Ns,内挿補間値Ms
を記憶させるようにしてもよい。
Further, in the above embodiment, the detection circuit 2, the waveform shaping circuit 3, and the counter 4 are backed up by a battery.
After the power is turned on, a moving rotary shaft or a moving body for detecting a moving position is positioned at a specific position by an encoder, and the position is used as a reference position to set a counter value Ns and an interpolation value Ms.
May be stored.

【0035】[0035]

【発明の効果】本発明においては、基準位置として任意
の基準位置を設定できると共に、正弦波のゼロクロス点
と内挿補間の開始点がずれていても、正確に位置を検出
することができる。
According to the present invention, an arbitrary reference position can be set as the reference position, and the position can be accurately detected even if the zero-cross point of the sine wave is shifted from the start point of the interpolation.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明の作用原理を説明する説明図である。FIG. 1 is an explanatory diagram illustrating the operation principle of the present invention.

【図2】誤差発生原因の説明図である。FIG. 2 is an explanatory diagram of an error generation cause.

【図3】本発明の一実施例のロータリエンコーダのブロ
ック図である。
FIG. 3 is a block diagram of a rotary encoder according to one embodiment of the present invention.

【図4】同実施例のマイクロコンピュータが実施する処
理のフローチャートである。
FIG. 4 is a flowchart of a process performed by the microcomputer of the embodiment.

【図5】カウンタの値と内挿補間位置のずれを説明する
説明図である。
FIG. 5 is an explanatory diagram illustrating a difference between a counter value and an interpolation position.

【図6】カウンタの値と内挿補間位置の他のずれを説明
する説明図である。
FIG. 6 is an explanatory diagram for explaining another difference between a counter value and an interpolation position.

【符号の説明】[Explanation of symbols]

1 コード板 2 検出回路 3 波形整形回路 4 カウンタ 5 入力ポート 6,7 サンプルホールド回路 8,9 アナログ/ディジタル変換器(A/D変換器) 10 マイクロコンピュータ(MPU) 11 メモリ 12 サンプルパルス発生器 Ps 設定基準位置 Pr 現在位置 1 code board 2 detection circuit 3 waveform shaping circuit 4 counter 5 input port 6,7 sample hold circuit 8,9 analog / digital converter (A / D converter) 10 microcomputer (MPU) 11 memory 12 sample pulse generator Ps Setting reference position Pr current position

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 コード板の移動により、正弦波と余弦波
を出力し、該正弦波,余弦波から正弦波サイクルを4倍
カウントするカウンタと、上記正弦波と余弦波から正弦
波1サイクル内を内挿補間する内挿補間手段を有し、上
記カウンタの計数値と内挿補間手段の内挿値により移動
位置を検出するエンコーダにおいて、任意の基準位置の
上記カウンタの計数値と内挿補間値を記憶する記憶手段
と、上記カウンタと内挿補間手段より検出される計数値
と内挿補間値、及び上記記憶手段に記憶された計数値と
内挿補間値より現在位置と基準位置の正弦波始点位置間
の差を少数点以下を四捨五入して求め、該差に内挿分割
数を乗じた値に、検出されている内挿補間値から上記基
準位置の内挿補間値を減じた値を加算して移動位置を算
出し出力する手段を備えたことを特徴とする任意の基準
点からの移動位置を検出するエンコーダ。
1. A counter for outputting a sine wave and a cosine wave by moving a code plate, counting the sine wave cycle from the sine wave and the cosine wave four times, and within one cycle of the sine wave from the sine wave and the cosine wave. In an encoder having interpolation means for interpolating the count value and detecting the moving position based on the count value of the counter and the interpolation value of the interpolation interpolation means, the count value of the counter at an arbitrary reference position and the interpolation value A storage means for storing a value, a count value and an interpolation value detected by the counter and the interpolation means, and a sine of a current position and a reference position based on the count value and the interpolation value stored in the storage means. The difference between the wave starting point positions is obtained by rounding off the decimal point or less, and a value obtained by subtracting the interpolation value at the reference position from the detected interpolation value to the value obtained by multiplying the difference by the number of interpolation divisions. Means to calculate and output the movement position by adding An encoder for detecting a movement position from an arbitrary reference point.
JP3498691A 1991-02-06 1991-02-06 Encoder that detects the movement position from any reference point Expired - Lifetime JP2741431B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3498691A JP2741431B2 (en) 1991-02-06 1991-02-06 Encoder that detects the movement position from any reference point

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3498691A JP2741431B2 (en) 1991-02-06 1991-02-06 Encoder that detects the movement position from any reference point

Publications (2)

Publication Number Publication Date
JPH04254708A JPH04254708A (en) 1992-09-10
JP2741431B2 true JP2741431B2 (en) 1998-04-15

Family

ID=12429470

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3498691A Expired - Lifetime JP2741431B2 (en) 1991-02-06 1991-02-06 Encoder that detects the movement position from any reference point

Country Status (1)

Country Link
JP (1) JP2741431B2 (en)

Also Published As

Publication number Publication date
JPH04254708A (en) 1992-09-10

Similar Documents

Publication Publication Date Title
EP0840096B1 (en) Interpolation circuit for encoder
EP0331189B1 (en) Position/speed detection method and apparatus
JPH0534105A (en) Multiple-rotation absolute-value encoder
JP4782434B2 (en) Rotation detection device signal processing device
JP2741431B2 (en) Encoder that detects the movement position from any reference point
JPH0835857A (en) Method for detecting angle of rotation
JP2003130686A (en) Device for detecting position
JPH0529045B2 (en)
JP3365913B2 (en) Position detection device
JPH08334526A (en) Speed detection device
JPH04355326A (en) Rotary encoder with electrical angle output function
JPH04184217A (en) High resolution position detector
JP3449177B2 (en) Position detection device with incremental encoder
JP3092100B2 (en) Position detector with error correction function
JPH07190807A (en) Pulse count circuit of encoder
JPH04254709A (en) Rotary encoder with reference position output
JP2002311040A (en) Speed detector
JP3451851B2 (en) Rotation speed detector
JP2551680B2 (en) Position detection device
JP3248209B2 (en) Position detection method
JP2001330476A (en) Position detecting method
JPH0661861A (en) Encoder signal processing multiplier
JPH05332788A (en) Data processing device for rotary encoder
JPH01223310A (en) Position detector
JPH0528486Y2 (en)