[go: up one dir, main page]

JP2013011456A - Arithmetic operation device, relative movement amount measurement apparatus, and arithmetic operation method - Google Patents

Arithmetic operation device, relative movement amount measurement apparatus, and arithmetic operation method Download PDF

Info

Publication number
JP2013011456A
JP2013011456A JP2011142907A JP2011142907A JP2013011456A JP 2013011456 A JP2013011456 A JP 2013011456A JP 2011142907 A JP2011142907 A JP 2011142907A JP 2011142907 A JP2011142907 A JP 2011142907A JP 2013011456 A JP2013011456 A JP 2013011456A
Authority
JP
Japan
Prior art keywords
value
input
output
output value
signal
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.)
Pending
Application number
JP2011142907A
Other languages
Japanese (ja)
Inventor
Takahiro Imai
貴博 今井
Yoshio Kaida
佳生 海田
Hirokazu Miyamoto
寛和 宮本
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.)
TDK Corp
Original Assignee
TDK 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 TDK Corp filed Critical TDK Corp
Priority to JP2011142907A priority Critical patent/JP2013011456A/en
Publication of JP2013011456A publication Critical patent/JP2013011456A/en
Pending legal-status Critical Current

Links

Landscapes

  • Transmission And Conversion Of Sensor Element Output (AREA)
  • Measurement Of Length, Angles, Or The Like Using Electric Or Magnetic Means (AREA)

Abstract

PROBLEM TO BE SOLVED: To solve the problems that an arithmetic operation for acquiring an output from a set of input signals with different phases requires a complex operation such as arctan, thereby increasing a load on the arithmetic operation circuit, and when acquiring an output in reference with a lookup table for reducing the load on the arithmetic operation circuit, the size of required memory increases.SOLUTION: An input value X is defined as X=F(IN1, IN2) using a function F for a set of input signals IN1 and IN2 with different phases. The function F is defined so that the relation between the input values X and Y becomes approximately linear, whereby it is possible to acquire an output value predicted from the input value without using a complex arithmetic operation. In the case of referring to a lookup table, only difference between input values and predicted output values are tabulated, whereby it is possible to reduce memory.

Description

本発明は、位相の異なる1対の信号から出力を求める演算装置、演算方法に関する。 The present invention relates to an arithmetic device and an arithmetic method for obtaining an output from a pair of signals having different phases.

位相の異なる1対の信号から出力を求める演算は、位置センサをはじめとする各種センサ等で使用されている。例えば、sin、cosのような信号からtan演算を行い、さらにarctan演算を行うことにより位相を求める方法等があげられる。 Calculations for obtaining an output from a pair of signals having different phases are used in various sensors including a position sensor. For example, there is a method of obtaining a phase by performing a tan operation from signals such as sin and cos and further performing an arctan operation.

arctan演算を用いないでかつ精度を向上させる方法として、例えば、特許文献1に記載の方法では、信号の演算結果と位相の関係を予めテーブル化しておき、そのテーブルを参照する方法が提案されている。 As a method for improving the accuracy without using the arctan operation, for example, in the method described in Patent Document 1, a method is proposed in which a relation between a signal operation result and a phase is tabulated in advance and the table is referred to. Yes.

特許第4343585号(NTN株式会社)Patent No. 4343585 (NTN Corporation)

しかしながら、arctan演算は、ソフトウェアで実現する場合には演算回路の負荷が大きいという問題があり、ハードウェアで実現する場合には回路規模が大きくなるという問題がある。また、特許第4343585号に記載の方法ではarctan演算は必要ないが、テーブルを作成するために多くのメモリを必要とするという問題がある。 However, the arctan calculation has a problem that the load on the arithmetic circuit is large when realized by software, and the circuit scale becomes large when realized by hardware. The method described in Japanese Patent No. 4343585 does not require an arctan operation, but has a problem that a large amount of memory is required to create a table.

本発明は、上記に鑑みてなされたものであって、演算回路の負荷を軽減、または必要メモリの削減を実現するものである。   The present invention has been made in view of the above, and is intended to reduce the load on the arithmetic circuit or reduce the necessary memory.

上述した課題を解決し、目的を達成するために、本発明は、所定の電気角位相差を有する一対の第1の入力信号のそれぞれと多対一の関係を有する第1の出力値とを対応付けるように第1の入力信号に第1の演算を行い定義された第1の入力値を受け、第1の入力値を引数とした一次関数に基づいて、第1の入力値に対応する一次関数上の第2の出力値を第1の出力値として出力する演算手段を有する演算装置であることを特徴とする。 In order to solve the above-described problems and achieve the object, the present invention provides a first output value having a many-to-one relationship with each of a pair of first input signals having a predetermined electrical angle phase difference. The first input corresponding to the first input value is received based on a linear function having the first input value as an argument, receiving a first input value defined by performing a first operation on the first input signal to be associated It is an arithmetic unit having arithmetic means for outputting a second output value on a function as a first output value.

この演算装置は、複雑な関数を使用することなく出力を求められるという作用がある。その結果、この演算装置は、演算回路の負荷を軽減するという効果が得られる。 This arithmetic device has an effect that an output can be obtained without using a complicated function. As a result, this arithmetic device has the effect of reducing the load on the arithmetic circuit.

本発明の望ましい態様としては、所定の電気角位相差を有する一対の第1の入力信号のそれぞれと多対一の関係を有する第1の出力値とを対応付けるように第1の入力信号に第1の演算を行い定義された第1の入力値を引数とした一次関数に基づいた第1の入力値に対応する一次関数上の第2の出力値と、第1の出力値と、の差分を、第1の入力値と対応付けるアドレス関数により定義されたアドレスを引数とする配列要素に格納した第1のテーブルを有する記憶部から第1のテーブルを読み出すとともに、第1の入力値を受け、第1の入力値に対応する第2の出力値と、第1の入力値に対応する配列要素に格納された値と、に基づいて第1の出力値を出力する演算手段を有する演算装置であることが好ましい。 As a desirable aspect of the present invention, the first input signal is associated with the first output value having a many-to-one relationship with each of the pair of first input signals having a predetermined electrical angle phase difference. The difference between the first output value and the second output value on the linear function corresponding to the first input value based on the linear function using the first input value defined by performing the operation of 1 as an argument Read out the first table from the storage unit having the first table stored in the array element having the argument defined by the address function associated with the first input value, and receives the first input value, An arithmetic device having arithmetic means for outputting a first output value based on a second output value corresponding to the first input value and a value stored in an array element corresponding to the first input value. Preferably there is.

この演算装置は、入力値と出力値の関係を模擬する直線を定義し、この直線と出力値との差のみをテーブル化するという作用がある。その結果、出力値を直接テーブルに収納するタイプの信号処理方法と比較するとメモリを削減できるという効果が得られる。 This computing device has the effect of defining a straight line that simulates the relationship between the input value and the output value, and tabulating only the difference between this straight line and the output value. As a result, the memory can be reduced as compared with a signal processing method in which output values are directly stored in a table.

本発明の望ましい態様としては、所定の電気角位相差を有する一対の第1の入力信号のそれぞれと多対一の関係を有する第1の出力値とを対応付けるように第1の入力信号に第1の演算を行い定義された第1の入力値を引数とした一次関数上の第1の出力値に対応する第2の入力値と、第1の入力値と、の差分を、第1の入力値と対応付けるアドレス関数により定義されたアドレスを引数とする配列要素に格納した第2のテーブルを有する記憶部から第2のテーブルを読み出すとともに、第1の入力値を受け、第1の入力値と、第1の入力値に対応する配列要素に格納された値と、に基づいて第2の入力値に対応する第1の出力値を出力する演算手段を有する演算装置であることが好ましい。 As a desirable aspect of the present invention, the first input signal is associated with the first output value having a many-to-one relationship with each of the pair of first input signals having a predetermined electrical angle phase difference. The difference between the first input value and the second input value corresponding to the first output value on the linear function using the first input value defined by performing the operation of 1 as the first The second table is read from the storage unit having the second table stored in the array element having the address defined by the address function associated with the input value as an argument, and the first input value is received. And a value stored in an array element corresponding to the first input value, and a calculation device having a calculation means for outputting a first output value corresponding to the second input value.

この演算装置は、入力値と出力値の関係を模擬する直線を定義し、この直線と入力値との差のみをテーブル化するという作用がある。その結果、出力値を直接テーブルに収納するタイプの信号処理方法と比較するとメモリを削減できるという効果が得られる。 This arithmetic device has an effect of defining a straight line that simulates the relationship between an input value and an output value, and tabulating only the difference between the straight line and the input value. As a result, the memory can be reduced as compared with a signal processing method in which output values are directly stored in a table.

本発明の望ましい態様としては、第1の演算は、第1の出力値に応じた、一対の第1の入力信号の中間値を0とした絶対値が小さい一方の入力信号を絶対値の大きい他方の入力信号で除する演算を有する演算装置であることが好ましい。 As a desirable mode of the present invention, the first calculation is performed by using one input signal having a small absolute value with the intermediate value of the pair of first input signals as zero corresponding to the first output value. It is preferable that the arithmetic unit has an arithmetic operation divided by the other input signal.

この演算装置は、入力値と出力値に慨ね直線の相関を持たせるという作用がある。また、除算部分の演算結果が所定の範囲となり信号処理上便利であるという作用もある。その結果、出力値の誤差が減少する、あるいは、テーブル作成に必要なメモリを削減できるという効果が得られる。 This arithmetic device has the effect of giving a linear correlation between the input value and the output value. In addition, there is an effect that the calculation result of the division part is in a predetermined range, which is convenient in signal processing. As a result, it is possible to reduce the output value error or to reduce the memory required for table creation.

本発明の望ましい態様としては、第1の演算は、一対の第1の入力信号の最大値と最小値との差を同一の値とする演算を有する演算装置であることが好ましい。 As a desirable mode of the present invention, it is preferable that the first calculation is a calculation device having a calculation in which the difference between the maximum value and the minimum value of the pair of first input signals is the same value.

この演算装置では、一対の入力信号の最大値と最小値の差を同一の値とすることにより、一対の入力信号より演算される入力値の対称性が増すという作用がある。その結果、入力値と出力値の関係が直線に近付くという効果が得られる。   In this arithmetic device, the difference between the maximum value and the minimum value of the pair of input signals is set to the same value, so that the symmetry of the input values calculated from the pair of input signals is increased. As a result, the effect that the relationship between the input value and the output value approaches a straight line is obtained.

本発明の望ましい態様としては、一次関数が少なくとも2つの異なる複数の一次関数を有し、複数の一次関数は第1の入力値と、第2の出力値と、が一対一に対応し、第1の入力値と、第2の出力値のそれぞれが異なる演算装置であることが好ましい。 In a preferred aspect of the present invention, the linear function has at least two different linear functions, and the first linear function has a one-to-one correspondence between the first input value and the second output value. It is preferable that each of the input value of 1 and the second output value be different arithmetic devices.

この演算装置は、入力値の全範囲に対して入力値と出力値を一対一に対応させるという作用がある。その結果、この演算装置は、入力値の全範囲に対して一意に出力値を求められるという効果が得られる。 This arithmetic device has the effect of corresponding one-to-one input values and output values with respect to the entire range of input values. As a result, this computing device has an effect that the output value can be uniquely obtained for the entire range of the input value.

本発明の望ましい態様としては、一次関数が少なくとも2つの異なる複数の一次関数を有し、複数の一次関数は第1の入力値と、第1の出力値と、が一対一に対応し、第1の入力値と、第1の出力値のそれぞれが異なる演算装置であることが好ましい。 As a desirable mode of the present invention, the linear function has at least two different linear functions, and the linear functions correspond to the first input value and the first output value on a one-to-one basis. It is preferable that each of the input value of 1 and the first output value be different from each other.

この演算装置は、入力値の全範囲に対して入力値と出力値を一対一に対応させるという作用がある。その結果、この演算装置は、入力値の全範囲に対して一意に出力値を求められるという効果が得られる。 This arithmetic device has the effect of corresponding one-to-one input values and output values with respect to the entire range of input values. As a result, this computing device has an effect that the output value can be uniquely obtained for the entire range of the input value.

本発明の望ましい態様としては、一次関数が第1の入力値の全入力範囲において、同一の関数である演算装置であることが好ましい。 As a desirable mode of the present invention, it is preferable that the linear function is an arithmetic unit having the same function in the entire input range of the first input value.

この演算装置は、複数の一次関数を記憶・参照する必要がなくなるという作用がある。その結果、この演算装置は、メモリの削減、簡潔な処理用プログラムの実現という効果が得られる。 This arithmetic device has the effect that it is not necessary to store and reference a plurality of linear functions. As a result, this computing device has the effect of reducing memory and realizing a simple processing program.

本発明の望ましい態様としては、演算手段は、第1の入力信号の一周期中の電気角位相を示す第1の位相信号と、所定の電気角位相差を有する一対の第2の入力信号の一周期中の電気角位相を示す第2の位相信号と、を受け、第1の位相信号と第2の位相信号との差分である第1の入力信号に応じて変化する第1の位相差信号と、第1または第2の位相信号と、に基づいて、第1の位相差信号の基準値と第1の位相差信号との差分である第2の電気角位相差に対応したそれぞれ第1の入力信号または第2の入力信号の一周期分が入力された回数を示す第1の周期数または第2の周期数を演算する演算装置であることが好ましい。 As a desirable mode of the present invention, the computing means includes a first phase signal indicating an electrical angle phase in one cycle of the first input signal and a pair of second input signals having a predetermined electrical angle phase difference. A first phase difference that changes in response to a first input signal that is a difference between the first phase signal and the second phase signal. A first electrical angle phase difference corresponding to a second electrical angle phase difference, which is a difference between the reference value of the first phase difference signal and the first phase difference signal, based on the signal and the first or second phase signal. It is preferable that the arithmetic unit be configured to calculate the first period number or the second period number indicating the number of times one input signal or one input signal is input for one period.

この演算装置は、入力信号の周期数を求められるという作用がある。その結果、この演算装置は、複数周期の入力信号範囲に対して一意に出力を求められるという効果が得られる。 This arithmetic device has an effect that the number of periods of the input signal can be obtained. As a result, this computing device can obtain an effect that an output can be uniquely obtained for an input signal range of a plurality of cycles.

本発明の望ましい態様としては、対象物と、一対の入力信号を出力する出力手段と、の相対的移動に応じて、出力手段が所定の電気角位相差を有する一対の入力信号を出力することにより、出力手段と、対象物と、の相対移動量を出力する演算手段を有する相対移動量測定装置であることが好ましい。 As a desirable aspect of the present invention, the output means outputs a pair of input signals having a predetermined electrical angle phase difference according to the relative movement between the object and the output means for outputting the pair of input signals. Thus, it is preferable that the relative movement amount measuring device has a calculation means for outputting the relative movement amount between the output means and the object.

この相対移動量測定装置においては、出力手段と対象物との相対移動量を測定することが可能となる。 In this relative movement amount measuring apparatus, the relative movement amount between the output means and the object can be measured.

本発明の望ましい態様としては、所定の電気角位相差を有する一対の第1の入力信号のそれぞれと多対一の関係を有する第1の出力値とを対応付けるように第1の入力信号に第1の演算を行い定義された第1の入力値を求めるステップと、第1の入力値を引数とした一次関数を求めるステップと、第1の入力値に対応する一次関数上の第2の出力値を第1の出力値として出力するステップと、を有する演算方法であることが好ましい。 As a desirable aspect of the present invention, the first input signal is associated with the first output value having a many-to-one relationship with each of the pair of first input signals having a predetermined electrical angle phase difference. A step of obtaining a first input value defined by performing one operation, a step of obtaining a linear function using the first input value as an argument, and a second output on the linear function corresponding to the first input value And a step of outputting the value as the first output value.

この演算方法は、複雑な関数を使用することなく出力を求められるという作用がある。その結果、この演算方法は、演算回路の負荷を軽減するという効果が得られる。 This calculation method has an effect that an output can be obtained without using a complicated function. As a result, this calculation method has the effect of reducing the load on the calculation circuit.

本発明の望ましい態様としては、所定の電気角位相差を有する一対の第1の入力信号のそれぞれと多対一の関係を有する第1の出力値とを対応付けるように第1の入力信号に第1の演算を行い第1の入力値を定義するステップと、第1の入力値を引数とした一次関数を求めるステップと、第1の入力値に対応する一次関数上の第2の出力値を求めるステップと、第2の出力値と、第1の出力値と、の差分を求めるステップと、第1の入力値と対応付けるアドレス関数によりアドレスを定義するステップと、アドレスを引数とした配列要素に差分を格納した第1のテーブルを求め記憶するステップと、差分を配列要素に格納した第1のテーブルを求めるステップと、第1の入力値を受け、第1のテーブルを読み出すとともに、第1の入力値に対応する第2の出力値と、第1の入力値に対応する配列要素に格納された値と、に基づいて第1の出力値を出力するステップと、を有する演算方法であることが好ましい。 As a desirable aspect of the present invention, the first input signal is associated with the first output value having a many-to-one relationship with each of the pair of first input signals having a predetermined electrical angle phase difference. Performing a calculation of 1 to define a first input value; obtaining a linear function with the first input value as an argument; and a second output value on the linear function corresponding to the first input value. A step of obtaining a difference between the second output value and the first output value, a step of defining an address by an address function associated with the first input value, and an array element having the address as an argument Obtaining and storing a first table storing the difference, obtaining a first table storing the difference in the array element; receiving the first input value; reading the first table; Vs input value A second output value, is preferably a calculation method with the value stored in the array element corresponding to the first input value, and a step of outputting a first output value based on.

この演算方法は、入力値と出力値の関係を模擬する直線を定義し、この直線と出力値との差のみをテーブル化するという作用がある。その結果、出力値を直接テーブルに収納するタイプの信号処理方法と比較するとメモリを削減できるという効果が得られる。 This calculation method has the effect of defining a straight line that simulates the relationship between the input value and the output value and tabulating only the difference between the straight line and the output value. As a result, the memory can be reduced as compared with a signal processing method in which output values are directly stored in a table.

本発明の望ましい態様としては、所定の電気角位相差を有する一対の第1の入力信号のそれぞれと多対一の関係を有する第1の出力値とを対応付けるように第1の入力信号に第1の演算を行い第1の入力値を定義するステップと、第1の入力値を引数とした一次関数を求めるステップと、第1の出力値に対応する一次関数上の第2の入力値を求めるステップと、第1の入力値と、第2の入力値と、の差分を求めるステップと、第1の入力値と対応付けるアドレス関数によりアドレスを定義するステップと、アドレスを引数とした配列要素に差分を格納した第2のテーブルを求め記憶するステップと、差分を配列要素に格納した第2のテーブルを求めるステップと、第1の入力値を受け、第2のテーブルを読み出すとともに、第1の入力値と、第1の入力値に対応する配列要素に格納された値と、に基づいて第2の入力値に対応する第1の出力値を出力するステップと、を有する演算方法であることが好ましい。 As a desirable aspect of the present invention, the first input signal is associated with the first output value having a many-to-one relationship with each of the pair of first input signals having a predetermined electrical angle phase difference. A step of defining a first input value by performing an operation of 1, a step of obtaining a linear function using the first input value as an argument, and a second input value on the linear function corresponding to the first output value A step of obtaining, a step of obtaining a difference between the first input value and the second input value, a step of defining an address by an address function associated with the first input value, and an array element having the address as an argument Obtaining and storing a second table storing the difference, obtaining a second table storing the difference in the array element, receiving the first input value, reading the second table, Input value and The value stored in the corresponding array element of the input value, it is preferable that the calculation method having the steps, the outputs of the first output value corresponding to the second input value based on.

この演算方法は、入力値と出力値の関係を模擬する直線を定義し、この直線と入力値との差のみをテーブル化するという作用がある。その結果、出力値を直接テーブルに収納するタイプの信号処理方法と比較するとメモリを削減できるという効果が得られる。 This calculation method has the effect of defining a straight line that simulates the relationship between the input value and the output value and tabulating only the difference between the straight line and the input value. As a result, the memory can be reduced as compared with a signal processing method in which output values are directly stored in a table.

以上のように、本発明は、演算回路の負荷を軽減、または必要なメモリ量を削減するという効果を奏する。   As described above, the present invention has an effect of reducing the load on the arithmetic circuit or reducing the necessary memory amount.

本発明の実施形態に係わる概要を示すフローチャートである。It is a flowchart which shows the outline | summary concerning embodiment of this invention. 本発明の実施形態に係わる直線の定義手順を示すフローチャートである。It is a flowchart which shows the definition procedure of the straight line concerning embodiment of this invention. 本発明の実施形態に係わるルックアップテーブル作成方法を示すフローチャートである。It is a flowchart which shows the lookup table preparation method concerning embodiment of this invention. 本発明の実施形態に係わる演算装置による出力演算の手順を示すフローチャートである。It is a flowchart which shows the procedure of the output calculation by the calculating apparatus concerning embodiment of this invention. 本発明の実施形態に係わるルックアップテーブル作成方法の別案を示すフローチャートである。It is a flowchart which shows another proposal of the lookup table preparation method concerning embodiment of this invention. 本発明の実施形態に係わる直線補間についての説明図である。It is explanatory drawing about the linear interpolation concerning embodiment of this invention. 本発明の実施形態に係わる演算装置による出力演算の別案の手順を示すフローチャートである。It is a flowchart which shows the procedure of another plan of the output calculation by the calculating apparatus concerning embodiment of this invention. 本実施例1に係わる角度センサの構成図である。1 is a configuration diagram of an angle sensor according to a first embodiment. 本実施例1に係わる磁気抵抗効果素子の断面構造を示す模式図である。1 is a schematic diagram showing a cross-sectional structure of a magnetoresistive effect element according to Example 1. FIG. 本実施例1に係わる入力信号IN1、入力信号IN2を示した図である。FIG. 3 is a diagram illustrating an input signal IN1 and an input signal IN2 according to the first embodiment. 本実施例1に係わる入力信号IN1、入力信号IN2より演算される演算値を示した図である。It is the figure which showed the calculation value calculated from the input signal IN1 concerning the present Example 1, and the input signal IN2. 本実施例1に係わる出力値Yと入力値Xの関係を示した図である。FIG. 4 is a diagram illustrating a relationship between an output value Y and an input value X according to the first embodiment. 本実施例1に係わる入力値Xと出力値Yの関係および直線Z(X)を示した図である。FIG. 6 is a diagram illustrating a relationship between an input value X and an output value Y and a straight line Z (X) according to the first embodiment. 本実施例1に係わる出力値Yと直線Z(X)の差を示した図である。It is the figure which showed the difference of the output value Y concerning the present Example 1, and the straight line Z (X). 本実施例2に係わる角度センサの構成図である。It is a block diagram of the angle sensor concerning the present Example 2. 本実施例2に係わる入力信号IN1、入力信号IN2を示した図である。It is the figure which showed the input signal IN1 concerning the present Example 2, and the input signal IN2. 本実施例2に係わる出力値Yと入力値Xの関係を示した図である。FIG. 6 is a diagram illustrating a relationship between an output value Y and an input value X according to the second embodiment. 本実施例2に係わる入力値Xと出力値Yの関係を示した図である。FIG. 6 is a diagram illustrating a relationship between an input value X and an output value Y according to the second embodiment. 本実施例2に係わる入力信号IN1(i)、入力信号IN2(i)を示した図である。FIG. 6 is a diagram illustrating an input signal IN1 (i) and an input signal IN2 (i) according to the second embodiment. 本実施例2に係わる出力値Y(i)と入力値X(i)の関係を示した図である。It is the figure which showed the relationship between the output value Y (i) concerning this Example 2, and the input value X (i). 本実施例2に係わる入力値X(i)と出力値Y(i)の関係を示した図である。It is the figure which showed the relationship between the input value X (i) concerning this Example 2, and the output value Y (i). 本実施例2に係わるアドレスADR(i)と配列要素a[ADR(i)]の関係を示した図である。FIG. 10 is a diagram illustrating a relationship between an address ADR (i) and an array element a [ADR (i)] according to the second embodiment. 本実施例2に係わるテーブル作成時直線補間を説明した図である。It is a figure explaining the linear interpolation at the time of table creation concerning the present Example 2. FIG. 本実施例2に係わるテーブル参照時直線補間を説明した図である。It is a figure explaining the linear interpolation at the time of the table reference concerning the present Example 2. FIG. 本実施例2に係わる周期数の求め方を示した図である。It is the figure which showed how to obtain | require the number of periods concerning the present Example 2. 本実施例3に係わる角度センサの構成図である。It is a block diagram of the angle sensor concerning the present Example 3. 本実施例3に係わる入力信号IN1、入力信号IN2を示した図である。It is the figure which showed the input signal IN1 concerning the present Example 3, and the input signal IN2. 本実施例3に係わる出力値Yと入力値Xの関係を示した図である。FIG. 10 is a diagram illustrating a relationship between an output value Y and an input value X according to the third embodiment. 本実施例3に係わる入力値Xと出力値Yの関係を示した図である。FIG. 6 is a diagram illustrating a relationship between an input value X and an output value Y according to the third embodiment. 本実施例3に係わる入力信号IN1(i)、入力信号IN2(i)を示した図である。It is the figure which showed the input signal IN1 (i) concerning this Example 3, and the input signal IN2 (i). 本実施例3に係わる出力値Y(i)と入力値X(i)の関係を示した図である。It is the figure which showed the relationship between the output value Y (i) concerning this Example 3, and the input value X (i). 本実施例3に係わる入力値X(i)と出力値Y(i)の関係を示した図である。It is the figure which showed the relationship between the input value X (i) concerning this Example 3, and the output value Y (i). 本実施例3に係わるアドレスADR(i)と配列要素a[ADR(i)]の関係を示した図である。It is the figure which showed the relationship between the address ADR (i) concerning this Example 3, and array element a [ADR (i)]. 本実施例3に係わるテーブル作成時直線補間を説明した図である。It is a figure explaining the linear interpolation at the time of the table creation concerning the present Example 3. 本実施例3に係わるテーブル参照時直線補間を説明した図である。It is the figure explaining the linear interpolation at the time of the table reference concerning the present Example 3.

以下、図面を参照しながら本発明の実施形態について説明する。図1は本実施形態の概要を表すフローチャートである。本発明は、直線の定義(ステップ101)、ルックアップテーブル作成(ステップ102)、演算装置による出力演算(ステップ103)という手順で実現される。 Hereinafter, embodiments of the present invention will be described with reference to the drawings. FIG. 1 is a flowchart showing an outline of the present embodiment. The present invention is realized by the procedures of straight line definition (step 101), lookup table creation (step 102), and output calculation (step 103) by a calculation device.

図2は、直線の定義(ステップ101)の手順を示したフローチャートである。直線定義の目的は、理想的、あるいは実測から求められた出力値Yに対して、予想される出力値Zを、入力値Xを引数とした1次関数Z(X)で定義することである。入力値Xは、所定の位相差を有する1対の入力信号IN1、入力信号IN2より演算により求められる。本実施形態に係わる直線の定義の手順では、IN1、IN2とXの関係を定義する(ステップ111)。以下、説明のために、IN1、IN2とXの関係を関数Fを用いてX=F(IN1、IN2)と表記する。この関数Fが、入力信号IN1、入力信号IN2のうち入力信号の中間値を0とした絶対値が小さい方の入力信号を絶対値の大きい方の入力信号で除する演算を含むことが好ましいが、これを限定するものではない。ただし、入力信号IN1、入力信号IN2のそれぞれと多対一の関係を有する出力値Yと、入力値X(=F(IN1、IN2))とが、一対一に対応する。例えば、IN1をsin(X)とし、IN2をcos(X)とした場合、|sin(X)|と|cos(X)|の大小関係を比較して、|sin(X)|と|cos(X)|の内、値の大きいIN1、IN2の一方を分母とし、値の小さい他方を分子とした値に、所定の値を加算または減算することにより、出力値Yと一対一に対応付けられた入力値Xを得ることが可能となっている。ここで、|A|はAの絶対値を表す。あるいは、IN1をsin(X)とし、IN2をcos(X)とした場合、|sin(X)|と|cos(X)|の大小関係を比較して、|sin(X)|と|cos(X)|の内、値の大きいIN1、IN2の一方を分母とし、値の小さい他方を分子とした値の傾きが全て同じ傾きになるように所定の値を積算し、所定の値を加算または減算しても良い。次に、分割範囲の決定を行う(ステップ112)。出力値を予想する関数Zは入力値Xの全入力範囲を単一の一次関数で表わす必要は必ずしもなく、入力値Xの範囲を分割し、分割された入力範囲毎にZ(X)を定義してもよい。分割は、少なくとも、関数Fの傾きの符号が変更される点と、入力値Xと出力値Yを一対一に対応させるために関数Fが不連続となる点において行われる。最後に、分割範囲それぞれに対して、入力値Xと予想される出力値Zの関係を一次関数Z(X)で定義する(ステップ113)。ステップ113は、解析的な演算により、または、実測のデータを基にして演算回路により、または、外部に用意された専用の演算装置を用いて行われることが好適であるが、その他、どのような手段で行って定義してもよい。また、例えば、一次関数Z(X)は、最小2乗法により決定してもよいし、出力値Yの最大値と最小値を結ぶ直線であってもよいし、その他、出力値Yの最大値と最小値を結ぶ直線と傾きの符号が同一の直線であればどのような直線であってもよい。この時、ステップ112で分割された複数の領域の一次関数Z(X)が同一の関数で与えられても構わない。この場合、入力値に対して、同一の関数で与えられるので、後述する演算処理において、出力値Y(i)を求める演算が容易となり、記憶する関数を低減できるので、使用するメモリー量を減らすことが可能となる。 FIG. 2 is a flowchart showing a procedure for defining a straight line (step 101). The purpose of the straight line definition is to define an expected output value Z with a linear function Z (X) with an input value X as an argument with respect to an ideal or actual output value Y. . The input value X is obtained by calculation from a pair of input signal IN1 and input signal IN2 having a predetermined phase difference. In the procedure for defining a straight line according to the present embodiment, the relationship between IN1, IN2, and X is defined (step 111). Hereinafter, for the sake of explanation, the relationship between IN1, IN2 and X is expressed as X = F (IN1, IN2) using the function F. It is preferable that the function F includes an operation of dividing an input signal having a smaller absolute value with an intermediate value of the input signal being 0 among the input signal IN1 and the input signal IN2 by an input signal having a larger absolute value. This is not a limitation. However, the output value Y having a many-to-one relationship with each of the input signal IN1 and the input signal IN2 and the input value X (= F (IN1, IN2)) have a one-to-one correspondence. For example, when IN1 is sin (X) and IN2 is cos (X), the magnitude relationship between | sin (X) | and | cos (X) | is compared, and | sin (X) | Of (X) |, one of IN1 and IN2 having a larger value is used as a denominator, and a predetermined value is added to or subtracted from a value having the other as a numerator. The obtained input value X can be obtained. Here, | A | represents the absolute value of A. Alternatively, when IN1 is sin (X) and IN2 is cos (X), the magnitude relationship between | sin (X) | and | cos (X) | is compared, and | sin (X) | Of (X) |, one of the larger values IN1 and IN2 is used as the denominator and the other value of the smaller value is used as the numerator. Or you may subtract. Next, the division range is determined (step 112). The function Z for predicting the output value does not necessarily need to represent the entire input range of the input value X by a single linear function, but divides the range of the input value X and defines Z (X) for each divided input range. May be. The division is performed at least at a point where the sign of the slope of the function F is changed and at a point where the function F becomes discontinuous in order to make the input value X and the output value Y correspond one-to-one. Finally, for each divided range, the relationship between the input value X and the expected output value Z is defined by a linear function Z (X) (step 113). Step 113 is preferably performed by analytical calculation, by a calculation circuit based on actually measured data, or by using a dedicated calculation device prepared externally. It may be defined by using various means. Further, for example, the linear function Z (X) may be determined by the least square method, may be a straight line connecting the maximum value and the minimum value of the output value Y, or the maximum value of the output value Y. As long as the straight line connecting the minimum value and the slope has the same sign, any straight line may be used. At this time, the linear function Z (X) of the plurality of regions divided in step 112 may be given by the same function. In this case, since the input function is given by the same function, the calculation for obtaining the output value Y (i) is facilitated in the arithmetic processing described later, and the function to be stored can be reduced. It becomes possible.

図3は、ルックアップテーブル作成(ステップ102)の手順を示したフローチャートである。ステップ102は、演算回路により行ってもよいし、外部に用意された専用の演算装置を用いて行ってもよいし、その他どのような手段で行ってもよい。ルックアップテーブルは、例えば、配列要素a[ADR(i)]を一次元に配列して得られるデータ構造を有している。説明の便宜上、一次元配列からなるルックアップテーブルを例示するが、本実施形態は、多次元配列からなるルックアップテーブルにも適用できる。配列要素a[ADR(i)]は、一次関数Z(X)を介して入力値X(i)と出力値Y(i)との対応関係を保持するための値であり、アドレスADR(i)を有する。言い換えれば、入力値X(i)から一次関数Z(X(i))によって、Zを導出し、入力値X(i)に対応するアドレスADR(i)を有する配列要素a[ADR(i)]とZとに基づいて出力値Y(i)を導出することが可能となっている。なお、出力値Y(i)の導出については、後述する。ここで、入力値X(i)は実測により得られた入力値であり、出力値Y(i)は実測により得られた出力値である。引数iが同一であれば、出力値Y(i)は入力値X(i)に対応する値であることを示している。まず、配列要素a[ADR(i)]のアドレスADR(i)と入力値X(i)の対応関係を定義する(ステップ121)。言い換えると、ステップ121では、入力値Xを引数としてアドレスADRを返す関数を定義する。入力値XとアドレスADRは一対一に対応する必要があり、関数Gを用いて、ADR=G(X)と表記するものとする。なお、演算負荷を低減するために、ADR=Xとし、入力値XそのものをアドレスADRに対応付けてもよい。入力値Xの特定の範囲のみ細かいテーブルを作成したい場合、例えば、入力値Xの最大値をXmaxとし、G(X)=X×sin(X/Xmax)で与えることが考えられる。このようにG(X)を定義すると、X=0付近は細かく、X=Xmax付近は粗くルックアップテーブルを作成することが可能となる。もちろん、G(X)はこれらに限定するものではなく、入力値XとアドレスADRが一対一に対応すればどのような関数であってもよい。なお、引数iに対しては、アドレスADR(i)は、ADR(i)=G(X(i))で与えられることになる。次に、入力信号IN1(i)、入力信号IN2(i)より入力値X(i)を求める(ステップ122)。入力値X(i)は、前述の関数Fを用いて、X(i)=F(IN1(i)、IN2(i))という関係を有する。最後に、入力値X(i)に対応付けられるアドレスADR(i)を有する配列要素a[ADR(i)]に出力値Y(i)とZ(X(i))との差を格納し、記憶部に記憶する(ステップ123)。このように、入力値X(i)と出力値Y(i)との対応関係を予想する直線Z(X)を予め定義し、Z(X)との差分、つまり、配列要素a[ADR(i)]をテーブルとすることにより、ルックアップテーブルに使用するメモリを減少させることができる。 FIG. 3 is a flowchart showing the procedure for creating the lookup table (step 102). Step 102 may be performed by an arithmetic circuit, may be performed using a dedicated arithmetic device prepared outside, or may be performed by any other means. The lookup table has, for example, a data structure obtained by arranging the array elements a [ADR (i)] in one dimension. For convenience of explanation, a lookup table composed of a one-dimensional array is illustrated, but this embodiment can also be applied to a lookup table composed of a multi-dimensional array. The array element a [ADR (i)] is a value for holding the correspondence between the input value X (i) and the output value Y (i) via the linear function Z (X), and the address ADR (i ). In other words, Z is derived from the input value X (i) by the linear function Z (X (i)), and the array element a [ADR (i) having the address ADR (i) corresponding to the input value X (i). ] And Z can be used to derive the output value Y (i). The derivation of the output value Y (i) will be described later. Here, the input value X (i) is an input value obtained by actual measurement, and the output value Y (i) is an output value obtained by actual measurement. If the arguments i are the same, it indicates that the output value Y (i) is a value corresponding to the input value X (i). First, the correspondence between the address ADR (i) of the array element a [ADR (i)] and the input value X (i) is defined (step 121). In other words, in step 121, a function that returns the address ADR with the input value X as an argument is defined. The input value X and the address ADR need to correspond one-to-one, and ADR = G (X) is expressed using the function G. In order to reduce the calculation load, ADR = X, and the input value X itself may be associated with the address ADR. When it is desired to create a fine table only in a specific range of the input value X, for example, it is conceivable that the maximum value of the input value X is Xmax and G (X) = X × sin (X / Xmax) is given. When G (X) is defined in this way, it is possible to create a lookup table that is fine near X = 0 and coarse near X = Xmax. Of course, G (X) is not limited to these, and any function may be used as long as the input value X and the address ADR correspond one-to-one. For the argument i, the address ADR (i) is given by ADR (i) = G (X (i)). Next, an input value X (i) is obtained from the input signal IN1 (i) and the input signal IN2 (i) (step 122). The input value X (i) has a relationship of X (i) = F (IN1 (i), IN2 (i)) using the function F described above. Finally, the difference between the output values Y (i) and Z (X (i)) is stored in the array element a [ADR (i)] having the address ADR (i) associated with the input value X (i). And stored in the storage unit (step 123). Thus, a straight line Z (X) that predicts the correspondence between the input value X (i) and the output value Y (i) is defined in advance, and the difference from Z (X), that is, the array element a [ADR ( By using i)] as a table, the memory used for the lookup table can be reduced.

ここで、a[ADR(i)]は配列要素であり、要素数は有限である。従って、アドレスADR(i)を有する配列要素a[ADR(i)]が存在せず、出力値Y(i)とZ(X(i))との差をそのまま格納できない場合がある。そのような場合は、仮に、アドレスADR(i)を有する配列要素a[ADR(i)]が存在したと考え、他の配列要素との間で補間を行うことにより、対応する配列要素a[ADR(i)]が存在するアドレスADR(i)を有する配列要素a[ADR(i)]の値を求め格納すればよい。これらテーブル作成処理は外部に接続された計算機を用いて行ってもよい。 Here, a [ADR (i)] is an array element, and the number of elements is finite. Therefore, there is a case where the array element a [ADR (i)] having the address ADR (i) does not exist and the difference between the output values Y (i) and Z (X (i)) cannot be stored as it is. In such a case, it is assumed that the array element a [ADR (i)] having the address ADR (i) exists, and interpolation is performed between the array elements a [ADR (i)] and the corresponding array element a [ The value of array element a [ADR (i)] having address ADR (i) where ADR (i)] exists may be obtained and stored. These table creation processes may be performed using an externally connected computer.

図4は、演算装置による出力演算(ステップ103)の手順を示したフローチャートである。まず、入力信号IN1、入力信号IN2より入力値Xを求める(ステップ131)。つまり、入力信号IN1、入力信号IN2のそれぞれと多対一の関係を有する出力値Yと、入力値X(=F(IN1、IN2))とが、一対一に対応するように入力値Xを求める。入力値Xは前述の関数Fを用いて、X=F(IN1、IN2)により求められる。次に、入力値XよりアドレスADRを求める(ステップ132)。アドレスADRは前述の関数Gを用いて、ADR=G(X)より求められる。続いて、前述の一次関数Zを用いて、入力値Xより予想される出力Z(X)を求める(ステップ133)。最後に、予想される出力Z(X)に補正を加え、出力値Yの値を求め出力する(ステップ134)。補正は、予想される出力Z(X)と、アドレスADRを有する配列要素a[ADR(i)]とを基にした演算により与えられる。 FIG. 4 is a flowchart showing a procedure of output calculation (step 103) by the calculation device. First, the input value X is obtained from the input signal IN1 and the input signal IN2 (step 131). That is, the input value X is set so that the output value Y having a many-to-one relationship with each of the input signal IN1 and the input signal IN2 and the input value X (= F (IN1, IN2)) have a one-to-one correspondence. Ask. The input value X is obtained by X = F (IN1, IN2) using the function F described above. Next, an address ADR is obtained from the input value X (step 132). The address ADR is obtained from ADR = G (X) using the function G described above. Subsequently, an output Z (X) expected from the input value X is obtained using the above-described linear function Z (step 133). Finally, the expected output Z (X) is corrected, and the output value Y is obtained and output (step 134). The correction is given by an operation based on the expected output Z (X) and the array element a [ADR (i)] having the address ADR.

ここで、a[ADR(i)]は配列要素であり、要素数は有限である。従って、アドレスADRを有する配列要素a[ADR(i)]が存在しない場合がある。そのような場合は、アドレスADRを有する配列要素a[ADR(i)]が存在するアドレスADRのうち、アドレスADRより値が小さいアドレスのうち、最もアドレスADRに近い値となるアドレスを有する配列要素a[ADR(i)]と、アドレスADRより値が大きいアドレスのうち、最もアドレスADRに近い値となるアドレスを有する配列要素a[ADR(i)]とを結んだ直線が、アドレスADRを示す直線と交わる点を求め、アドレスADRを有する配列要素a[ADR(i)]であるとすればよい。 Here, a [ADR (i)] is an array element, and the number of elements is finite. Therefore, the array element a [ADR (i)] having the address ADR may not exist. In such a case, among the addresses ADR having the array element a [ADR (i)] having the address ADR, the array element having the address closest to the address ADR among the addresses having a value smaller than the address ADR. A straight line connecting a [ADR (i)] and an array element a [ADR (i)] having an address closest to the address ADR among addresses having a value larger than the address ADR indicates the address ADR. A point that intersects with the straight line is obtained, and the array element a [ADR (i)] having the address ADR may be used.

なお、これらステップ111乃至ステップ134の順序は特に限定されるものではなく、例えば、ステップ133を132よりも先に実行してもよいし、ステップ122をステップ121より先に実行してもよい。また、一部処理を省略することも可能である。例えば、テーブルを使用しない場合は、ステップ102およびステップ132、ステップ134が省略可能となり、Y=Z(X)を出力とすればよい。 Note that the order of these steps 111 to 134 is not particularly limited. For example, step 133 may be executed before 132, or step 122 may be executed before step 121. It is also possible to omit some processing. For example, when the table is not used, step 102, step 132, and step 134 can be omitted, and Y = Z (X) may be output.

さらに、これらステップの前後またはステップ間に他の処理を追加してもよい。例えば、一次関数Z(X)を、実測の入力値X(i), 出力値Y(i)を用いて修正するステップをステップ122とステップ123の間に加えてもよいし、例えば、回転角センサやリニアセンサ等のように、移動方向等によりヒステリシスが生じる可能性がある場合は、複数のテーブルを作成・参照してもよい。ヒステリシスが生じるということは、移動方向により、入力値Xに対応する出力値Yが異なるということである。そのような例として、移動方向1と移動方向2を有する場合、移動方向1に対応するルックアップテーブルを配列a1[]、移動方向2に対応するルックアップテーブルを配列a2[]を作成し、参照時は移動方向に応じて、a1[]を参照するかa2[]を参照するかを決定すればよい。この時、それら複数のテーブル要素の差は小さいことが多く、差分のみをテーブル化することも有効である。すなわち、a3[ADR(i)]=a2[ADR(i)]−a1[ADR(i)]となる配列a3[]を定義し、配列a2[]ではなく、配列a3[]を記憶しておけばよい。参照時は、a1[ADR(i)]+a3[ADR(i)]とすれば、a2[ADR(i)]を参照した場合と同様の効果が得られる。他にも、例えば、入力信号IN1、入力信号IN2が複数周期繰り返される範囲に対して出力値Yを一意に対応させたい場合には、ステップ131の手前に入力信号IN1、または、入力信号IN2の周期数を求めるステップを加えてもよい。なお、周期数とは、入力信号IN1、または、入力信号IN2の一周期分が入力された回数を指すものとする。 Further, other processing may be added before or after these steps or between steps. For example, a step of correcting the linear function Z (X) using the actually measured input value X (i) and the output value Y (i) may be added between step 122 and step 123. For example, the rotation angle A plurality of tables may be created and referred to when there is a possibility that hysteresis may occur depending on the moving direction or the like, such as a sensor or a linear sensor. The occurrence of hysteresis means that the output value Y corresponding to the input value X differs depending on the moving direction. As such an example, when having a moving direction 1 and a moving direction 2, create an array a1 [] for the look-up table corresponding to the moving direction 1, and an array a2 [] for the look-up table corresponding to the moving direction 2, At the time of reference, whether to refer to a1 [] or a2 [] may be determined according to the moving direction. At this time, the difference between the plurality of table elements is often small, and it is also effective to tabulate only the difference. That is, an array a3 [] is defined as a3 [ADR (i)] = a2 [ADR (i)]-a1 [ADR (i)], and the array a3 [] is stored instead of the array a2 []. Just keep it. At the time of reference, if a1 [ADR (i)] + a3 [ADR (i)] is set, the same effect as that obtained when a2 [ADR (i)] is referred to can be obtained. In addition, for example, when it is desired to uniquely correspond the output value Y to a range in which the input signal IN1 and the input signal IN2 are repeated for a plurality of cycles, the input signal IN1 or the input signal IN2 is set before step 131. A step of obtaining the number of periods may be added. Note that the number of cycles refers to the number of times that one cycle of the input signal IN1 or the input signal IN2 is input.

一部の処理を変更しても同様の効果が得られる。例えば、ルックアップテーブル作成(ステップ102)手順の変更が考えられる。ルックアップテーブル作成手順は、図3に示されているが、これを図5のように変更することが可能である。つまり、ステップ123の処理を、ステップ143のように変更すればよい。つまり、一次関数Y=Z(X)の逆関数をX=Z−1(Y)とすると、入力値X(i)に対応付けられるアドレスADR(i)を有する配列要素a[ADR(i)]に、出力値X(i)とZ−1(Y(i))との差を格納する。言い換えると、Z−1(Y(i))が示す値は、一次関数Zにより出力を求める場合の理想的な入力値Xrev(i)であり、配列要素a[ADR(i)]には、理想的な入力値Xrev(i)と、関数Fにより、X(i)=F(IN1(i)、IN2(i))より求められる入力値X(i)との差が格納されている。なお、本処理においては、Z(X)は出力値Yの最大値と最小値を含む直線であることが好ましい。配列要素a[ADR(i)]には、理想的な入力値Xrev(i)と、X(i)=F(IN1(i)、IN2(i))より求められる入力値X(i)との差が格納されているので、Z(X)が出力値Yの最大値と最小値を含む直線であれば、容易に配列要素a[ADR(i)]を求めることが可能である。ここで、a[ADR(i)]は配列要素であり、要素数は有限である。従って、アドレスADR(i)を有する配列要素a[ADR(i)]が存在せず、出力値Y(i)とZ(X(i))との差をそのまま格納できない場合がある。そのような場合は、仮に、アドレスADR(i)を有する配列要素a[ADR(i)]が存在したと考え、他の配列要素との間で補間を行うことにより、対応する配列要素a[ADR(i)]が存在するアドレスADR(i)を有する配列要素a[ADR(i)]の値を求め格納すればよい。図6は、ステップ123とステップ143に示したルックアップテーブル作成の概念図を示したものである。ステップ123では、ΔY(i)をアドレスADRに対応する配列要素a[ADR(i)]に格納する。X(i)=F(IN1,IN2)により求められた入力値X(i)を用いて、Z(X(i))を求める。ルックアップテーブルを参照することにより、求めたい出力値Y(i)とZ(X(i))との差ΔY(i)がわかり、出力値Y(i)を求めることができる。一方、ステップ143では、ΔX(i)をアドレスADRに対応する配列要素a[ADR(i)]に格納する。このようにすれば、ルックアップテーブルを参照することにより、X(i)=F(IN1,IN2)により求められた入力値X(i)から理想的な入力値Xrev(i)を求めることができる。理想的な入力値Xrev(i)を求めることが出来れば、Y(i)=Z(Xrev(i))より、出力値Y(i)を求めることができる。このようにすれば、前述の方法と同様、ルックアップテーブルに使用するメモリを減少させることができる。このような方法でルックアップテーブルの作成を行った場合、すでに説明したように、演算装置による出力演算(ステップ103)手順も変更する必要があり、図4のように処理していたものを図7のように変更する。変更点は、ステップ133乃至ステップ134がステップ153乃至ステップ154のように変更されている。ステップ132においてアドレスADRを求めるまでは同じである。ステップ131で求められた入力値XをアドレスADR(i)を有する配列要素a[ADR(i)]で補正し、理想的な入力値Xrevを求める(ステップ153)。次に、一次関数Zに理想的な入力値Xrevを入力し得られる出力Z(Xrev)を出力する。このようにすれば、図5に示された方法で作成されたルックアップテーブルを用いて精度よく出力を求めることが可能となる。ここで、a[ADR(i)]は配列要素であり、要素数は有限である。従って、アドレスADRを有する配列要素a[ADR(i)]が存在しない場合がある。そのような場合は、アドレスADRを有する配列要素a[ADR(i)]が存在するアドレスADRのうち、アドレスADRより値が小さいアドレスのうち、最もアドレスADRに近い値となるアドレスを有する配列要素a[ADR(i)]と、アドレスADRより値が大きいアドレスのうち、最もアドレスADRに近い値となるアドレスを有する配列要素a[ADR(i)]とを結んだ直線が、アドレスADRを示す直線と交わる点を求め、アドレスADRを有する配列要素a[ADR(i)]であるとすればよい。 The same effect can be obtained even if some processes are changed. For example, the procedure for creating the lookup table (step 102) can be changed. The lookup table creation procedure is shown in FIG. 3, but it can be changed as shown in FIG. That is, the process in step 123 may be changed as in step 143. That is, assuming that the inverse function of the linear function Y = Z (X) is X = Z −1 (Y), the array element a [ADR (i) having the address ADR (i) associated with the input value X (i). ], The difference between the output value X (i) and Z −1 (Y (i)) is stored. In other words, the value indicated by Z −1 (Y (i)) is an ideal input value Xrev (i) when the output is obtained by the linear function Z, and the array element a [ADR (i)] The difference between the ideal input value Xrev (i) and the input value X (i) obtained from the function F by X (i) = F (IN1 (i), IN2 (i)) is stored. In this process, Z (X) is preferably a straight line including the maximum value and the minimum value of the output value Y. The array element a [ADR (i)] has an ideal input value Xrev (i) and an input value X (i) obtained from X (i) = F (IN1 (i), IN2 (i)). Therefore, if Z (X) is a straight line including the maximum value and the minimum value of the output value Y, the array element a [ADR (i)] can be easily obtained. Here, a [ADR (i)] is an array element, and the number of elements is finite. Therefore, there is a case where the array element a [ADR (i)] having the address ADR (i) does not exist and the difference between the output values Y (i) and Z (X (i)) cannot be stored as it is. In such a case, it is assumed that the array element a [ADR (i)] having the address ADR (i) exists, and interpolation is performed between the array elements a [ADR (i)] and the corresponding array element a [ The value of array element a [ADR (i)] having address ADR (i) where ADR (i)] exists may be obtained and stored. FIG. 6 shows a conceptual diagram of the lookup table creation shown in step 123 and step 143. In step 123, ΔY (i) is stored in the array element a [ADR (i)] corresponding to the address ADR. Z (X (i)) is obtained using the input value X (i) obtained by X (i) = F (IN1, IN2). By referring to the lookup table, the difference ΔY (i) between the output values Y (i) and Z (X (i)) to be obtained can be known, and the output value Y (i) can be obtained. On the other hand, in step 143, ΔX (i) is stored in the array element a [ADR (i)] corresponding to the address ADR. In this way, the ideal input value Xrev (i) can be obtained from the input value X (i) obtained by X (i) = F (IN1, IN2) by referring to the lookup table. it can. If the ideal input value Xrev (i) can be obtained, the output value Y (i) can be obtained from Y (i) = Z (Xrev (i)). In this way, the memory used for the lookup table can be reduced as in the above method. When the lookup table is created by such a method, as already described, it is necessary to change the procedure of the output calculation (step 103) by the arithmetic unit, and what has been processed as shown in FIG. Change to 7 As for changes, step 133 to step 134 are changed as step 153 to step 154. The process is the same until the address ADR is obtained in step 132. The input value X obtained in step 131 is corrected with the array element a [ADR (i)] having the address ADR (i) to obtain an ideal input value Xrev (step 153). Next, an output Z (Xrev) obtained by inputting an ideal input value Xrev to the linear function Z is output. In this way, it is possible to obtain the output with high accuracy using the lookup table created by the method shown in FIG. Here, a [ADR (i)] is an array element, and the number of elements is finite. Therefore, the array element a [ADR (i)] having the address ADR may not exist. In such a case, among the addresses ADR having the array element a [ADR (i)] having the address ADR, the array element having the address closest to the address ADR among the addresses having a value smaller than the address ADR. A straight line connecting a [ADR (i)] and an array element a [ADR (i)] having an address closest to the address ADR among addresses having a value larger than the address ADR indicates the address ADR. A point that intersects with the straight line is obtained, and the array element a [ADR (i)] having the address ADR may be used.

このように、入力値X(i)と出力値Y(i)との対応関係を予想する一次関数Z(X)を予め定義することにより、複雑な関数(arctan等)を用いないで入力と出力を関連付けることが可能となる。つまり、出力値Y(i)を求める演算が容易となる。また、メモリ参照方式を用いる場合は、入力値X(i)と一次関数Z−1(Y(i))との差分、または、出力値Y(i)と一次関数Z(X)の差分を配列要素a[ADR(i)]としてルックアップテーブルとすることにより、精度を維持したままルックアップテーブルに使用するメモリを減少させることができる。
(実施例1)
In this way, by defining in advance a linear function Z (X) that predicts the correspondence between the input value X (i) and the output value Y (i), the input function can be obtained without using a complex function (arctan or the like). Outputs can be associated. That is, the calculation for obtaining the output value Y (i) is facilitated. When the memory reference method is used, the difference between the input value X (i) and the linear function Z −1 (Y (i)) or the difference between the output value Y (i) and the linear function Z (X) is calculated. By using the lookup table as the array element a [ADR (i)], the memory used for the lookup table can be reduced while maintaining the accuracy.
Example 1

次に、図8を参照しながら本実施例に関わる角度センサ201の構成について説明する。角度センサ201は、回転軸202の所定の基準位置からの回転角(0deg〜360deg)を検出するための角度検出装置である。但し、本実施形態は回転軸202に噛合するギア等を設けることにより、360deg以上の角度(多回転絶対角)を検出可能な角度センサにも適用可能である。回転軸202として、例えば、モーターの回転軸やステアリングシャフトを挙げることができるが、これに限定されるものではない。角度センサ201は、回転軸202の軸芯回りの回転に連動して回転する磁石203と、回転軸202の軸の周辺部に、回転軸202の軸とは独立に固定され、回転軸202の回転角の情報を担う検出信号(入力信号IN1)を出力する磁気センサ205と、磁気センサ205から出力される検出信号を増幅する増幅器(AMP)208と、増幅器208によって増幅されたアナログ信号としての検出信号をデジタル信号に変換するA/D変換器209と、回転軸202の軸の周辺部に、回転軸202の軸とは独立に固定され、回転軸202の回転角の情報を担う検出信号(入力信号IN2)を出力する磁気センサ212と、磁気センサ212から出力される検出信号を増幅する増幅器(AMP)215と、増幅器215によって増幅されたアナログ信号としての検出信号をデジタル信号に変換するA/D変換器216と、A/D変換器209、および、A/D変換器216からの出力信号の組み合わせから回転軸202の回転角を求める演算回路(MPU)210とを備える。磁気センサ205から出力される入力信号IN1、および、磁気センサ212から出力される入力信号IN2は、その電気角の位相差が90degである信号となっているが、磁気センサ205、および、磁気センサ212を磁界に対して空間的に異なった位置に配置してもよいし、空間的には同じ位置であるが、検出される磁界の方向が異なるように配置してもよいし、その他、所望の電気角の位相差が得られればどのような方法であってもよい。演算回路210は、例えば、汎用のマイクロコンピュータでもよく或いは専用の信号処理LSIでもよい。磁石203は、回転部材であり、その平面形状(回転軸202に垂直な平面で切断した断面形状)は、例えば、長方形や、円形が好適であるが、特定の形状に限定されるものではなく、角度検出に適した形状であればよい。磁石203は、回転軸202に固定されてもよく、或いはセレーション結合されてもよい。回転軸202の軸芯方向をZ方向とすると、回転軸202の回転に伴い、磁石203はXY平面内で回転する。 Next, the configuration of the angle sensor 201 according to the present embodiment will be described with reference to FIG. The angle sensor 201 is an angle detection device for detecting a rotation angle (0 deg to 360 deg) from a predetermined reference position of the rotation shaft 202. However, the present embodiment is also applicable to an angle sensor that can detect an angle of 360 degrees or more (multi-rotation absolute angle) by providing a gear or the like that meshes with the rotation shaft 202. Examples of the rotating shaft 202 include, but are not limited to, a rotating shaft of a motor and a steering shaft. The angle sensor 201 is fixed to the periphery of the axis of the rotating shaft 202 independently of the axis of the rotating shaft 202, and rotates around the axis of the rotating shaft 202. A magnetic sensor 205 that outputs a detection signal (input signal IN1) that carries information on the rotation angle, an amplifier (AMP) 208 that amplifies the detection signal output from the magnetic sensor 205, and an analog signal amplified by the amplifier 208 An A / D converter 209 that converts a detection signal into a digital signal, and a detection signal that is fixed to the periphery of the axis of the rotating shaft 202 independently of the axis of the rotating shaft 202 and bears information on the rotation angle of the rotating shaft 202 The magnetic sensor 212 that outputs (input signal IN2), the amplifier (AMP) 215 that amplifies the detection signal output from the magnetic sensor 212, and the amplifier 215 The rotation angle of the rotary shaft 202 is obtained from the combination of the A / D converter 216 that converts the detection signal as a analog signal into a digital signal, the A / D converter 209, and the output signal from the A / D converter 216. And an arithmetic circuit (MPU) 210. The input signal IN1 output from the magnetic sensor 205 and the input signal IN2 output from the magnetic sensor 212 are signals having an electrical angle phase difference of 90 degrees. The magnetic sensor 205 and the magnetic sensor 212 may be arranged at spatially different positions with respect to the magnetic field, or at the same spatial position, but may be arranged so that the direction of the detected magnetic field is different. Any method may be used as long as the electrical angle phase difference can be obtained. The arithmetic circuit 210 may be, for example, a general-purpose microcomputer or a dedicated signal processing LSI. The magnet 203 is a rotating member, and its planar shape (cross-sectional shape cut by a plane perpendicular to the rotating shaft 202) is preferably, for example, a rectangle or a circle, but is not limited to a specific shape. Any shape suitable for angle detection may be used. The magnet 203 may be fixed to the rotating shaft 202 or may be serrated. When the axial direction of the rotating shaft 202 is the Z direction, the magnet 203 rotates in the XY plane as the rotating shaft 202 rotates.

磁気センサ205は、磁石203の回転に伴い周期的に変化する外部磁界204の変化を出力電圧変化として検出する磁気抵抗効果素子207と、磁気抵抗効果素子207にセンス電流を供給するプリント配線基板206とを備える。磁気センサ212は、磁石203の回転に伴い周期的に変化する外部磁界211の変化を出力電圧変化として検出する磁気抵抗効果素子214と、磁気抵抗効果素子214にセンス電流を供給するプリント配線基板213とを備える。磁気抵抗効果素子207および磁気抵抗効果素子214として、例えば、巨大磁気抵抗(GMR)型、トンネル磁気抵抗(TMR)型、弾道磁気抵抗(BMR)型、異方性磁気抵抗(AMR)型等の公知の磁気抵抗効果素子を用いることができる。なお、センス電流に変えて、センス電圧を供給してもよく、磁気抵抗効果素子207、および、磁気抵抗効果素子214の出力電圧変化を電流変化に変更してもよい。 The magnetic sensor 205 includes a magnetoresistive effect element 207 that detects a change in the external magnetic field 204 that periodically changes as the magnet 203 rotates as an output voltage change, and a printed wiring board 206 that supplies a sense current to the magnetoresistive effect element 207. With. The magnetic sensor 212 includes a magnetoresistive effect element 214 that detects a change in the external magnetic field 211 that periodically changes as the magnet 203 rotates as an output voltage change, and a printed wiring board 213 that supplies a sense current to the magnetoresistive effect element 214. With. Examples of the magnetoresistive effect element 207 and the magnetoresistive effect element 214 include a giant magnetoresistive (GMR) type, a tunnel magnetoresistive (TMR) type, a ballistic magnetoresistive (BMR) type, and an anisotropic magnetoresistive (AMR) type. A known magnetoresistive element can be used. Note that a sense voltage may be supplied instead of the sense current, and changes in output voltages of the magnetoresistive effect element 207 and the magnetoresistive effect element 214 may be changed to current changes.

図9は磁気抵抗効果素子207の断面構造を示す。磁気抵抗効果素子214も全く同じ構造であるので、ここでは記載を省略する。磁気抵抗効果素子207は下地層220、反強磁性層221、磁化固定層222、非磁性導電層223、磁化自由層224、および保護層225を積層してなる素子構造を有している。磁化固定層222の磁化方向222Aは、反磁性層221の磁化方向221Aと強固にカップリングしているため、外部磁界204の影響を殆ど受けない。一方、磁化自由層224の磁化方向224Aは、外部磁界204の磁化方向に追随するように変化する。磁気抵抗効果素子207の電気抵抗は(以下、電気抵抗は抵抗と記載)、磁気抵抗効果素子207が検出する外部磁界204の磁界強度とその磁界方向に依存して変化することが知られている。仮に外部磁界204の磁界強度が一定である場合には、磁気抵抗効果素子207の抵抗は、磁化固定層222の磁化方向222Aと磁化自由層224の磁化方向224Aとの角度差(ξ)に依存して変化する。より詳細には、磁気抵抗効果素子207の抵抗は、(1−cosξ)に比例して変化する特性を有しており、磁化固定層222の磁化方向222Aと磁化自由層224の磁化方向224Aとが同一方向かつ平行である時に抵抗は最小となり、磁化固定層222の磁化方向222Aと磁化自由層224の磁化方向224Aとが逆方向かつ平行である時に抵抗は最大になる。上述の如く、磁気抵抗効果素子207には、プリント配線基板207からセンス電流が供給されており、磁気抵抗効果素子207の抵抗の変化は、出力電圧変化として検出される。磁気抵抗効果素子207の出力電圧は、回転軸202の回転角度の情報を担う検出信号として出力される。 FIG. 9 shows a cross-sectional structure of the magnetoresistive effect element 207. Since the magnetoresistive effect element 214 has the same structure, the description is omitted here. The magnetoresistive effect element 207 has an element structure in which an underlayer 220, an antiferromagnetic layer 221, a magnetization fixed layer 222, a nonmagnetic conductive layer 223, a magnetization free layer 224, and a protective layer 225 are stacked. Since the magnetization direction 222A of the magnetization fixed layer 222 is strongly coupled to the magnetization direction 221A of the diamagnetic layer 221, it is hardly affected by the external magnetic field 204. On the other hand, the magnetization direction 224 </ b> A of the magnetization free layer 224 changes so as to follow the magnetization direction of the external magnetic field 204. It is known that the electrical resistance of the magnetoresistive effect element 207 (hereinafter, electrical resistance is described as resistance) changes depending on the magnetic field strength of the external magnetic field 204 detected by the magnetoresistive effect element 207 and the direction of the magnetic field. . If the magnetic field strength of the external magnetic field 204 is constant, the resistance of the magnetoresistive element 207 depends on the angular difference (ξ) between the magnetization direction 222A of the magnetization fixed layer 222 and the magnetization direction 224A of the magnetization free layer 224. And change. More specifically, the resistance of the magnetoresistive effect element 207 has a characteristic that changes in proportion to (1-cosξ). The magnetization direction 222A of the magnetization fixed layer 222 and the magnetization direction 224A of the magnetization free layer 224 Are the same and parallel, the resistance is minimized, and the resistance is maximized when the magnetization direction 222A of the magnetization fixed layer 222 and the magnetization direction 224A of the magnetization free layer 224 are opposite and parallel. As described above, the magnetoresistive effect element 207 is supplied with a sense current from the printed wiring board 207, and a change in resistance of the magnetoresistive effect element 207 is detected as a change in output voltage. The output voltage of the magnetoresistive effect element 207 is output as a detection signal that carries information on the rotation angle of the rotating shaft 202.

次に、図3を参照しながら演算手段について説明する。本実施例ではルックアップテーブルの作成は行わないので、演算手段は、図1に示すステップ101、103の手順に基づいて行う。ここでは、磁気センサ205の出力電圧を入力信号IN1、磁気センサ212の出力電圧を入力信号IN2とし、回転軸202の回転角を出力値Yとすればよい。 Next, the calculation means will be described with reference to FIG. Since no lookup table is created in this embodiment, the computing means is based on the procedures of steps 101 and 103 shown in FIG. Here, the output voltage of the magnetic sensor 205 may be the input signal IN1, the output voltage of the magnetic sensor 212 may be the input signal IN2, and the rotation angle of the rotating shaft 202 may be the output value Y.

まず、図2に従い、直線の定義(ステップ101)について説明する。本実施例では、前述のように、磁気抵抗効果素子207の抵抗が(1−cosξ)に比例して変化するため、磁気センサ205の出力電圧は正弦波状の信号が予想される。磁気抵抗効果素子214も同様であり、演算回路210には、位相が90deg異なる正弦波状の1対の入力信号IN1、入力信号IN2が与えられる。図10に入力信号IN1、入力信号IN2を図示する。ここで、入力軸は回転軸202の回転角度(出力値Y)に相当し、出力軸は磁気抵抗効果素子207の想定される出力電圧(IN1)、および、磁気抵抗効果素子214の想定される出力電圧(IN2)に相当する。関数Fには、入力信号IN1、入力信号IN2のうち入力信号の中間値を0とした絶対値が小さい方の入力信号を絶対値の大きい方の入力信号で除する演算が含まれることが好ましい。この演算を行うと、図11に示すような演算結果が得られる。ここで、入力軸は回転軸202の回転角度に相当し、出力軸は入力信号の中間値を0とした絶対値の小さい方の入力信号の値を絶対値の大きい方の入力信号の値で除した演算値を示している。さらに、関数Fにより得られる入力値Xは、入力値Xと出力値Yが一対一に対応する。この条件を満たすために、ここでは、演算値にオフセット値を加える。以上のように関数Fを定義する。なお、F(IN1、IN2)は入力信号IN1、入力信号IN2の中間値を0とする演算を含むものとする。また、本実施例では、説明のため、入力信号IN1と入力信号IN2の最大値と最小値の差を同一の値として説明する。入力信号IN1と入力信号IN2の最大値と最小値の差を同一の値とすることにより、より直線に近い入力値Xと出力値Yの関係が得られている。関数F(IN1、IN2)を整理すると以下となる(ステップ111)。
F(IN1、IN2)=IN1/IN2+1 (1)
(但し、|IN2|≧|IN1|かつIN2≧0)
F(IN1、IN2)=IN2/IN1+7 (2)
(但し、|IN1|>|IN2|かつIN1≧0)
F(IN1、IN2)=IN1/IN2+5 (3)
(但し、|IN2|≧|IN1|かつIN2<0)
F(IN1、IN2) =IN2/IN1+3 (4)
(但し、|IN1|>|IN2|かつIN1<0)
図12に関数Fによる演算結果を示す。ここで、入力軸は回転軸202の回転角度に相当し、出力軸はF(IN1,IN2)、すなわち、入力値Xに相当する。図12から明らかなように、回転角度(出力値Y)と入力値Xとのそれぞれが一対一に対応し、かつ、上記式(1)〜式(4)のそれぞれを満たすように、離散的な関係を有している。関数Fはこの演算に限られるものではなく、例えば、図11に示された演算値に−1を乗じたものにオフセットを加えてもよい。本実施例では、入力値Xから出力値Yを求める必要があるので、図12において回転角度(出力値Y)を示している入力軸と入力値Xを示している出力軸を入れ替える必要がある。つまり、入力値Xを入力軸とし、回転角度(出力値Y)を出力軸とする必要がある。図13に入力値と出力値を入れ替えた結果を示す。ここで、入力軸は入力値Xに相当し、出力軸は回転軸202の回転角度(出力値Y)に相当する。併せて記載されている一次関数Z(X)については後述する。ここで、直線の分割範囲は、範囲1:0≦X≦2、範囲2:2<X<4、範囲3:4≦X≦6、範囲4:6<X<8のように分割される(ステップ112)。ここで、Yの最小値と最大値を結ぶ直線Z(X)を考えると、範囲1に与えられる直線と範囲3に与えられる直線Z(X)が一致し、同様に、範囲2に与えられる直線と範囲4に与えられる直線Z(X)が一致し、Z(X)は以下の式で与えられる(ステップ113)。
Z(X)=45×X (5)
(但し、0≦X≦2、4≦X≦6)
Z(X)=−45×X+450 (6)
(但し、2<X<4、6<X<8)
図13から明らかなように、入力値Xと回転角度(出力値Y)とのそれぞれが一対一に対応し、かつ、上記式(1)〜式(4)のそれぞれを満たすように、離散的な関係を有している。また、式(5)、式(6)を満たす入力値XとZ(X)とは離散的な関係を有している。以上により、直線の定義(ステップ101)は終了となる。ここで、入力軸は入力値Xに相当し、出力軸は回転軸202の回転角度に相当する。対応する入力値Xの範囲に対しては出力値YとZ(X)がよく一致していることが分かる。本実施例では、ステップ113を解析的な演算により行ったが、これに限定するものではなく、実測のデータを基にして演算回路210により行ってもよいし、外部に用意された専用の演算装置を用いて行ってもよいし、その他どのような手段を用いて定義してもよい。
First, the definition of a straight line (step 101) will be described with reference to FIG. In this embodiment, as described above, since the resistance of the magnetoresistive effect element 207 changes in proportion to (1-cosξ), the output voltage of the magnetic sensor 205 is expected to be a sinusoidal signal. The same applies to the magnetoresistive effect element 214, and the arithmetic circuit 210 is provided with a pair of sine wave input signals IN1 and IN2 having a phase difference of 90 degrees. FIG. 10 illustrates the input signal IN1 and the input signal IN2. Here, the input shaft corresponds to the rotation angle (output value Y) of the rotating shaft 202, the output shaft is assumed to be the output voltage (IN 1) of the magnetoresistive effect element 207, and the magnetoresistive effect element 214 is assumed. This corresponds to the output voltage (IN2). The function F preferably includes an operation of dividing an input signal having a smaller absolute value with the intermediate value of the input signal being 0 among the input signals IN1 and IN2 by an input signal having a larger absolute value. . When this calculation is performed, a calculation result as shown in FIG. 11 is obtained. Here, the input shaft corresponds to the rotation angle of the rotary shaft 202, and the output shaft is the value of the input signal having the smaller absolute value with the intermediate value of the input signal being 0, and the value of the input signal having the larger absolute value. The calculated value is shown. Further, the input value X obtained by the function F has a one-to-one correspondence between the input value X and the output value Y. In order to satisfy this condition, an offset value is added to the calculated value here. The function F is defined as described above. Note that F (IN1, IN2) includes an operation for setting the intermediate value of the input signal IN1 and the input signal IN2 to zero. In this embodiment, for the sake of explanation, the difference between the maximum value and the minimum value of the input signal IN1 and the input signal IN2 will be described as the same value. By making the difference between the maximum value and the minimum value of the input signal IN1 and the input signal IN2 the same value, the relationship between the input value X and the output value Y closer to a straight line is obtained. The function F (IN1, IN2) is organized as follows (step 111).
F (IN1, IN2) = IN1 / IN2 + 1 (1)
(However, | IN2 | ≧ | IN1 | and IN2 ≧ 0)
F (IN1, IN2) = IN2 / IN1 + 7 (2)
(However, | IN1 |> | IN2 | and IN1 ≧ 0)
F (IN1, IN2) = IN1 / IN2 + 5 (3)
(However, | IN2 | ≧ | IN1 | and IN2 <0)
F (IN1, IN2) = IN2 / IN1 + 3 (4)
(However, | IN1 |> | IN2 | and IN1 <0)
FIG. 12 shows the calculation result by the function F. Here, the input shaft corresponds to the rotation angle of the rotation shaft 202, and the output shaft corresponds to F (IN1, IN2), that is, the input value X. As is apparent from FIG. 12, the rotation angle (output value Y) and the input value X correspond one-to-one and are discrete so as to satisfy the above formulas (1) to (4). Have a good relationship. The function F is not limited to this calculation, and for example, an offset may be added to the calculation value shown in FIG. 11 multiplied by -1. In this embodiment, since it is necessary to obtain the output value Y from the input value X, the input shaft indicating the rotation angle (output value Y) and the output shaft indicating the input value X in FIG. . That is, it is necessary to use the input value X as an input shaft and the rotation angle (output value Y) as an output shaft. FIG. 13 shows the result of switching the input value and the output value. Here, the input shaft corresponds to the input value X, and the output shaft corresponds to the rotation angle (output value Y) of the rotating shaft 202. The linear function Z (X) described together will be described later. Here, the division range of the straight line is divided such that range 1: 0 ≦ X ≦ 2, range 2: 2 <X <4, range 3: 4 ≦ X ≦ 6, range 4: 6 <X <8. (Step 112). Here, when considering the straight line Z (X) connecting the minimum value and the maximum value of Y, the straight line given to the range 1 and the straight line Z (X) given to the range 3 coincide with each other, and similarly given to the range 2. The straight line and the straight line Z (X) given to the range 4 coincide with each other, and Z (X) is given by the following equation (step 113).
Z (X) = 45 × X (5)
(However, 0 ≦ X ≦ 2, 4 ≦ X ≦ 6)
Z (X) = − 45 × X + 450 (6)
(However, 2 <X <4, 6 <X <8)
As is clear from FIG. 13, the input value X and the rotation angle (output value Y) correspond to each other in a one-to-one correspondence and satisfy the above-described equations (1) to (4). Have a good relationship. Further, the input values X and Z (X) satisfying the expressions (5) and (6) have a discrete relationship. Thus, the definition of the straight line (step 101) is completed. Here, the input shaft corresponds to the input value X, and the output shaft corresponds to the rotation angle of the rotation shaft 202. It can be seen that the output value Y and Z (X) are in good agreement with the corresponding input value X range. In this embodiment, step 113 is performed by analytical calculation. However, the present invention is not limited to this, and may be performed by the arithmetic circuit 210 based on actually measured data, or a dedicated calculation prepared outside. It may be performed using an apparatus, or may be defined using any other means.

次に、図4に従い演算装置による出力演算(ステップ103)について説明する。前述のように、実施例1ではルックアップテーブルを使用しないので、ステップ132、ステップ134は省略される。まず、A/D変換器209より入力信号IN1を、A/D変換器216より入力信号IN2を取り込み、取り込んだ値より入力値Xを求める(ステップ131)。例として、図10に示した理想波形において回転角(出力値Y)が 230degの値であるIN1=−0.087(プロットO1)、IN2=−0.996(プロットO2)を用いて説明する。ここで、|IN2|≧|IN1|かつIN2<0であるので、関数Fの定義より、式(3)が適用され、X=IN1/IN2+5を用いて計算すると、X=5.09となる。続いて、Z(X)を演算し、演算結果を出力とする(ステップ133)。入力値Xの値より、式(5)が適用され、Z(X)=45×Xとなる。従って、出力はZ(X)=229.1(deg)となり、ほぼ正確な出力が得られることがわかる。 Next, the output calculation (step 103) by the calculation device will be described with reference to FIG. As described above, since the lookup table is not used in the first embodiment, steps 132 and 134 are omitted. First, the input signal IN1 is acquired from the A / D converter 209 and the input signal IN2 is acquired from the A / D converter 216, and the input value X is obtained from the acquired value (step 131). As an example, description will be made using IN1 = −0.087 (plot O1) and IN2 = −0.996 (plot O2) where the rotation angle (output value Y) is 230 deg in the ideal waveform shown in FIG. . Here, since | IN2 | ≧ | IN1 | and IN2 <0, Expression (3) is applied from the definition of the function F, and when X = IN1 / IN2 + 5 is used, X = 0.09. . Subsequently, Z (X) is calculated, and the calculation result is output (step 133). Expression (5) is applied from the value of the input value X, and Z (X) = 45 × X. Therefore, the output is Z (X) = 229.1 (deg), and it can be seen that an almost accurate output can be obtained.

本実施例のように入力が正弦波状である場合には、上記で定義した関数Fの代わりに、関数Fに基本波の1/10程度の振幅を有する正弦波の値を加算した、あるいは、減算した関数Frevを用いるとより正確な出力が得られる。加法定理を用いると、sin(4θ)=4×sin(θ)×cos(θ)×(1−2×sin(θ))となるので、Frev(IN1、IN2)は以下のように定義される。
Frev(IN1、IN2)=IN1/IN2+1
+0.4×IN1×IN2×(1−2×IN1(θ))(7)
(但し、|IN2|≧|IN1|かつIN1≧0)
Frev(IN1、IN2)=IN2/IN1+7
−0.4×IN1×IN2×(1−2×IN1(θ)) (8)
(但し、|IN1|>|IN2|かつIN1≧0)
Frev(IN1、IN2)=IN1/IN2+5
+0.4×IN1×IN2×(1−2×IN1(θ) (9)
(但し、|IN2|≧|IN1|かつIN1<0)
Frev(IN1、IN2)=IN2/IN1+3
−0.4×IN1×IN2×(1−2×IN1(θ))(10)
(但し、|IN1|>|IN2|かつIN1<0)
図13に示されている出力値Yと一次関数Z(X)との差を図14に示す。ここで、入力軸は入力値Xに相当し、出力軸は出力値Yと一次関数Z(X)との差、すなわち、本実施例を行った時に発生する角度誤差に相当する。関数Fの代わりに関数Frevを用いた場合についても図14に示されている。関数Fを用いた場合は、±4deg程度の値を示すのに対して、関数Frevを用いた場合は±1deg程度となっていることが分かる。このように、関数Frevを用いると角度精度の改善が期待できる。また、後述のルックアップテーブル方式においては、関数Frevを用いることによりテーブルに格納される最大値が1/4程度となり、関数Fを使用した場合と比較して、メモリをさらに2バイト程度削減することが期待できる。
(実施例2)
When the input is sinusoidal as in this embodiment, instead of the function F defined above, a value of a sine wave having an amplitude of about 1/10 of the fundamental wave is added to the function F, or A more accurate output can be obtained by using the subtracted function Frev. Using the addition theorem, sin (4θ) = 4 × sin (θ) × cos (θ) × (1-2 × sin 2 (θ)), so that Frev (IN1, IN2) is defined as follows: Is done.
Frev (IN1, IN2) = IN1 / IN2 + 1
+ 0.4 × IN1 × IN2 × (1-2 × IN1 2 (θ)) (7)
(However, | IN2 | ≧ | IN1 | and IN1 ≧ 0)
Frev (IN1, IN2) = IN2 / IN1 + 7
−0.4 × IN1 × IN2 × (1-2 × IN1 2 (θ)) (8)
(However, | IN1 |> | IN2 | and IN1 ≧ 0)
Frev (IN1, IN2) = IN1 / IN2 + 5
+ 0.4 × IN1 × IN2 × (1-2 × IN1 2 (θ) (9)
(However, | IN2 | ≧ | IN1 | and IN1 <0)
Frev (IN1, IN2) = IN2 / IN1 + 3
−0.4 × IN1 × IN2 × (1-2 × IN1 2 (θ)) (10)
(However, | IN1 |> | IN2 | and IN1 <0)
FIG. 14 shows the difference between the output value Y and the linear function Z (X) shown in FIG. Here, the input axis corresponds to the input value X, and the output axis corresponds to the difference between the output value Y and the linear function Z (X), that is, the angle error generated when this embodiment is performed. The case where the function Frev is used instead of the function F is also shown in FIG. It can be seen that when the function F is used, the value is about ± 4 deg, whereas when the function Frev is used, the value is about ± 1 deg. As described above, the use of the function Frev can be expected to improve the angle accuracy. In the look-up table method described later, the maximum value stored in the table is about 1/4 by using the function Frev, and the memory is further reduced by about 2 bytes as compared with the case where the function F is used. I can expect that.
(Example 2)

次に、図15を参照しながら本実施例に関わる角度センサ401の構成について説明する。角度センサ401は、回転軸402の所定の基準位置からの回転角(0deg〜360deg)を検出するための角度検出装置である。回転軸402として、例えば、ステアリングシャフトを挙げることができるが、これに限定されるものではない。角度センサ401は、回転軸402の軸芯回りの回転に連動して回転し円周方向に12極(6組)の磁極を有するリング状の多極磁石403と、多極磁石403と回転軸方向に離れた位置に設置され、回転軸402の軸芯回りの回転に連動して回転し円周方向に10極(5組)の磁極を有するリング状の多極磁石404と、回転軸402の軸の周辺部に、回転軸402の軸とは独立に固定され、回転軸402の回転角の情報を担う検出信号入力信号IN1を出力する磁気センサ406と、磁気センサ406から出力される検出信号を増幅する増幅器(AMP)409と、増幅器409によって増幅されたアナログ信号としての検出信号をデジタル信号に変換するA/D変換器410と、回転軸402の軸の周辺部に、回転軸402の軸とは独立に固定され、回転軸402の回転角の情報を担う検出信号入力信号IN2を出力する磁気センサ412と、磁気センサ412から出力される検出信号を増幅する増幅器(AMP)415と、増幅器415によって増幅されたアナログ信号としての検出信号をデジタル信号に変換するA/D変換器416と、回転軸402の軸の周辺部に、回転軸402の軸とは独立に固定され、回転軸402の回転角の情報を担う検出信号(入力信号IN3)を出力する磁気センサ418と、磁気センサ418から出力される検出信号を増幅する増幅器(AMP)421と、増幅器421によって増幅されたアナログ信号としての検出信号をデジタル信号に変換するA/D変換器422と、回転軸402の軸の周辺部に、回転軸402の軸とは独立に固定され、回転軸402の回転角の情報を担う検出信号(入力信号IN4)を出力する磁気センサ424と、磁気センサ424から出力される検出信号を増幅する増幅器(AMP)427と、増幅器427によって増幅されたアナログ信号としての検出信号をデジタル信号に変換するA/D変換器428と、記憶部に記憶されているルックアップテーブル(LUT)430と、ルックアップテーブル430を参照して、A/D変換器410、および、A/D変換器416、および、A/D変換器422、および、A/D変換器428からの出力信号の組み合わせから回転軸402の回転角を求める演算回路(MPU)429とを備える。磁気センサ406から出力される入力信号IN1、および、磁気センサ412から出力される入力信号IN2は、その電気角の位相差が90degである信号となっているが、これは、磁気センサ406、および、磁気センサ412を磁界に対して空間的に異なった位置に配置してもよいし、空間的には同じ位置であるが、検出される磁界の方向が異なるように配置してもよいし、その他、所望の位相差が得られればどのような方法であってもよい。同様に、磁気センサ418から出力される入力信号IN3、および、磁気センサ424から出力される入力信号IN4は、その電気角の位相差が90degである信号となっているが、磁気センサ418、および、磁気センサ424を磁界に対して空間的に異なった位置に配置してもよいし、空間的には同じ位置で、検出される磁界の方向が異なるように配置してもよいし、その他、所望の位相差が得られればどのような方法であってもよい。演算回路429は、例えば、汎用のマイクロコンピュータでもよく或いは専用の信号処理LSIでもよい。多極磁石403および多極磁石404は、回転部材であり、その平面形状(回転軸402に垂直な平面で切断した断面形状)は、例えば、中空円筒形が好適であるが、特定の形状に限定されるものではなく、角度検出に適した形状であればよい。磁石403は、回転軸402に固定されてもよく、或いはセレーション結合されてもよい。磁石404は、回転軸402に固定されてもよく、或いはセレーション結合されてもよい。回転軸402の軸芯方向をZ方向とすると、回転軸402の回転に伴い、多極磁石403および多極磁石404はXY平面内で回転する。 Next, the configuration of the angle sensor 401 according to the present embodiment will be described with reference to FIG. The angle sensor 401 is an angle detection device for detecting a rotation angle (0 deg to 360 deg) from a predetermined reference position of the rotation shaft 402. Examples of the rotating shaft 402 include a steering shaft, but are not limited thereto. The angle sensor 401 rotates in conjunction with the rotation of the rotating shaft 402 around the axis, and has a ring-shaped multipolar magnet 403 having 12 poles (six sets) of magnetic poles in the circumferential direction, the multipolar magnet 403 and the rotating shaft. A ring-shaped multipolar magnet 404 which is installed at a position distant from the direction and rotates in conjunction with rotation around the axis of the rotation shaft 402 and has 10 poles (5 sets) in the circumferential direction; A magnetic sensor 406 that outputs a detection signal input signal IN1 that is fixed independently of the axis of the rotating shaft 402 and carries information on the rotation angle of the rotating shaft 402, and a detection that is output from the magnetic sensor 406. An amplifier (AMP) 409 that amplifies the signal, an A / D converter 410 that converts a detection signal as an analog signal amplified by the amplifier 409 into a digital signal, and a rotary shaft 402 around the axis of the rotary shaft 402 The axis of , A magnetic sensor 412 that outputs a detection signal input signal IN2 that bears information on the rotation angle of the rotating shaft 402, an amplifier (AMP) 415 that amplifies the detection signal output from the magnetic sensor 412, and amplifies by the amplifier 415 The A / D converter 416 that converts the detected signal as an analog signal into a digital signal, and the rotation shaft 402 is fixed to the periphery of the rotation shaft 402 independently of the rotation shaft 402. Sensor 418 that outputs a detection signal (input signal IN 3) that carries the information of, an amplifier (AMP) 421 that amplifies the detection signal output from the magnetic sensor 418, and a detection signal as an analog signal amplified by the amplifier 421 A / D converter 422 for converting the signal into a digital signal and the periphery of the axis of the rotating shaft 402 are fixed independently of the axis of the rotating shaft 402 , A magnetic sensor 424 that outputs a detection signal (input signal IN4) that carries information on the rotation angle of the rotating shaft 402, an amplifier (AMP) 427 that amplifies the detection signal output from the magnetic sensor 424, and an amplifier 427 A / D converter 428 for converting the detected signal as an analog signal into a digital signal, a lookup table (LUT) 430 stored in the storage unit, and A / D conversion with reference to lookup table 430 Calculator 410, A / D converter 416, A / D converter 422, and arithmetic circuit (MPU) 429 for obtaining the rotation angle of rotating shaft 402 from the combination of output signals from A / D converter 428 With. The input signal IN1 output from the magnetic sensor 406 and the input signal IN2 output from the magnetic sensor 412 are signals having an electrical angle phase difference of 90 deg. The magnetic sensor 412 may be arranged at spatially different positions with respect to the magnetic field, or may be arranged at the same spatial position but different in the direction of the detected magnetic field, In addition, any method may be used as long as a desired phase difference can be obtained. Similarly, the input signal IN3 output from the magnetic sensor 418 and the input signal IN4 output from the magnetic sensor 424 are signals having an electrical angle phase difference of 90 deg. The magnetic sensor 424 may be arranged at a spatially different position with respect to the magnetic field, or may be arranged at the same spatial position so that the direction of the detected magnetic field is different. Any method may be used as long as a desired phase difference is obtained. The arithmetic circuit 429 may be, for example, a general-purpose microcomputer or a dedicated signal processing LSI. The multipolar magnet 403 and the multipolar magnet 404 are rotating members, and the planar shape (cross-sectional shape cut by a plane perpendicular to the rotating shaft 402) is preferably a hollow cylindrical shape, for example. The shape is not limited as long as the shape is suitable for angle detection. The magnet 403 may be fixed to the rotating shaft 402 or may be serrated. The magnet 404 may be fixed to the rotating shaft 402 or may be serrated. When the axial direction of the rotating shaft 402 is the Z direction, the multipolar magnet 403 and the multipolar magnet 404 rotate in the XY plane as the rotating shaft 402 rotates.

磁気センサ406は、磁石403の回転に伴い周期的に変化する外部磁界405の変化を電圧変化として検出する磁気抵抗効果素子408と、磁気抵抗効果素子408にセンス電流を供給するプリント配線基板407とを備える。磁気センサ412は、磁石403の回転に伴い周期的に変化する外部磁界411の変化を電圧変化として検出する磁気抵抗効果素子414と、磁気抵抗効果素子414にセンス電流を供給するプリント配線基板413とを備える。磁気センサ418は、磁石404の回転に伴い周期的に変化する外部磁界417の変化を電圧変化として検出する磁気抵抗効果素子420と、磁気抵抗効果素子420にセンス電流を供給するプリント配線基板419とを備える。磁気センサ424は、磁石404の回転に伴い周期的に変化する外部磁界423の変化を電圧変化として検出する磁気抵抗効果素子426と、磁気抵抗効果素子426にセンス電流を供給するプリント配線基板425とを備える。磁気抵抗効果素子408および磁気抵抗効果素子414、磁気抵抗効果素子420、磁気抵抗効果素子426として、例えば、巨大磁気抵抗(GMR)型、トンネル磁気抵抗(TMR)型、弾道磁気抵抗(BMR)型、異方性磁気抵抗(AMR)型等の公知の磁気抵抗効果素子を用いることができる。なお、実施例1と同様、センス電流に変えて、センス電圧を供給してもよく、磁気抵抗効果素子408、および、磁気抵抗効果素子414、および、磁気抵抗効果素子420、および、磁気抵抗効果素子426の出力電圧変化を電流変化に変更してもよい。磁気抵抗効果素子408および磁気抵抗効果素子414、磁気抵抗効果素子420、磁気抵抗効果素子426の断面構造は、実施例1で示した磁気抵抗効果素子207と同じであるためここでは割愛する。 The magnetic sensor 406 includes a magnetoresistive effect element 408 that detects a change in the external magnetic field 405 that periodically changes as the magnet 403 rotates as a voltage change, and a printed wiring board 407 that supplies a sense current to the magnetoresistive effect element 408. Is provided. The magnetic sensor 412 includes a magnetoresistive effect element 414 that detects a change in the external magnetic field 411 that periodically changes as the magnet 403 rotates as a voltage change, and a printed wiring board 413 that supplies a sense current to the magnetoresistive effect element 414. Is provided. The magnetic sensor 418 includes a magnetoresistive effect element 420 that detects a change in the external magnetic field 417 that periodically changes as the magnet 404 rotates as a voltage change, and a printed wiring board 419 that supplies a sense current to the magnetoresistive effect element 420. Is provided. The magnetic sensor 424 includes a magnetoresistive effect element 426 that detects a change in the external magnetic field 423 that periodically changes as the magnet 404 rotates as a voltage change, and a printed wiring board 425 that supplies a sense current to the magnetoresistive effect element 426. Is provided. As the magnetoresistive effect element 408, the magnetoresistive effect element 414, the magnetoresistive effect element 420, and the magnetoresistive effect element 426, for example, giant magnetoresistive (GMR) type, tunnel magnetoresistive (TMR) type, ballistic magnetoresistive (BMR) type A known magnetoresistive element such as an anisotropic magnetoresistive (AMR) type can be used. As in the first embodiment, the sense voltage may be supplied instead of the sense current, and the magnetoresistive effect element 408, the magnetoresistive effect element 414, the magnetoresistive effect element 420, and the magnetoresistive effect. The output voltage change of the element 426 may be changed to a current change. Since the cross-sectional structures of the magnetoresistive effect element 408, the magnetoresistive effect element 414, the magnetoresistive effect element 420, and the magnetoresistive effect element 426 are the same as those of the magnetoresistive effect element 207 shown in the first embodiment, they are omitted here.

次に、図5を参照しながら演算手段について説明する。本実施例における演算手段は、図1に示すステップ101、102、103の手順に基づいて行う。ステップ102は図3に、ステップ103は図4に従う。ここでは、磁気センサ406の出力電圧を入力信号IN1、磁気センサ412の出力電圧を入力信号IN2とし、回転軸402の回転角を出力値Yとすればよい。 Next, the calculation means will be described with reference to FIG. The calculation means in this embodiment is performed based on the procedures of steps 101, 102, and 103 shown in FIG. Step 102 follows FIG. 3, and step 103 follows FIG. Here, the output voltage of the magnetic sensor 406 may be the input signal IN1, the output voltage of the magnetic sensor 412 may be the input signal IN2, and the rotation angle of the rotating shaft 402 may be the output value Y.

まず、図2に従い、直線の定義(ステップ101)について説明する。本実施例では、磁気抵抗効果素子408の抵抗が(1−cosξ)に比例して変化するため、磁気センサ406の出力は正弦波状の信号が予想される。磁気抵抗効果素子414も同様であり、演算回路429には、位相が90deg異なる正弦波状の1対の入力信号IN1、入力信号IN2が与えられる。多極磁石403は円周方向に12極(6組)の磁極を有するため、回転軸402が60deg回転する毎にIN1、IN2に正弦波状の信号1周期が得られる。一方、同様に、多極磁石404は周方向に10極(5組)の磁極を有するため、回転軸402が72deg回転する毎にIN3、IN4に正弦波状の信号1周期が得られる。図16に入力信号IN1、入力信号IN2を図示する。ここで、入力軸は回転軸402の回転角度(出力値Y)に相当し、出力軸は磁気抵抗効果素子408の想定される出力電圧(IN1)、および、磁気抵抗効果素子414の想定される出力電圧(IN2)に相当する。ここで、出力値Yが0となる基準位置は、IN1/IN2=−1、かつ、IN1<0となる点に取っている。IN1、IN2は実測の信号を用いてもよいが、ここでは理想的な信号を用いている。実測の信号を用いても直線定義の手順は全く同じである。関数Fは、入力信号IN1、入力信号IN2のうち入力信号の中間値を0とした絶対値が小さい方の入力信号を絶対値の大きい方の入力信号で除する演算を含むことが好ましい。さらに、入力値Xと出力値Yとを一対一に対応させる。この条件を満たすよう、関数F(IN1、IN2)を以下のように定義する。なお、F(IN1、IN2)は入力信号IN1、入力信号IN2の中間値を0とする演算を含むものとする。(ステップ111)。また、本実施例では、説明のため、入力信号IN1と入力信号IN2の最大値と最小値の差を同一の値として説明する。入力信号IN1と入力信号IN2の最大値と最小値の差を同一の値とすることにより、より直線に近い入力値Xと出力値Yの関係が得られている。ここで、Cは周期数であり、基準位置(この場合は出力値Y=0とした)から入力信号IN1、または、入力信号IN2が繰り返された回数を表す値で、本実施例では、正弦波状の信号が6回繰り返されるので、1≦C≦6を満たす。
F(IN1、IN2)=1+IN1/IN2+8×(C−1) (11)
(但し、|IN2|≧|IN1|かつIN2≧0)
F(IN1、IN2)=3−IN2/IN1+8×(C−1) (12)
(但し、|IN1|>|IN2|かつIN1≧0)
F(IN1、IN2)=5+IN1/IN2+8×(C−1) (13)
(但し、|IN2|≧|IN1|かつIN2<0)
F(IN1、IN2)=7−IN2/IN1+8×(C−1) (14)
(但し、|IN1|>|IN2|かつIN1<0)
図17に、関数Fによる演算結果を示す。ここで、入力軸は回転軸402の回転角度(出力値Y)に相当し、出力軸はF(IN1,IN2)、すなわち、入力値Xに相当する。このように、入力値Xに対して出力値Yが連続で与えられるよう関数Fを定義することが好適であるが、関数Fはそのように限られるものではない。本実施例では、入力値Xから出力値Yを求める必要があるので、図17において回転角度(出力値Y)を示している入力軸と入力値Xを示している出力軸を入れ替えて表示する必要がある。つまり、入力値Xを入力軸とし、回転角度(出力値Y)を出力軸とする必要がある。図18は横軸に入力値X、縦軸に出力値Y(回転軸402の回転角度)を示した図である。ここでは、直線を分割する必要はなく、全範囲に対して同一のZ(X)を定義する。(ステップ112)。Yの最小値と最大値を結ぶ直線Z(X)を考えると、
Z(X)=7.5×X (15)
(但し、0≦X<48)
で与えられる(ステップ113)。このように、Z(X)をひとつの一次関数で定義するので、一次関数を記憶するメモリー量が少なくなり、また、後述する演算処理が容易となる。本実施例では、ステップ113を解析的な演算により行ったが、これに限定するものではなく、実測のデータを基にして演算回路429により行ってもよいし、外部に用意された専用の演算装置を用いて行ってもよいし、その他どのような手段を用いて定義してもよい。例えば、後述のように、入力信号IN1(i)、入力信号IN2(i)を基にルックアップテーブルを作成するが、入力信号IN1(i)、入力信号IN2(i)を流用し、演算回路429または外部に用意した専用の演算装置が最小2乗法により直線を定義するという方法が考えられる。以上により、直線の定義(ステップ101)は終了となる。
First, the definition of a straight line (step 101) will be described with reference to FIG. In this embodiment, since the resistance of the magnetoresistive effect element 408 changes in proportion to (1-cosξ), the output of the magnetic sensor 406 is expected to be a sinusoidal signal. The same applies to the magnetoresistive effect element 414, and the arithmetic circuit 429 is provided with a pair of sine wave input signals IN1 and IN2 whose phases are different by 90 degrees. Since the multipolar magnet 403 has 12 poles (six sets) of magnetic poles in the circumferential direction, one cycle of a sinusoidal signal is obtained at IN1 and IN2 each time the rotating shaft 402 rotates 60 degrees. On the other hand, similarly, the multipolar magnet 404 has 10 poles (5 sets) of magnetic poles in the circumferential direction, so that one cycle of a sinusoidal signal is obtained at IN3 and IN4 every time the rotating shaft 402 rotates 72 degrees. FIG. 16 illustrates the input signal IN1 and the input signal IN2. Here, the input shaft corresponds to the rotation angle (output value Y) of the rotating shaft 402, the output shaft is assumed to be the output voltage (IN1) of the magnetoresistive effect element 408, and the magnetoresistive effect element 414 is assumed. This corresponds to the output voltage (IN2). Here, the reference position where the output value Y becomes 0 is set to a point where IN1 / IN2 = −1 and IN1 <0. For IN1 and IN2, measured signals may be used, but ideal signals are used here. The procedure for defining a straight line is exactly the same even when an actually measured signal is used. The function F preferably includes an operation of dividing an input signal having a smaller absolute value with the intermediate value of the input signal being 0 among the input signals IN1 and IN2 by an input signal having a larger absolute value. Further, the input value X and the output value Y are made to correspond one-to-one. In order to satisfy this condition, the function F (IN1, IN2) is defined as follows. Note that F (IN1, IN2) includes an operation for setting the intermediate value of the input signal IN1 and the input signal IN2 to zero. (Step 111). In this embodiment, for the sake of explanation, the difference between the maximum value and the minimum value of the input signal IN1 and the input signal IN2 will be described as the same value. By making the difference between the maximum value and the minimum value of the input signal IN1 and the input signal IN2 the same value, the relationship between the input value X and the output value Y closer to a straight line is obtained. Here, C is the number of cycles, and is a value representing the number of times the input signal IN1 or the input signal IN2 is repeated from the reference position (in this case, the output value Y = 0). Since the wavy signal is repeated six times, 1 ≦ C ≦ 6 is satisfied.
F (IN1, IN2) = 1 + IN1 / IN2 + 8 × (C−1) (11)
(However, | IN2 | ≧ | IN1 | and IN2 ≧ 0)
F (IN1, IN2) = 3−IN2 / IN1 + 8 × (C−1) (12)
(However, | IN1 |> | IN2 | and IN1 ≧ 0)
F (IN1, IN2) = 5 + IN1 / IN2 + 8 × (C−1) (13)
(However, | IN2 | ≧ | IN1 | and IN2 <0)
F (IN1, IN2) = 7−IN2 / IN1 + 8 × (C−1) (14)
(However, | IN1 |> | IN2 | and IN1 <0)
FIG. 17 shows a calculation result by the function F. Here, the input shaft corresponds to the rotation angle (output value Y) of the rotation shaft 402, and the output shaft corresponds to F (IN1, IN2), that is, the input value X. Thus, it is preferable to define the function F so that the output value Y is continuously given with respect to the input value X, but the function F is not limited to that. In this embodiment, since it is necessary to obtain the output value Y from the input value X, the input axis indicating the rotation angle (output value Y) and the output axis indicating the input value X in FIG. There is a need. That is, it is necessary to use the input value X as an input shaft and the rotation angle (output value Y) as an output shaft. FIG. 18 is a diagram showing the input value X on the horizontal axis and the output value Y (rotation angle of the rotary shaft 402) on the vertical axis. Here, it is not necessary to divide the straight line, and the same Z (X) is defined for the entire range. (Step 112). Considering the straight line Z (X) connecting the minimum and maximum values of Y,
Z (X) = 7.5 × X (15)
(However, 0 ≦ X <48)
(Step 113). Thus, since Z (X) is defined by one linear function, the amount of memory for storing the linear function is reduced, and the arithmetic processing described later is facilitated. In this embodiment, step 113 is performed by analytical calculation. However, the present invention is not limited to this, and may be performed by the calculation circuit 429 based on actually measured data, or a dedicated calculation prepared outside. It may be performed using an apparatus, or may be defined using any other means. For example, as will be described later, a lookup table is created on the basis of the input signal IN1 (i) and the input signal IN2 (i), but the input signal IN1 (i) and the input signal IN2 (i) are diverted to the arithmetic circuit. A method in which a straight line is defined by a least-squares method using a dedicated arithmetic device 429 or an external device is conceivable. Thus, the definition of the straight line (step 101) is completed.

次に、図3に従いルックアップテーブル作成(ステップ102)の手順について説明する。まず、ADR(i)とX(i)の対応関係を定義する(ステップ121)。ADR(i)=G(X(i))で表わされる関数Gを定義すればよい。本実施例では、ルックアップテーブルの要素数は1008とする。入力値Xの最大値は、関数Fの定義より48となる。特に精度を向上させたい部分がなければ単純に定数倍してアドレスを割り振ればよく、1008/48=21を用いて、
G(X(i))=21×X(i) (16)
(但し、0≦X<48)
とすればよい。続いて、入力信号IN1(i)、入力信号IN2(i)より入力値X(i)を求める(ステップ122)。入力信号IN1(i)は磁気センサ406から得られた信号をA/D変換器410を通して取り込まれたものであり、入力信号IN2(i)は磁気センサ412より得られた信号をA/D変換器416を通して取り込まれたものである。入力信号IN1(i)、入力信号IN2(i)は、理想的な信号を用いても差し支えないし、実測の信号を用いてもよい。一般的には、実測の信号を用いた方が、精度が向上する。ここでは、実測の信号を用いてテーブルを作成する。入力信号IN1(i)、入力信号IN2(i)の実測値を図19に示す。ここで、入力軸は回転軸402の回転角度(出力値Y(i))に相当し、出力軸は磁気抵抗効果素子408の出力電圧(IN1(i))、および、磁気抵抗効果素子414の出力電圧(IN2(i))に相当する。入力値X(i)は、ステップ111にて定義した関数Fを用いて、X(i)=F(IN1(i)、IN2(i))より求めればよい。この演算結果は図20となる。ここで、入力軸は回転軸402の回転角度(出力値Y(i))に相当し、出力軸はF(IN1,IN2)、すなわち、入力値X(i)に相当する。ここで、図19に示されているプロットP1、プロットP2(Y(i)=149.443、IN1(i)=0.759、IN2(i)=−0.666、C=3)について演算を行うと、|IN1(i)|>|IN2(i)|かつIN1(i)≧0の条件を満たすので、式(12)を用いて、F(IN1(i)、IN2(i))=3−IN2(i)/IN1(i)+8×(C−1)となる。値を代入して計算すると、X(i)=19.877となり、図20に示すプロットQ1となる。図19にあるすべてのプロットに対して同様の演算を行った結果が図20である。入力値X(i)を入力軸とし、回転角度(出力値Y(i))を出力軸とするとルックアップテーブルの作成が容易であるため、図21に入力軸に入力値X(i)、出力軸に出力値Y(i)(回転軸402の回転角度)を示した図を示す。プロットQ1について、入力値X(i)と出力値Y(i)を入れ替えると、プロットR1(X(i)=19.877、Y(i)=149.443)となる。最後に、X(i)に対応付けられるADR(i)を有するa[ADR(i)]に Z(X(i))とY(i)との差 を格納し、記憶部に記憶する(ステップ123)。プロットR1に対する演算を用いて説明を行う。関数Gを用いて、ADR(i)=G(X(i))を計算する。21×X(i)となり、アドレスADR(i)は417.417となる。また、式(15)に示される関数Zを用いて、Z(X(i))=7.5×X(i)となり、Z(X(i))=149.078である。Z(X(i))とY(i)との差をもとめると、Y(i)−Z(X(i))=0.365となる。つまり、配列要素a[417.417]に0.365を格納すればよい。これをプロットS1とする。この操作を図21にあるプロットすべてに対して行った結果が図22である。ここで、入力軸はアドレスADR(i)に相当し、出力軸は配列要素a[ADR(i)]に相当する。ところが、上記のような計算を行うと、例えば、配列要素a[417.417]に0.365が格納されることになるが、a[ADR(i)]は配列要素であるため、アドレスADR(i)が整数でなければ実際には格納できない。最も簡単な方法では、417.417の小数点未満を切り捨て、あるいは切り上げ、あるいは四捨五入し、そのアドレスに0.365を格納すればよい。ただし、この方法では、明らかに誤差が大きくなる。そこで、本実施例では、直線補間を行うことによりルックアップテーブルを作成する。直線補間の方法については図23を用いて説明する。図23は、図22のプロットS1付近を拡大したものである。入力軸および出力軸は図22と同様である。図23に示されているプロットT1(416.088、0.489)およびプロットT2(418.767、0.235)は、プロットS1と同様にして求められたプロットである。このプロットT1,プロットT2とプロットS1を用いてa[417]およびa[418]に格納する値を決定する。具体的には、プロットT1およびプロットS1を通る直線を求め、ADR(i)=417と交わる点を求めると、プロットU1(417、0.406)となる。これにより、a[417]=0.406とすればよいことが分かる。同様に、プロットT2およびプロットS1を通る直線がADR(i)=418と交わる点を求めると、プロットU2(418、0.311)が求められ、a[418]=0.311とすればよいことが分かる。すなわち、アドレスADRより値が小さいアドレスのうち、最もアドレスADRに近い値となるアドレスを有する配列要素a[ADR(i)]と、アドレスADRより値が大きいアドレスのうち、最もアドレスADRに近い値となるアドレスを有する配列要素a[ADR(i)]とを結んだ直線が、アドレスADRを示す直線と交わる点を求め、アドレスADRを有する配列要素a[ADR(i)]であるとすればよい。すべてのa[ADR(i)](0≦ADR(i)≦1007)に対してこのように求めることにより、ルックアップテーブルが作成される。
Next, the procedure for creating the lookup table (step 102) will be described with reference to FIG. First, a correspondence relationship between ADR (i) and X (i) is defined (step 121). A function G represented by ADR (i) = G (X (i)) may be defined. In this embodiment, the number of elements in the lookup table is 1008. The maximum value of the input value X is 48 according to the definition of the function F. In particular, if there is no part that wants to improve the accuracy, the address may be assigned by simply multiplying by a constant, using 1008/48 = 21,
G (X (i)) = 21 × X (i) (16)
(However, 0 ≦ X <48)
And it is sufficient. Subsequently, an input value X (i) is obtained from the input signal IN1 (i) and the input signal IN2 (i) (step 122). The input signal IN1 (i) is obtained by taking the signal obtained from the magnetic sensor 406 through the A / D converter 410, and the input signal IN2 (i) is obtained by A / D converting the signal obtained from the magnetic sensor 412. It is taken in through the vessel 416. As the input signal IN1 (i) and the input signal IN2 (i), ideal signals may be used, or measured signals may be used. In general, the accuracy is improved by using actually measured signals. Here, a table is created using the actually measured signals. FIG. 19 shows measured values of the input signal IN1 (i) and the input signal IN2 (i). Here, the input shaft corresponds to the rotation angle (output value Y (i)) of the rotating shaft 402, the output shaft represents the output voltage (IN1 (i)) of the magnetoresistive effect element 408, and the magnetoresistive effect element 414. This corresponds to the output voltage (IN2 (i)). The input value X (i) may be obtained from X (i) = F (IN1 (i), IN2 (i)) using the function F defined in step 111. The calculation result is shown in FIG. Here, the input shaft corresponds to the rotation angle (output value Y (i)) of the rotation shaft 402, and the output shaft corresponds to F (IN1, IN2), that is, the input value X (i). Here, calculation is performed for the plot P1 and the plot P2 (Y (i) = 149.443, IN1 (i) = 0.759, IN2 (i) = − 0.666, C = 3) shown in FIG. Since the condition of | IN1 (i) |> | IN2 (i) | and IN1 (i) ≧ 0 is satisfied, F (IN1 (i), IN2 (i)) is obtained using equation (12). = 3-IN2 (i) / IN1 (i) + 8 * (C-1). When calculation is performed by substituting values, X (i) = 19.877 is obtained, and a plot Q1 shown in FIG. 20 is obtained. FIG. 20 shows the result of the same calculation performed on all plots in FIG. When the input value X (i) is the input axis and the rotation angle (output value Y (i)) is the output axis, it is easy to create a look-up table, so FIG. 21 shows the input value X (i), The figure which showed output value Y (i) (rotation angle of the rotating shaft 402) on the output shaft is shown. When the input value X (i) and the output value Y (i) are exchanged for the plot Q1, the plot R1 (X (i) = 19.877, Y (i) = 149.443) is obtained. Finally, the difference between Z (X (i)) and Y (i) is stored in a [ADR (i)] having ADR (i) associated with X (i) and stored in the storage unit ( Step 123). The description will be made using an operation on the plot R1. The function G is used to calculate ADR (i) = G (X (i)). 21 × X (i), and the address ADR (i) is 417.417. Further, using the function Z shown in Expression (15), Z (X (i)) = 7.5 × X (i), and Z (X (i)) = 149.078. When the difference between Z (X (i)) and Y (i) is obtained, Y (i) −Z (X (i)) = 0.365. That is, 0.365 may be stored in the array element a [417.417]. This is set as plot S1. FIG. 22 shows the result of this operation performed on all the plots in FIG. Here, the input axis corresponds to the address ADR (i), and the output axis corresponds to the array element a [ADR (i)]. However, when the above calculation is performed, for example, 0.365 is stored in the array element a [417.417], but since a [ADR (i)] is an array element, the address ADR If (i) is not an integer, it cannot be actually stored. In the simplest method, a value less than the decimal point of 417.417 may be rounded down, rounded up, or rounded, and 0.365 may be stored at the address. However, this method clearly increases the error. Therefore, in this embodiment, a lookup table is created by performing linear interpolation. A method of linear interpolation will be described with reference to FIG. FIG. 23 is an enlarged view of the vicinity of the plot S1 in FIG. The input shaft and the output shaft are the same as those in FIG. A plot T1 (416.088, 0.489) and a plot T2 (418.767, 0.235) shown in FIG. 23 are plots obtained in the same manner as the plot S1. Using this plot T1, plot T2 and plot S1, values to be stored in a [417] and a [418] are determined. Specifically, when a straight line passing through the plot T1 and the plot S1 is obtained, and a point that intersects with ADR (i) = 417 is obtained, a plot U1 (417, 0.406) is obtained. Thus, it can be seen that a [417] = 0.406. Similarly, when a point where a straight line passing through the plot T2 and the plot S1 intersects with ADR (i) = 418 is obtained, a plot U2 (418, 0.311) is obtained, and a [418] = 0.111 may be set. I understand that. That is, among the addresses having a value smaller than the address ADR, the array element a [ADR (i)] having an address closest to the address ADR and the value closest to the address ADR among addresses larger than the address ADR. If the straight line connecting the array element a [ADR (i)] having the address becomes an intersection with the straight line indicating the address ADR, the array element a [ADR (i)] having the address ADR is assumed. Good. By obtaining in this way for all a [ADR (i)] (0 ≦ ADR (i) ≦ 1007), a lookup table is created.

入力値Xに対応する角度を直接ルックアップテーブルに格納した場合、0〜360degをテーブルに格納する必要がある。一方、本実施例では、図22より、ルックアップテーブルに格納される値は−0.8〜+0.8degの範囲となり、ルックアップテーブル1要素につき、log2(360/1.6)=7.8bit削減することが可能となる。例えば、0.01deg分解能でルックアップテーブルを作成したい場合、角度を直接格納する方式では、格納される値は0〜36000となり、16bitの領域(0〜65535)が必要である。一方、本実施例では、−80〜80を格納すればよく、8bitの領域(−128〜127)があれば十分である。本実施例では、ルックアップテーブルの要素数は1008となっているので、ルックアップテーブル作成に必要なメモリ量は、直接角度を格納するタイプでは、16×1008=16128bitとなり、約2Kバイトである。一方、本実施例では、8×1008bitとなるので、約1Kバイトのメモリで同等の効果を得ることが可能となる。削減されるメモリの割合は、ルックアップテーブルに求められる分解能により異なり、例えば、0.1degの分解能であればメモリは3分の1に削減される。なお、本実施例では、入力信号IN1、入力信号IN2は、回転軸402が一回転する間に6周期の信号を出力する。そのため、図22に示したルックアップテーブルにおいても、アドレス168毎によく似た信号が繰り返されている(実測の値より求めているため厳密に同一ではない)。そこで、求められる精度が、例えば、0.1deg程度であれば、アドレス0〜167を記憶しておき、それ以降のアドレスが指定された場合は、アドレス0〜167の繰り返しであるとして演算を行うと、ルックアップテーブルに使用するメモリをさらに削減することが可能である。その場合は、
ADR=21×X/6 (17)
(但し、0≦X<48)
と定義すればよい。なお、本実施例では、ステップ102は、演算回路429により行っているが、外部に用意された専用の演算装置等を用いて行うことが考えられ、演算が可能であれば、その他どのような手段で行ってもよい。
When the angle corresponding to the input value X is directly stored in the lookup table, it is necessary to store 0 to 360 deg in the table. On the other hand, in this embodiment, as shown in FIG. 22, the value stored in the lookup table is in the range of −0.8 to +0.8 deg, and log 2 (360 / 1.6) = 7. It is possible to reduce 8 bits. For example, when it is desired to create a lookup table with a resolution of 0.01 deg, in the method of directly storing the angle, the stored value is 0 to 36000, and a 16-bit area (0 to 65535) is required. On the other hand, in this embodiment, it is only necessary to store −80 to 80, and it is sufficient if there is an 8-bit area (−128 to 127). In this embodiment, since the number of elements of the lookup table is 1008, the memory amount necessary for creating the lookup table is 16 × 1008 = 16128 bits in the type that directly stores the angle, which is about 2 Kbytes. . On the other hand, in this embodiment, since it is 8 × 1008 bits, it is possible to obtain the same effect with a memory of about 1 Kbyte. The memory ratio to be reduced depends on the resolution required for the lookup table. For example, if the resolution is 0.1 deg, the memory is reduced to one third. In this embodiment, the input signal IN1 and the input signal IN2 output signals of 6 cycles while the rotating shaft 402 makes one rotation. Therefore, in the look-up table shown in FIG. 22, a signal that is very similar is repeated for each address 168 (it is not exactly the same because it is obtained from a measured value). Therefore, for example, if the required accuracy is about 0.1 deg, addresses 0 to 167 are stored, and if an address after that is specified, the calculation is performed assuming that addresses 0 to 167 are repeated. Thus, the memory used for the lookup table can be further reduced. In that case,
ADR = 21 × X / 6 (17)
(However, 0 ≦ X <48)
Should be defined. In this embodiment, the step 102 is performed by the arithmetic circuit 429. However, it is conceivable that the step 102 is performed by using a dedicated arithmetic device or the like prepared externally. It may be performed by means.

次に、図4に従い演算装置による出力演算(ステップ103)について説明する。まず、A/D変換器410より入力信号IN1を、A/D変換器416より入力信号IN2を取り込み、取り込んだ値より入力値Xを求める(ステップ131)。入力値Xを求める関数Fには、周期数Cが含まれる。前述のように、周期数とは、基準位置(この場合は出力値Y=0とした)から入力信号IN1、または、入力信号IN2が繰り返された回数を表す値である。周期数Cについては、入力信号IN1、入力信号IN2の変化から増減を検出でき、本実施例の場合は、前述のように、出力値Yが0となる基準位置を、IN1/IN2=−1、かつ、IN1<0となる点としているので、図19を見れば分かるように、周期数Cは、IN1/IN2=−1、かつ、IN1<0となる点で切り替わることとなり、現在の周期数を記憶しておき、切り替え点に達する毎に加算または減算していけば周期数を正しく検出することが可能である。ただし、電源切断後に回転軸402が回転した場合には周期数Cが正しく検出できない。そのため、電源切断後に回転軸402が回転する可能性がある場合は、電源投入時に周期数Cを検出する必要がある。電源投入時の周期数Cの求め方については後述する。周期数Cが分かれば、関数Fを用いて、X=F(IN1、IN2)により入力値Xを求めることができる。例として、図19に示した実測波形におけるプロットP1、プロットP2の値を用いて説明する。IN1=0.759、IN2=−0.666、S=3であり、関数Fに従って計算すると、X=19.877となる。次に、入力値Xより参照するアドレスADRを求める(ステップ132)。関数Gを用いて、ADR=G(X)により求めればよく、ADR=417.417となる。 Next, the output calculation (step 103) by the calculation device will be described with reference to FIG. First, the input signal IN1 is acquired from the A / D converter 410 and the input signal IN2 is acquired from the A / D converter 416, and the input value X is obtained from the acquired value (step 131). The function F for obtaining the input value X includes the number of periods C. As described above, the number of cycles is a value representing the number of times the input signal IN1 or the input signal IN2 is repeated from the reference position (in this case, the output value Y = 0). As for the number of cycles C, increase / decrease can be detected from changes in the input signal IN1 and the input signal IN2. In this embodiment, as described above, the reference position where the output value Y becomes 0 is defined as IN1 / IN2 = −1. In addition, since it is assumed that IN1 <0, as can be seen from FIG. 19, the cycle number C is switched at a point where IN1 / IN2 = −1 and IN1 <0, and the current cycle. If the number is stored and added or subtracted every time the switching point is reached, the number of cycles can be detected correctly. However, the period number C cannot be detected correctly when the rotating shaft 402 rotates after the power is turned off. Therefore, when there is a possibility that the rotating shaft 402 may rotate after the power is turned off, it is necessary to detect the cycle number C when the power is turned on. A method for obtaining the number of cycles C when the power is turned on will be described later. If the number of periods C is known, the input value X can be obtained using the function F by X = F (IN1, IN2). As an example, description will be made using the values of plots P1 and P2 in the actually measured waveform shown in FIG. IN1 = 0.759, IN2 = −0.666, S = 3, and calculation according to function F yields X = 19.877. Next, an address ADR to be referred to is obtained from the input value X (step 132). What is necessary is just to obtain | require by ADR = G (X) using the function G, and becomes ADR = 417.417.

続いて、予想される出力値Z(X)の演算を行う(ステップ133)。関数Zを用いて演算を行うと、Z(X)= 7.5×Xであるから、Z(X)= 7.5×19.877=149.078となる。 Subsequently, an expected output value Z (X) is calculated (step 133). When the calculation is performed using the function Z, since Z (X) = 7.5 × X, Z (X) = 7.5 × 19.877 = 149.078.

最後に、ルックアップテーブルを記憶部より読み出し、アドレスADRを有する配列要素a[ADR(i)]を参照して、予想される出力値Z(X) を補正して出力する(ステップ134)。ここで、a[417.417]を参照する必要があるが、前述のように、ルックアップテーブルはアドレスが整数でなければ存在しない。ルックアップテーブル作成時と同様、最も簡単な方法では、417.417の小数点未満を切り捨て、あるいは切り上げ、あるいは四捨五入したアドレスを参照することである。ただし、この方法では、明らかに誤差が大きくなる。そこで、本実施例では、直線補間を行い、ルックアップテーブルを参照する。直線補間は図24のように行われる。図24はルックアップテーブルの一部を拡大して示しており、入力軸・出力軸は図22と同様である。参照するアドレスが整数でない場合は、その前後のテーブル値を直線で結び、所望のアドレスと重なる点を参照する。ここで、a[ADR(i)]は配列要素であり、要素数は有限である。従って、アドレスADRを有する配列要素a[ADR(i)]が存在しない場合がある。そのような場合は、アドレスADRを有する配列要素a[ADR(i)]が存在するアドレスADRのうち、アドレスADRより値が小さいアドレスのうち、最もアドレスADRに近い値となるアドレスを有する配列要素a[ADR(i)]と、アドレスADRより値が大きいアドレスのうち、最もアドレスADRに近い値となるアドレスを有する配列要素a[ADR(i)]とを結んだ直線が、アドレスADRを示す直線と交わる点を求め、アドレスADRを有する配列要素a[ADR(i)]であるとすればよい。例えば、アドレス417.417を参照したいならば、小数点以下を切り捨てたアドレス417(テーブル値0.406)と小数点以下を切り上げたアドレス418(テーブル値0.311)を直線で結び、アドレス417.417と重なる点(プロットV1)を参照すればよい。プロットV1のテーブル値に相当する値は0.366となる。出力値Yは、Y=Z(X)+a[ADR]で与えられ、この場合はY=149.078+0.366=149.444[deg]が得られる。 Finally, the lookup table is read from the storage unit, and the expected output value Z (X) is corrected and output with reference to the array element a [ADR (i)] having the address ADR (step 134). Here, it is necessary to refer to a [417.417], but as described above, the lookup table does not exist unless the address is an integer. As with the look-up table creation, the simplest method is to refer to an address that is rounded down, rounded up, or rounded to the nearest 417.417. However, this method clearly increases the error. Therefore, in this embodiment, linear interpolation is performed and a lookup table is referred to. Linear interpolation is performed as shown in FIG. FIG. 24 is an enlarged view of a part of the lookup table, and the input shaft and output shaft are the same as those in FIG. If the address to be referred to is not an integer, the table values before and after it are connected with a straight line, and the point overlapping the desired address is referenced. Here, a [ADR (i)] is an array element, and the number of elements is finite. Therefore, the array element a [ADR (i)] having the address ADR may not exist. In such a case, among the addresses ADR having the array element a [ADR (i)] having the address ADR, the array element having the address closest to the address ADR among the addresses having a value smaller than the address ADR. A straight line connecting a [ADR (i)] and an array element a [ADR (i)] having an address closest to the address ADR among addresses having a value larger than the address ADR indicates the address ADR. A point that intersects with the straight line is obtained, and the array element a [ADR (i)] having the address ADR may be used. For example, if it is desired to refer to the address 417.417, the address 417 (table value 0.406) rounded down after the decimal point and the address 418 (table value 0.311) rounded up after the decimal point are connected by a straight line, and the address 417.417 is obtained. The point that overlaps (plot V1) may be referred to. The value corresponding to the table value of the plot V1 is 0.366. The output value Y is given by Y = Z (X) + a [ADR]. In this case, Y = 149.078 + 0.366 = 149.444 [deg] is obtained.

ここからは、電源投入時の周期数Cの求め方について説明する。まず、入力信号IN1、入力信号IN2より、電気角位相を求める。この電気角位相をANG1とする。電気角位相は、例えば、arctan関数を用いて求めることが可能である。arctan関数は演算回路429に負荷がかかるが、前述のように電源投入時のみ行う動作であれば問題とならない。リング磁石403が12極(6組)の磁極を有することから、ANG1は、回転軸402の回転角の増加に伴い単調に増加し、60deg周期で繰り返す信号となる。同様にして、入力信号IN3、入力信号IN4からも電気角位相を求める。この電気角位相をANG2とする。リング磁石404が10極(5組)の磁極を有することから、ANG2は、回転軸402の回転角の増加に伴い単調に増加し、72deg周期で繰り返す信号となる。電気角位相差ΔANGを以下のように定義すると、電気角位相差ΔANGより周期数Cを求めることが可能となる。ここで、入力信号IN1、入力信号IN2から得られる第1の電気角位相と、入力信号IN3、入力信号IN4から得られる第2の電気角位相とは、異なる電気角位相である必要があり、それぞれの周期数は互いに素の関係を有する、または、整数倍の関係にならないことが好ましい。周期数が整数倍であると、以下の周期数を求める演算Cにおいて、周期数が決定できないからである。
ΔANG=ANG1−ANG2 (18)
(但し、ANG1≧ANG2)
ΔANG=360+ANG1−ANG2 (19)
(但し、ANG1<ANG2)
入力軸を回転軸402の回転角として、出力軸にANG1、ANG2、ΔANGを示すと、図25となる。ここで、回転軸402の回転角と電気角位相差ΔANGは一対一に対応するので、(電気角)周期数Cを求めることが可能となる。本実施例では、周期数Cは、1≦S≦6で、60deg毎に切り替わるので、C=ΔANG/6+1として小数点以下を切り捨てれば周期数を求めることができる。ここではANG1、ANG2がともに0となる点をC=1の基準位置としているが、基準位置はどこにとってもよい。つまり、電気角位相差ΔANGを第1の電気角位相差とした場合の基準位置を基準とした第1の電気角位相差である第2の電気角位相差に基づいて、周期数を求めている。すでに述べたように、電源投入時のみ、このように周期数Cを演算により求め、通常動作中は入力信号の変化から周期数Cを求めてもよいし、常に周期数Cを演算により求めてもよい。ただし、常に演算により周期数Cを求める場合、arctan演算を行うと演算回路429にかかる負荷が大きくなってしまうので注意が必要である。また、電源切断後に回転軸402が動かないことが分かっているのであれば、このような演算は省略可能で、入力信号変化のみから周期数Cを求めることができる。すなわち、入力信号IN3、入力信号IN4を求めるための構成は省略可能となる。
(実施例3)
From here, how to obtain the number of cycles C when the power is turned on will be described. First, an electrical angle phase is obtained from the input signal IN1 and the input signal IN2. This electrical angle phase is ANG1. The electrical angle phase can be obtained using, for example, an arctan function. Although the arctan function places a load on the arithmetic circuit 429, it is not a problem as long as it is an operation performed only when the power is turned on as described above. Since the ring magnet 403 has 12 poles (six sets) of magnetic poles, ANG1 increases monotonously with an increase in the rotation angle of the rotating shaft 402 and becomes a signal that repeats with a period of 60 degrees. Similarly, the electrical angle phase is obtained from the input signal IN3 and the input signal IN4. This electrical angle phase is ANG2. Since the ring magnet 404 has 10 poles (5 sets) of magnetic poles, ANG2 increases monotonously with an increase in the rotation angle of the rotating shaft 402 and becomes a signal that repeats at a period of 72 degrees. If the electrical angle phase difference ΔANG is defined as follows, the cycle number C can be obtained from the electrical angle phase difference ΔANG. Here, the first electrical angle phase obtained from the input signal IN1 and the input signal IN2 and the second electrical angle phase obtained from the input signal IN3 and the input signal IN4 need to be different electrical angle phases. It is preferable that the numbers of periods have a prime relationship with each other or do not have an integer multiple relationship. This is because if the number of periods is an integer multiple, the number of periods cannot be determined in the following calculation C for obtaining the number of periods.
ΔANG = ANG1-ANG2 (18)
(However, ANG1 ≧ ANG2)
ΔANG = 360 + ANG1-ANG2 (19)
(However, ANG1 <ANG2)
FIG. 25 shows ANG1, ANG2, and ΔANG on the output shaft with the input shaft as the rotation angle of the rotation shaft 402. Here, since the rotation angle of the rotating shaft 402 and the electrical angle phase difference ΔANG correspond one-to-one, the (electrical angle) period number C can be obtained. In the present embodiment, the cycle number C is 1 ≦ S ≦ 6 and is switched every 60 deg. Therefore, the cycle number can be obtained by rounding off the decimal part as C = ΔANG / 6 + 1. Here, the point where ANG1 and ANG2 are both 0 is set as the reference position of C = 1, but the reference position may be anywhere. That is, the number of cycles is obtained based on the second electrical angle phase difference that is the first electrical angle phase difference with respect to the reference position when the electrical angle phase difference ΔANG is the first electrical angle phase difference. Yes. As already described, the period number C may be obtained by calculation in this way only when the power is turned on, and the period number C may be obtained from the change of the input signal during normal operation, or the period number C is always obtained by calculation. Also good. However, when the number of cycles C is always obtained by calculation, care should be taken because the load applied to the calculation circuit 429 increases if arctan calculation is performed. Further, if it is known that the rotating shaft 402 does not move after the power is turned off, such calculation can be omitted, and the number of cycles C can be obtained from only the change in the input signal. That is, the configuration for obtaining the input signal IN3 and the input signal IN4 can be omitted.
(Example 3)

次に、図26を参照しながら本実施例に関わる角度センサ601の構成について説明する。角度センサ601は、回転軸602の所定の基準位置からの多回転回転角(0deg〜1080deg)を検出するための角度検出装置である。回転軸602として、例えば、ステアリングシャフトを挙げることができるが、これに限定されるものではない。角度センサ601は、回転軸602の軸芯回りの回転に連動して回転し、その外周に30歯を有する歯車603と、回転軸604の軸芯回りの回転に連動して回転し、その外周に15歯を有し、歯車603と噛合する歯車605と、回転軸604の軸芯回りの回転に連動して回転する磁石606と、回転軸607の軸芯回りの回転に連動して回転し、その外周に18歯を有し、歯車603と噛合する歯車608と、回転軸607の軸芯回りの回転に連動して回転する磁石609と、回転軸604の軸の周辺部に、回転軸604の軸とは独立に固定され、回転軸604の回転角の情報を担う検出信号(入力信号IN1)を出力する磁気センサ611と、磁気センサ611から出力される検出信号を増幅する増幅器(AMP)614と、増幅器614によって増幅されたアナログ信号としての検出信号をデジタル信号に変換するA/D変換器615と、回転軸604の軸の周辺部に、回転軸604の軸とは独立に固定され、回転軸604の回転角の情報を担う検出信号(入力信号IN2)を出力する磁気センサ617と、磁気センサ617から出力される検出信号を増幅する増幅器(AMP)620と、増幅器620によって増幅されたアナログ信号としての検出信号をデジタル信号に変換するA/D変換器621と、回転軸607の軸の周辺部に、回転軸607の軸とは独立に固定され、回転軸607の回転角の情報を担う検出信号(入力信号IN3)を出力する磁気センサ623と、磁気センサ623から出力される検出信号を増幅する増幅器(AMP)626と、増幅器626によって増幅されたアナログ信号としての検出信号をデジタル信号に変換するA/D変換器627と、回転軸607の軸の周辺部に、回転軸607の軸とは独立に固定され、回転軸607の回転角の情報を担う検出信号(入力信号IN4)を出力する磁気センサ629と、磁気センサ629から出力される検出信号を増幅する増幅器(AMP)632と、増幅器632によって増幅されたアナログ信号としての検出信号をデジタル信号に変換するA/D変換器633と、記憶部に記憶されているルックアップテーブル(LUT)635と、ルックアップテーブル635を参照して、A/D変換器615、および、A/D変換器621、および、A/D変換器627、および、A/D変換器633からの出力信号の組み合わせから回転軸602の回転角を求める演算回路(MPU)634とを備える。磁気センサ611から出力される入力信号IN1、および、磁気センサ617から出力される入力信号IN2は、その電気角の位相差が90degである信号となっているが、これは、磁気センサ611、および、磁気センサ617を磁界に対して空間的に異なった位置に配置してもよいし、空間的には同じ位置であるが、検出される磁界の方向が異なるように配置してもよいし、その他、所望の位相差が得られればどのような方法であってもよい。例えば、磁気センサ611と磁気センサ617がGMR素子を用いた磁気センサであり、磁石606と対向する位置に、磁気センサ611と磁気センサ617を磁化固定層が90deg異なるように並べるような配置が考えられる。同様に、磁気センサ623から出力される入力信号IN3、および、磁気センサ629から出力される入力信号IN4は、その電気角の位相差が90degである信号となっているが、磁気センサ623、および、磁気センサ629を磁界に対して空間的に異なった位置に配置してもよいし、空間的には同じ位置で、検出される磁界の方向が異なるように配置してもよいし、その他、所望の位相差が得られればどのような方法であってもよい。例えば、磁気センサ623と磁気センサ629がGMR素子を用いた磁気センサであり、磁石609と対向する位置に、磁気センサ623と磁気センサ629を磁化固定層が90deg異なるように並べるような配置が考えられる。演算回路634は、例えば、汎用のマイクロコンピュータでもよく或いは専用の信号処理LSIでもよい。磁石606および磁石609は、回転部材であり、その平面形状(回転軸604または回転軸607に垂直な平面で切断した断面形状)は、例えば、長方形や、円形が好適であるが、特定の形状に限定されるものではなく、角度検出に適した形状であればよい。歯車603は、回転軸602に固定されてもよく、或いはセレーション結合されてもよい。歯車605および磁石606は、回転軸604に固定されてもよく、或いはセレーション結合されてもよい。歯車608および磁石609は、回転軸607に固定されてもよく、或いはセレーション結合されてもよい。回転軸602の軸芯方向をZ方向とすると、回転軸602の回転に伴い、歯車603はXY平面内で回転し、回転軸604の軸芯方向をZ方向とすると、回転軸604の回転に伴い、歯車605および磁石606はXY平面内で回転し、回転軸607の軸芯方向をZ方向とすると、回転軸607の回転に伴い、歯車608および磁石609はXY平面内で回転する。 Next, the configuration of the angle sensor 601 according to the present embodiment will be described with reference to FIG. The angle sensor 601 is an angle detection device for detecting a multi-rotation rotation angle (0 deg to 1080 deg) from a predetermined reference position of the rotation shaft 602. An example of the rotating shaft 602 is a steering shaft, but is not limited thereto. The angle sensor 601 rotates in conjunction with the rotation of the rotating shaft 602 around the axis, and rotates in conjunction with the gear 603 having 30 teeth on the outer periphery thereof and the rotation of the rotating shaft 604 around the axis of the outer periphery thereof. The gear 605 that meshes with the gear 603, the magnet 606 that rotates in conjunction with the rotation of the rotating shaft 604, and the rotation of the rotating shaft 607 that rotates in conjunction with the rotation of the rotating shaft 607. , A gear 608 having 18 teeth on the outer periphery and meshing with the gear 603, a magnet 609 that rotates in conjunction with rotation around the axis of the rotating shaft 607, and a rotating shaft around the shaft of the rotating shaft 604. A magnetic sensor 611 that is fixed independently of the shaft 604 and outputs a detection signal (input signal IN1) that carries information on the rotation angle of the rotation shaft 604, and an amplifier (AMP) that amplifies the detection signal output from the magnetic sensor 611 614 and amplifier 6 The A / D converter 615 that converts the detection signal as an analog signal amplified by the digital signal 4 into a digital signal is fixed to the periphery of the axis of the rotating shaft 604 independently of the axis of the rotating shaft 604, and the rotating shaft 604 A magnetic sensor 617 that outputs a detection signal (input signal IN2) that carries information on the rotation angle of the sensor, an amplifier (AMP) 620 that amplifies the detection signal output from the magnetic sensor 617, and an analog signal amplified by the amplifier 620 A / D converter 621 that converts the detection signal into a digital signal and a detection that is fixed to the periphery of the axis of the rotary shaft 607 independently of the axis of the rotary shaft 607 and bears information on the rotation angle of the rotary shaft 607 A magnetic sensor 623 that outputs a signal (input signal IN3), an amplifier (AMP) 626 that amplifies a detection signal output from the magnetic sensor 623, and an amplifier 626; An A / D converter 627 that converts the detection signal as an amplified analog signal into a digital signal, and the periphery of the axis of the rotating shaft 607 are fixed independently of the axis of the rotating shaft 607, and the rotating shaft 607 A magnetic sensor 629 that outputs a detection signal (input signal IN4) that carries information on the rotation angle of the sensor, an amplifier (AMP) 632 that amplifies the detection signal output from the magnetic sensor 629, and an analog signal amplified by the amplifier 632 An A / D converter 633 that converts the detected signal into a digital signal, a lookup table (LUT) 635 stored in the storage unit, an A / D converter 615 with reference to the lookup table 635, and , The A / D converter 621, the A / D converter 627, and the output signal from the A / D converter 633, and the rotation of the rotary shaft 602. And an arithmetic circuit (MPU) 634 for obtaining a turning angle. The input signal IN1 output from the magnetic sensor 611 and the input signal IN2 output from the magnetic sensor 617 are signals having an electrical angle phase difference of 90 deg. The magnetic sensor 617 may be arranged at a spatially different position with respect to the magnetic field, or may be arranged at the same spatial position but different in the direction of the detected magnetic field, In addition, any method may be used as long as a desired phase difference can be obtained. For example, the magnetic sensor 611 and the magnetic sensor 617 are magnetic sensors using GMR elements, and an arrangement in which the magnetic sensor 611 and the magnetic sensor 617 are arranged at positions facing the magnet 606 so that the magnetization fixed layers are different by 90 degrees is considered. It is done. Similarly, the input signal IN3 output from the magnetic sensor 623 and the input signal IN4 output from the magnetic sensor 629 are signals having a phase difference of 90 degrees in the electrical angle. The magnetic sensor 629 may be arranged at a spatially different position with respect to the magnetic field, or may be arranged at the same spatial position so that the direction of the detected magnetic field is different. Any method may be used as long as a desired phase difference is obtained. For example, the magnetic sensor 623 and the magnetic sensor 629 are magnetic sensors using GMR elements, and an arrangement in which the magnetic sensor 623 and the magnetic sensor 629 are arranged at positions facing the magnet 609 so that the magnetization fixed layers are different by 90 degrees is considered. It is done. The arithmetic circuit 634 may be, for example, a general-purpose microcomputer or a dedicated signal processing LSI. The magnet 606 and the magnet 609 are rotating members, and the planar shape (cross-sectional shape cut by a plane perpendicular to the rotating shaft 604 or the rotating shaft 607) is preferably, for example, rectangular or circular, but has a specific shape. The shape is not limited to the above, and may be any shape suitable for angle detection. The gear 603 may be fixed to the rotating shaft 602 or may be serrated. The gear 605 and the magnet 606 may be fixed to the rotating shaft 604 or may be serrated. The gear 608 and the magnet 609 may be fixed to the rotating shaft 607 or may be serrated. If the axis direction of the rotary shaft 602 is the Z direction, the gear 603 rotates in the XY plane along with the rotation of the rotary shaft 602. If the axis direction of the rotary shaft 604 is the Z direction, the rotation shaft 604 is rotated. Accordingly, the gear 605 and the magnet 606 rotate in the XY plane. When the axial center direction of the rotating shaft 607 is the Z direction, the gear 608 and the magnet 609 rotate in the XY plane with the rotation of the rotating shaft 607.

磁気センサ611は、磁石606の回転に伴い周期的に変化する外部磁界610の変化を電圧変化として検出する磁気抵抗効果素子613と、磁気抵抗効果素子613にセンス電流を供給するプリント配線基板612とを備える。磁気センサ617は、磁石606の回転に伴い周期的に変化する外部磁界616の変化を電圧変化として検出する磁気抵抗効果素子619と、磁気抵抗効果素子619にセンス電流を供給するプリント配線基板618とを備える。磁気センサ623は、磁石609の回転に伴い周期的に変化する外部磁界622の変化を電圧変化として検出する磁気抵抗効果素子625と、磁気抵抗効果素子625にセンス電流を供給するプリント配線基板624とを備える。磁気センサ629は、磁石609の回転に伴い周期的に変化する外部磁界628の変化を電圧変化として検出する磁気抵抗効果素子631と、磁気抵抗効果素子631にセンス電流を供給するプリント配線基板630とを備える。磁気抵抗効果素子613および磁気抵抗効果素子619、磁気抵抗効果素子625、磁気抵抗効果素子631として、例えば、巨大磁気抵抗(GMR)型、トンネル磁気抵抗(TMR)型、弾道磁気抵抗(BMR)型、異方性磁気抵抗(AMR)型等の公知の磁気抵抗効果素子を用いることができる。なお、実施例1、2と同様、センス電流に変えて、センス電圧を供給してもよく、磁気抵抗効果素子613、および、磁気抵抗効果素子619、および、磁気抵抗効果素子625、および、磁気抵抗効果素子631の出力電圧変化を電流変化に変更してもよい。磁気抵抗効果素子613および磁気抵抗効果素子619、磁気抵抗効果素子625、磁気抵抗効果素子631の断面構造は、実施例1で示した磁気抵抗効果素子207と同じであるためここでは割愛する。 The magnetic sensor 611 includes a magnetoresistive effect element 613 that detects a change in the external magnetic field 610 that periodically changes as the magnet 606 rotates as a voltage change, and a printed wiring board 612 that supplies a sense current to the magnetoresistive effect element 613. Is provided. The magnetic sensor 617 includes a magnetoresistive effect element 619 that detects a change in the external magnetic field 616 that periodically changes as the magnet 606 rotates as a voltage change, and a printed wiring board 618 that supplies a sense current to the magnetoresistive effect element 619. Is provided. The magnetic sensor 623 includes a magnetoresistive effect element 625 that detects a change in the external magnetic field 622 that periodically changes as the magnet 609 rotates as a voltage change, and a printed wiring board 624 that supplies a sense current to the magnetoresistive effect element 625. Is provided. The magnetic sensor 629 includes a magnetoresistive effect element 631 that detects a change in the external magnetic field 628 that periodically changes as the magnet 609 rotates as a voltage change, and a printed wiring board 630 that supplies a sense current to the magnetoresistive effect element 631. Is provided. As the magnetoresistive effect element 613, the magnetoresistive effect element 619, the magnetoresistive effect element 625, and the magnetoresistive effect element 631, for example, a giant magnetoresistive (GMR) type, a tunnel magnetoresistive (TMR) type, a ballistic magnetoresistive (BMR) type A known magnetoresistive element such as an anisotropic magnetoresistive (AMR) type can be used. As in the first and second embodiments, a sense voltage may be supplied instead of the sense current, and the magnetoresistive element 613, the magnetoresistive element 619, the magnetoresistive element 625, and the magnetic The output voltage change of the resistive element 631 may be changed to a current change. Since the cross-sectional structures of the magnetoresistive effect element 613, the magnetoresistive effect element 619, the magnetoresistive effect element 625, and the magnetoresistive effect element 631 are the same as those of the magnetoresistive effect element 207 shown in the first embodiment, they are omitted here.

次に、図7を参照しながら演算手段について説明する。本実施例における演算手段は、図1に示すステップ101、102、103の手順に基づいて行う。ステップ102は図5に、ステップ103は図7に従う。ここでは、磁気センサ611の出力電圧を入力信号IN1、磁気センサ617の出力電圧を入力信号IN2とし、回転軸602の回転角を出力値Yとすればよい。 Next, the calculation means will be described with reference to FIG. The calculation means in this embodiment is performed based on the procedures of steps 101, 102, and 103 shown in FIG. Step 102 follows FIG. 5, and step 103 follows FIG. Here, the output voltage of the magnetic sensor 611 may be the input signal IN1, the output voltage of the magnetic sensor 617 may be the input signal IN2, and the rotation angle of the rotating shaft 602 may be the output value Y.

まず、図2に従い、直線の定義(ステップ101)について説明する。本実施例では、磁気抵抗効果素子613の抵抗が(1−cosξ)に比例して変化するため、磁気センサ611の出力は正弦波状の信号が予想される。磁気抵抗効果素子619も同様であり、演算回路634には、位相が90deg異なる正弦波状の1対の入力信号IN1、入力信号IN2が与えられる。磁石606が回転軸604のまわりを360deg回転する毎にIN1、IN2に正弦波状の信号1周期が得られる。歯車603の歯数が30歯、歯車605の歯数が15歯であることから、回転軸602が180deg回転する間に回転軸604は360deg回転する。すなわち、回転軸602が180deg回転する毎にIN1、IN2に正弦波状の信号1周期が得られる。一方、同様に、磁石609が回転軸607のまわりを360deg回転する毎にIN3、IN4に正弦波状の信号1周期が得られる。歯車603の歯数が30歯、歯車608の歯数が18歯であることから、回転軸602が216deg回転する間に回転軸607は360deg回転する。すなわち、回転軸602が216deg回転する毎にIN3、IN4に正弦波状の信号1周期が得られる。図27に入力信号IN1、入力信号IN2を図示する。ここで、入力軸は回転軸602の多回転を含む回転角度(出力値Y)に相当し、出力軸は磁気抵抗効果素子613の想定される出力電圧(IN1)、および、磁気抵抗効果素子619の想定される出力電圧(IN2)に相当する。IN1、IN2は実測の信号を用いてもよいが、ここでは理想的な信号を用いている。実測の信号を用いても直線定義の手順は全く同じである。関数Fには、入力信号IN1、入力信号IN2のうち入力信号の中間値を0とした絶対値が小さい方の入力信号を絶対値の大きい方の入力信号で除する演算が含まれることが好ましく、また、入力値Xと出力値Yが一対一に対応することが好ましい。この条件を満たすよう、関数Fを以下のように定義する。(ステップ111)。なお、F(IN1、IN2)は入力信号IN1、入力信号IN2の中間値を0とする演算を含むものとする。また、本実施例では、説明のため、入力信号IN1と入力信号IN2の最大値と最小値の差を同一の値として説明する。入力信号IN1と入力信号IN2の最大値と最小値の差を同一の値とすることにより、より直線に近い入力値Xと出力値Yの関係が得られている。ここで、Cは周期数であり、基準位置(この場合は出力値Y=0とした)から入力信号IN1、または、入力信号IN2が繰り返された回数を表す値で、本実施例では、正弦波状の信号が6回繰り返されるので、1≦C≦6を満たす。
F(IN1、IN2)=21×(1+IN1/IN2+8×(C−1)) (20)
(但し、|IN2|≧|IN1|かつIN2≧0)
F(IN1、IN2)=21×(3−IN2/IN1+8×(C−1)) (21)
(但し、|IN1|>|IN2|かつIN1≧0)
F(IN1、IN2)=21×(5+IN1/IN2+8×(C−1)) (22)
(但し、|IN2|≧|IN1|かつIN2<0)
F(IN1、IN2)=21×(7−IN2/IN1+8×(C−1)) (23)
(但し、|IN1|>|IN2|かつIN1<0)
図28に、関数Fによる演算結果を示す。ここで、入力軸は回転軸602の多回転を含む回転角度(出力値Y)に相当し、出力軸はF(IN1,IN2)、すなわち、入力値Xに相当する。このように、入力値Xに対して出力値Yが連続で与えられるよう関数Fを定義することが好適であるが、関数Fはそのように限られるものではない。本実施例では、入力値Xから出力値Yを求める必要があるので、図28において回転角度(出力値Y)を示している入力軸と入力値Xを示している出力軸を入れ替えて表示する必要がある。つまり、入力値Xを入力軸とし、回転角度(出力値Y)を出力軸とする必要がある。図29は入力軸に入力値X、出力軸に出力値Y(回転軸602の回転角度)を示した図である。ここでは、直線を分割する必要はなく、全範囲に対して同一のZ(X)を定義する。(ステップ112)。Yの最小値と最大値を結ぶ直線Z(X)を考えると、Z(X)=1080/1008 ×Xで与えられる(ステップ113)。このように、Z(X)をひとつの一次関数で定義するので、一次関数を記憶するメモリー量が少なくなり、また、後述する演算処理が容易となる。本実施例では、ステップ113を解析的な演算により行ったが、これに限定するものではなく、実測のデータを基にして演算回路634により行ってもよいし、外部に用意された専用の演算装置を用いて行ってもよいし、その他どのような手段を用いて定義してもよい。例えば、後述のように、入力信号IN1(i)、入力信号IN2(i)を基にルックアップテーブルを作成するが、入力信号IN1(i)、入力信号IN2(i)を流用し、演算回路634または外部に用意した専用の演算装置が最小2乗法により直線を定義するという方法が考えられる。以上により、直線の定義(ステップ101)は終了となる。
First, the definition of a straight line (step 101) will be described with reference to FIG. In this embodiment, since the resistance of the magnetoresistive element 613 changes in proportion to (1-cosξ), the output of the magnetic sensor 611 is expected to be a sinusoidal signal. The same applies to the magnetoresistive effect element 619, and the arithmetic circuit 634 is supplied with a pair of sine wave input signals IN1 and IN2 having a phase difference of 90 degrees. Each time the magnet 606 rotates 360 degrees around the rotating shaft 604, one cycle of a sinusoidal signal is obtained at IN1 and IN2. Since the gear 603 has 30 teeth and the gear 605 has 15 teeth, the rotation shaft 604 rotates 360 degrees while the rotation shaft 602 rotates 180 degrees. That is, every time the rotating shaft 602 rotates 180 degrees, one cycle of a sinusoidal signal is obtained for IN1 and IN2. On the other hand, similarly, every time the magnet 609 rotates 360 degrees around the rotation shaft 607, one cycle of a sinusoidal signal is obtained at IN3 and IN4. Since the gear 603 has 30 teeth and the gear 608 has 18 teeth, the rotation shaft 607 rotates 360 degrees while the rotation shaft 602 rotates 216 degrees. That is, every time the rotating shaft 602 rotates 216 degrees, one cycle of a sinusoidal signal is obtained at IN3 and IN4. FIG. 27 illustrates the input signal IN1 and the input signal IN2. Here, the input shaft corresponds to a rotation angle (output value Y) including multiple rotations of the rotation shaft 602, and the output shaft is an assumed output voltage (IN 1) of the magnetoresistive effect element 613 and the magnetoresistive effect element 619. This corresponds to the assumed output voltage (IN2). For IN1 and IN2, measured signals may be used, but ideal signals are used here. The procedure for defining a straight line is exactly the same even when an actually measured signal is used. The function F preferably includes an operation of dividing an input signal having a smaller absolute value with the intermediate value of the input signal being 0 among the input signals IN1 and IN2 by an input signal having a larger absolute value. Moreover, it is preferable that the input value X and the output value Y correspond one-to-one. In order to satisfy this condition, the function F is defined as follows. (Step 111). Note that F (IN1, IN2) includes an operation for setting the intermediate value of the input signal IN1 and the input signal IN2 to zero. In this embodiment, for the sake of explanation, the difference between the maximum value and the minimum value of the input signal IN1 and the input signal IN2 will be described as the same value. By making the difference between the maximum value and the minimum value of the input signal IN1 and the input signal IN2 the same value, the relationship between the input value X and the output value Y closer to a straight line is obtained. Here, C is the number of cycles, and is a value representing the number of times the input signal IN1 or the input signal IN2 is repeated from the reference position (in this case, the output value Y = 0). Since the wavy signal is repeated six times, 1 ≦ C ≦ 6 is satisfied.
F (IN1, IN2) = 21 × (1 + IN1 / IN2 + 8 × (C−1)) (20)
(However, | IN2 | ≧ | IN1 | and IN2 ≧ 0)
F (IN1, IN2) = 21 × (3-IN2 / IN1 + 8 × (C−1)) (21)
(However, | IN1 |> | IN2 | and IN1 ≧ 0)
F (IN1, IN2) = 21 × (5 + IN1 / IN2 + 8 × (C−1)) (22)
(However, | IN2 | ≧ | IN1 | and IN2 <0)
F (IN1, IN2) = 21 × (7−IN2 / IN1 + 8 × (C−1)) (23)
(However, | IN1 |> | IN2 | and IN1 <0)
FIG. 28 shows a calculation result by the function F. Here, the input shaft corresponds to a rotation angle (output value Y) including multiple rotations of the rotation shaft 602, and the output shaft corresponds to F (IN1, IN2), that is, the input value X. Thus, it is preferable to define the function F so that the output value Y is continuously given with respect to the input value X, but the function F is not limited to that. In the present embodiment, since it is necessary to obtain the output value Y from the input value X, the input axis indicating the rotation angle (output value Y) and the output axis indicating the input value X in FIG. There is a need. That is, it is necessary to use the input value X as an input shaft and the rotation angle (output value Y) as an output shaft. FIG. 29 is a diagram showing the input value X on the input shaft and the output value Y (the rotation angle of the rotating shaft 602) on the output shaft. Here, it is not necessary to divide the straight line, and the same Z (X) is defined for the entire range. (Step 112). Considering a straight line Z (X) connecting the minimum value and the maximum value of Y, Z (X) = 1080/1008 × X is given (step 113). Thus, since Z (X) is defined by one linear function, the amount of memory for storing the linear function is reduced, and the arithmetic processing described later is facilitated. In this embodiment, step 113 is performed by analytical calculation. However, the present invention is not limited to this, and may be performed by the arithmetic circuit 634 based on actually measured data, or a dedicated calculation prepared outside. It may be performed using an apparatus, or may be defined using any other means. For example, as will be described later, a lookup table is created on the basis of the input signal IN1 (i) and the input signal IN2 (i), but the input signal IN1 (i) and the input signal IN2 (i) are diverted to the arithmetic circuit. A method in which a straight line is defined by the least-squares method can be considered. Thus, the definition of the straight line (step 101) is completed.

次に、図5に従いルックアップテーブル作成(ステップ102)の手順について説明する。まず、ADR(i)とX(i)の対応関係を定義する(ステップ121)。ADR(i)=G(X(i))で表わされる関数Gを定義すればよい。本実施例では、ルックアップテーブルの要素数は1008とする。入力値Xの最大値は、関数Fの定義より1008となる。本実施例では、
G(X(i))=X(i) (24)
(但し、0≦X<1008)
とする。続いて、入力信号IN1(i)、入力信号IN2(i)より入力値X(i)を求める(ステップ122)。入力信号IN1(i)は磁気センサ611から得られた信号をA/D変換器615を通して取り込まれた実測の値であり、入力信号IN2(i)は磁気センサ617より得られた信号をA/D変換器621を通して取り込まれた実測の値である。入力信号IN1(i)、入力信号IN2(i)の実測値を図30に示す。ここで、入力軸は回転軸602の回転角度(出力値Y(i))に相当し、出力軸は磁気抵抗効果素子613の出力電圧(IN1(i))、および、磁気抵抗効果素子619の出力電圧(IN2(i))に相当する。ここで、出力値Yが0となる基準位置は、IN1(i)/IN2(i)=−1、かつ、IN1<0となる点に取っている。入力値X(i)は、ステップ111にて定義した関数Fを用いて、X(i)=F(IN1(i)、IN2(i))より求めればよい。この演算結果は図31となる。ここで、入力軸は回転軸602の回転角度(出力値Y(i))に相当し、出力軸はF(IN1,IN2)、すなわち、入力値X(i)に相当する。ここで、図30に示されているプロットP3、プロットP4(Y(i)=448.979、IN1(i)=0.768、IN2(i)=−0.708、C=3)について演算を行うと、|IN1(i)|>|IN2(i)|かつIN1(i)≧0の条件を満たすので、F(IN1(i)、IN2(i))=21×(3−IN2(i)/IN1(i)+8×(C−1))となる。値を代入して計算すると、X(i)=418.368となり、図31に示すプロットQ2となる。図30にあるすべてのプロットに対して同様の演算を行った結果が図31である。入力値X(i)を入力軸とし、回転角度(出力値Y(i))を出力軸とするとルックアップテーブルの作成が容易であるため、図32に横軸を入力値X(i)、縦軸を出力値Y(i)(回転軸602の回転角度)とした図を示す。プロットQ2について、入力値X(i)と出力値Y(i)を入れ替えると、プロットR2(X(i)=418.368、Y(i)=448.979)となる。最後に、入力値X(i)に対応付けられるアドレスADR(i)を有するa[ADR(i)]にZ−1(Y(i))とX(i)との差 を格納し記憶部に記憶する(ステップ143)。プロットR2に対する演算を用いて説明を行う。関数Gを用いて、ADR(i)=G(X(i))を計算する。ADR(i)=X(i)となり、アドレスADR(i)は418.368となる。また、関数Zを用いて、Z−1(Y(i))=Y(i)×1008/1080となり、Z−1(Y(i))=419.047である。Z−1(Y(i))とX(i)との差をもとめると、Z−1(Y(i))−X(i)=0.679となる。つまり、配列要素a[418.368]に0.679を格納すればよい。これをプロットS2とする。この操作を図32にあるプロットすべてに対して行った結果が図33である。ここで、入力軸はアドレスADR(i)に相当し、出力軸は配列要素a[ADR(i)]に相当する。実施例2と同様に、ADR(i)が整数の場合について配列要素a[ADR(i)]を求める必要があり、直線補間を行うことによりルックアップテーブルを作成する。直線補間の方法は実施例2と同様であり、図34を用いて説明する。図34は、図33のプロットS2付近を拡大したものである。入力軸および出力軸は図33と同様である。プロットS2と同様にしてプロットT3(417.140、0.923)、T4(419.708、0.324)を求める。プロットS2とプロットT3を結んだ直線とADR(i)=418とが交わる点がプロットU3(418、0.777)である。従って、a[418]=0.777となる。同様にプロットS2とプロットT4を結んだ直線とADR(i)=419とが交わる点がプロットU4(419、0.512)である。従って、a[419]=0.512となる。すべてのa[ADR(i)](0≦ADR(i)≦1007)に対してこのように求めることにより、ルックアップテーブルが作成される。
Next, the procedure for creating the lookup table (step 102) will be described with reference to FIG. First, a correspondence relationship between ADR (i) and X (i) is defined (step 121). A function G represented by ADR (i) = G (X (i)) may be defined. In this embodiment, the number of elements in the lookup table is 1008. The maximum value of the input value X is 1008 according to the definition of the function F. In this example,
G (X (i)) = X (i) (24)
(However, 0 ≦ X <1008)
And Subsequently, an input value X (i) is obtained from the input signal IN1 (i) and the input signal IN2 (i) (step 122). The input signal IN1 (i) is a measured value obtained by taking the signal obtained from the magnetic sensor 611 through the A / D converter 615, and the input signal IN2 (i) is a signal obtained from the magnetic sensor 617 by A / D. This is an actual measurement value taken in through the D converter 621. FIG. 30 shows measured values of the input signal IN1 (i) and the input signal IN2 (i). Here, the input shaft corresponds to the rotation angle of the rotation shaft 602 (output value Y (i)), the output shaft represents the output voltage (IN1 (i)) of the magnetoresistive effect element 613, and the magnetoresistive effect element 619. This corresponds to the output voltage (IN2 (i)). Here, the reference position where the output value Y becomes 0 is set to a point where IN1 (i) / IN2 (i) = − 1 and IN1 <0. The input value X (i) may be obtained from X (i) = F (IN1 (i), IN2 (i)) using the function F defined in step 111. The calculation result is shown in FIG. Here, the input shaft corresponds to the rotation angle (output value Y (i)) of the rotation shaft 602, and the output shaft corresponds to F (IN1, IN2), that is, the input value X (i). Here, calculation is performed for the plot P3 and the plot P4 (Y (i) = 448.979, IN1 (i) = 0.768, IN2 (i) = − 0.708, C = 3) shown in FIG. Since the condition of | IN1 (i) |> | IN2 (i) | and IN1 (i) ≧ 0 is satisfied, F (IN1 (i), IN2 (i)) = 21 × (3-IN2 ( i) / IN1 (i) + 8 × (C-1)). When a value is substituted and calculated, X (i) = 418.368 is obtained, and a plot Q2 shown in FIG. 31 is obtained. FIG. 31 shows the result of the same calculation performed on all the plots in FIG. If the input value X (i) is the input axis and the rotation angle (output value Y (i)) is the output axis, it is easy to create a lookup table. The figure which made the vertical axis | shaft the output value Y (i) (rotation angle of the rotating shaft 602) is shown. When the input value X (i) and the output value Y (i) are interchanged for the plot Q2, the plot R2 (X (i) = 418.368, Y (i) = 448.979) is obtained. Finally, the difference between Z −1 (Y (i)) and X (i) is stored in a [ADR (i)] having the address ADR (i) associated with the input value X (i), and the storage unit (Step 143). The description will be made using an operation on the plot R2. The function G is used to calculate ADR (i) = G (X (i)). ADR (i) = X (i), and the address ADR (i) is 418.368. Further, using the function Z, Z −1 (Y (i)) = Y (i) × 1008/1080, and Z −1 (Y (i)) = 419.047. When the difference between Z −1 (Y (i)) and X (i) is obtained, Z −1 (Y (i)) − X (i) = 0.679. That is, 0.679 may be stored in the array element a [418.368]. This is set as plot S2. FIG. 33 shows the result of this operation performed on all the plots in FIG. Here, the input axis corresponds to the address ADR (i), and the output axis corresponds to the array element a [ADR (i)]. Similar to the second embodiment, it is necessary to obtain the array element a [ADR (i)] when ADR (i) is an integer, and a lookup table is created by performing linear interpolation. The method of linear interpolation is the same as in the second embodiment, and will be described with reference to FIG. FIG. 34 is an enlarged view of the vicinity of the plot S2 in FIG. The input shaft and output shaft are the same as in FIG. Similarly to the plot S2, plots T3 (417.140, 0.923) and T4 (419.708, 0.324) are obtained. A point where a straight line connecting the plot S2 and the plot T3 and ADR (i) = 418 intersects is a plot U3 (418, 0.777). Therefore, a [418] = 0.777. Similarly, a point where a straight line connecting the plot S2 and the plot T4 and ADR (i) = 419 intersect with each other is a plot U4 (419, 0.512). Therefore, a [419] = 0.512. By obtaining in this way for all a [ADR (i)] (0 ≦ ADR (i) ≦ 1007), a lookup table is created.

本実施例では、ルックアップテーブルに格納される値は図33より、−1.6〜+1.6の範囲となる。これは、Z(X)= 1080×X/1008であるから、−1.8〜+1.8degを格納することに相当する。ルックアップテーブルに直接角度を格納した場合、格納される最大値は1080となるのに対して、本実施例では、−1.8〜+1.8degに相当する値を格納すればよく、格納される最大値が3.6degである場合に等しい。従って、ルックアップテーブル1要素につき、log2(1080/3.6)=8.2bit削減することが可能となる。具体的な例を挙げると、0.1deg分解能でルックアップテーブルを作成したい場合、角度を直接格納する方式では0〜1080degを格納する必要があり、格納される値は0〜10800となり、14bit(0〜16383)の領域が必要である。一方、本実施例では、0.1deg分解能を得るためには、0.1×1008/1080分解能のテーブルを作成する必要がある。3.2/(0.1×1008/1080)=34.3となり、6bit(0〜63)の領域が必要となる。本実施例では、ルックアップテーブルの要素数は1008となっているので、ルックアップテーブル作成に必要なメモリ量は、直接角度を格納するタイプでは、14×1008=14112bitとなり、約1.8Kバイトである。一方、本実施例では、6×1008bitとなるので、約0.8Kバイトのメモリで同等の効果を得ることが可能となる。本実施例では、ステップ102は、演算回路634により行っているが、外部に用意された専用の演算装置等を用いて行うことが考えられ、演算が可能であれば、その他どのような手段で行ってもよい。 In the present embodiment, the value stored in the lookup table is in the range of −1.6 to +1.6 from FIG. This is equivalent to storing −1.8 to +1.8 deg since Z (X) = 1080 × X / 1008. When the angle is directly stored in the lookup table, the maximum value stored is 1080, whereas in this embodiment, a value corresponding to −1.8 to +1.8 deg is stored and stored. Is equal to a maximum value of 3.6 deg. Therefore, log2 (1080 / 3.6) = 8.2 bits can be reduced for each element of the lookup table. As a specific example, when it is desired to create a lookup table with a resolution of 0.1 deg, it is necessary to store 0 to 1080 deg in the method of directly storing the angle, the stored value is 0 to 10800, and 14 bits ( 0-16383) are required. On the other hand, in this embodiment, it is necessary to create a table of 0.1 × 1008/1080 resolution in order to obtain 0.1 deg resolution. 3.2 / (0.1 × 1008/1080) = 34.3, and an area of 6 bits (0 to 63) is required. In this embodiment, since the number of elements of the lookup table is 1008, the memory amount necessary for creating the lookup table is 14 × 1008 = 141412 bits in the type that directly stores the angle, which is about 1.8 Kbytes. It is. On the other hand, in this embodiment, since it is 6 × 1008 bits, it is possible to obtain the same effect with a memory of about 0.8 Kbytes. In this embodiment, the step 102 is performed by the arithmetic circuit 634. However, it is conceivable that the step 102 is performed by using a dedicated arithmetic device or the like prepared externally. You may go.

次に、図7に従い演算装置による出力演算(ステップ103)について説明する。まず、A/D変換器615より入力信号IN1を、A/D変換器621より入力信号IN2を取り込み、取り込んだ値より入力値Xを求める(ステップ131)。入力値Xを求める関数Fには、周期数Cが含まれる。前述のように、周期数とは、基準位置(この場合は出力値Y=0とした)から入力信号IN1、または、入力信号IN2が繰り返された回数を表す値である。周期数Cの求め方は実施例2と同様で、図30を見れば分かるように、電源投入時は入力信号IN1、入力信号IN2と入力信号IN3、入力信号IN4の電気角位相差から求め、通常動作時はIN1/IN2=−1、かつ、IN1<0となる点で周期数Cを切り替えていけばよい。まず、関数Fを用いて、X=F(IN1、IN2)により入力値Xを求めることができる。例として、図30に示した実測波形におけるプロットP3、プロットP4の値を用いて説明する。IN1=0.768、IN2=−0.708、C=3であり、関数Fに従って計算すると、X=418.368となる。次に、入力値Xより参照するアドレスADRを求める(ステップ132)。関数Gを用いて、ADR=G(X)により求めればよく、ADR=418.368となる。続いて、ルックアップテーブルを記憶部より読み出し、アドレスADRを有する配列要素a[ADR(i)]を参照して入力値Xを補正し、理想的な入力値Xrevを求める(ステップ153)。a[ADR(i)]は配列要素であり、要素数は有限である。従って、アドレスADRを有する配列要素a[ADR(i)]が存在しない場合がある。そのような場合は、アドレスADRを有する配列要素a[ADR(i)]が存在するアドレスADRのうち、アドレスADRより値が小さいアドレスのうち、最もアドレスADRに近い値となるアドレスを有する配列要素a[ADR(i)]と、アドレスADRより値が大きいアドレスのうち、最もアドレスADRに近い値となるアドレスを有する配列要素a[ADR(i)]とを結んだ直線が、アドレスADRを示す直線と交わる点を求め、アドレスADRを有する配列要素a[ADR(i)]であるとすればよい。ここで、a[418.368]を参照する必要があるので、直線補間を用いてルックアップテーブルを参照する。直線補間は図35のように行われる。図35はルックアップテーブルの一部を拡大して示したものであり、入力軸・出力軸は図33と同様である。参照するアドレスが整数でない場合は、小数点以下を切り上げたアドレスに対応する点と、小数点以下を切り上げたアドレスに対応する点を直線で結び、所望のアドレスと重なる点を参照する。ここでは、アドレス418.368を参照したいならば、小数点以下を切り捨てたアドレス418(テーブル値0.777)と小数点以下を切り上げたアドレス419(テーブル値0.512)を直線で結び、アドレス418.368と重なる点(プロットV2)を参照すればよい。プロットV2のテーブル値に相当する値は0.713となる。補正された入力値Xrevは、Xrev=X+a[ADR]で与えられ、Xrev=418.368+0.713=419.081となる。最後に、出力値Z(Xrev)を出力する(ステップ154)。関数Zを用いて演算を行うと、Z(Xrev)=1080/1008×Xrevであるから、Z(X)=1080/1008×419.081=449.015となり、これを出力する。 Next, output calculation (step 103) by the calculation device will be described with reference to FIG. First, the input signal IN1 is acquired from the A / D converter 615 and the input signal IN2 is acquired from the A / D converter 621, and the input value X is obtained from the acquired value (step 131). The function F for obtaining the input value X includes the number of periods C. As described above, the number of cycles is a value representing the number of times the input signal IN1 or the input signal IN2 is repeated from the reference position (in this case, the output value Y = 0). The method of obtaining the number of cycles C is the same as in the second embodiment. As can be seen from FIG. 30, when the power is turned on, the number of periods C is obtained from the electrical angle phase difference between the input signal IN1, the input signal IN2, the input signal IN3, and the input signal IN4. During normal operation, the number of cycles C may be switched at a point where IN1 / IN2 = −1 and IN1 <0. First, using the function F, the input value X can be obtained by X = F (IN1, IN2). As an example, description will be made using the values of plot P3 and plot P4 in the actually measured waveform shown in FIG. When IN1 = 0.768, IN2 = −0.708, and C = 3, calculation according to the function F yields X = 418.368. Next, an address ADR to be referred to is obtained from the input value X (step 132). What is necessary is just to obtain | require by ADR = G (X) using the function G, and becomes ADR = 418.368. Subsequently, the lookup table is read from the storage unit, the input value X is corrected with reference to the array element a [ADR (i)] having the address ADR, and the ideal input value Xrev is obtained (step 153). a [ADR (i)] is an array element, and the number of elements is finite. Therefore, the array element a [ADR (i)] having the address ADR may not exist. In such a case, among the addresses ADR having the array element a [ADR (i)] having the address ADR, the array element having the address closest to the address ADR among the addresses having a value smaller than the address ADR. A straight line connecting a [ADR (i)] and an array element a [ADR (i)] having an address closest to the address ADR among addresses having a value larger than the address ADR indicates the address ADR. A point that intersects with the straight line is obtained, and the array element a [ADR (i)] having the address ADR may be used. Here, since it is necessary to refer to a [418.368], the lookup table is referred to using linear interpolation. Linear interpolation is performed as shown in FIG. FIG. 35 is an enlarged view of a part of the lookup table, and the input and output axes are the same as those in FIG. If the address to be referred is not an integer, the point corresponding to the address rounded up after the decimal point and the point corresponding to the address rounded up after the decimal point are connected by a straight line, and the point overlapping the desired address is referenced. Here, if it is desired to refer to the address 418.368, the address 418 (table value 0.777) rounded down after the decimal point and the address 419 (table value 0.512) rounded up after the decimal point are connected by a straight line. A point overlapping with 368 (plot V2) may be referred to. The value corresponding to the table value of the plot V2 is 0.713. The corrected input value Xrev is given by Xrev = X + a [ADR], and Xrev = 418.368 + 0.713 = 419.081. Finally, the output value Z (Xrev) is output (step 154). When calculation is performed using the function Z, since Z (Xrev) = 1080/1008 × Xrev, Z (X) = 1080/1008 × 419.081 = 449.015, which is output.

本実施例1〜3では、入力信号が正弦波である場合について説明したが、三角波や台形波等、他の形状でも同様の手順で実現可能である。 In the first to third embodiments, the case where the input signal is a sine wave has been described. However, other shapes such as a triangular wave and a trapezoidal wave can be realized by the same procedure.

本実施例2、3では、演算回路と記憶部を個別に説明したが、これに限られるものではなく、演算回路内部に記憶部を有していても良い。   In the second and third embodiments, the arithmetic circuit and the storage unit are individually described. However, the present invention is not limited to this, and the storage unit may be provided inside the arithmetic circuit.

本実施例1〜3では、角度センサについて説明したが、様々な形態が可能である。例えば、リニアセンサのように、固定された磁石を直線上に周期的に配置し、磁気センサが磁石近傍を直線的に移動することにより、出力手段である磁気センサの出力から、磁気センサの移動量を求めることも可能である。従って、出力手段である磁気センサと、対象物である磁石、または、回転軸の周囲に固定された磁石などの相対移動量である移動距離、または、回転角が測定可能である。つまり、対象物と、出力手段と、との相対移動に応じて、出力手段が所定の電気角位相差を有する一対の信号を出力することにより、出力手段と、対象物と、の相対移動量を出力する相対移動量測定装置を得ることが可能である。   In the first to third embodiments, the angle sensor has been described, but various forms are possible. For example, a fixed magnet is periodically arranged on a straight line like a linear sensor, and the magnetic sensor moves linearly around the magnet, so that the magnetic sensor moves from the output of the magnetic sensor as the output means. It is also possible to determine the quantity. Accordingly, it is possible to measure a movement distance or a rotation angle that is a relative movement amount of a magnetic sensor that is an output means, a magnet that is an object, or a magnet that is fixed around the rotation axis. That is, when the output means outputs a pair of signals having a predetermined electrical angle phase difference according to the relative movement between the object and the output means, the relative movement amount between the output means and the object. Can be obtained.

本発明は、コンピュータ技術分野全般や、自動車技術分野、センサ技術分野等の各種工業分野に利用できる。 The present invention can be used in various industrial fields such as the entire computer technical field, the automotive technical field, and the sensor technical field.

201 角度センサ
202 回転軸
203 磁石
204、211 磁界
205、212 磁気センサ
206、213 プリント配線基板
207、214 磁気抵抗効果素子
208、215 増幅器
209、216 A/Dコンバータ
210 演算回路
220 下地層
221 反強磁性層
222 磁化固定層
223 非磁性導電層
224 磁化自由層
225 保護層
221A 反強磁性層221の磁化方向
222A 磁化固定層222の磁化方向
224A 磁化自由層224の磁化方向
401 角度センサ
402 回転軸
403 多極磁石(12極)
404 多極磁石(10極)
405、411、417、423 磁界
406、412、418、424 磁気センサ
407、413、419、425 プリント配線基板
408、414、420、426 磁気抵抗効果素子
409、415、421、427 増幅器
410、416、422、428 A/Dコンバータ
429 演算回路
430 ルックアップテーブル
601 角度センサ
602、604、607 回転軸
603 歯車(30歯)
605 歯車(15歯)
606、609 磁石
608 歯車(18歯)
610、616、622、628 磁界
611、617、623、629 磁気センサ
612、618、624、630 プリント配線基板
613、619、625、631 磁気抵抗効果素子
614、620、626、632 増幅器
615、621、627、633 A/Dコンバータ
634 演算回路
635 ルックアップテーブル
201 Angle sensor 202 Rotating shaft 203 Magnet 204, 211 Magnetic field 205, 212 Magnetic sensor 206, 213 Printed wiring board 207, 214 Magnetoresistive element 208, 215 Amplifier 209, 216 A / D converter 210 Arithmetic circuit 220 Underlayer 221 Magnetic layer 222 Magnetization fixed layer 223 Nonmagnetic conductive layer 224 Magnetization free layer 225 Protection layer 221A Magnetization direction 222A of antiferromagnetic layer 221 Magnetization direction 224A of magnetization pinned layer 222 Magnetization direction 401 of magnetization free layer 224 Angle sensor 402 Rotating shaft 403 Multi-pole magnet (12 poles)
404 Multipole magnet (10 poles)
405, 411, 417, 423 Magnetic field 406, 412, 418, 424 Magnetic sensor 407, 413, 419, 425 Printed wiring board 408, 414, 420, 426 Magnetoresistive element 409, 415, 421, 427 Amplifier 410, 416, 422, 428 A / D converter 429 Arithmetic circuit 430 Look-up table 601 Angle sensor 602, 604, 607 Rotating shaft 603 Gear (30 teeth)
605 Gear (15 teeth)
606, 609 Magnet 608 Gear (18 teeth)
610, 616, 622, 628 Magnetic field 611, 617, 623, 629 Magnetic sensor 612, 618, 624, 630 Printed wiring board 613, 619, 625, 631 Magnetoresistive effect element 614, 620, 626, 632 Amplifier 615, 621, 627, 633 A / D converter 634 arithmetic circuit 635 lookup table

Claims (13)

所定の電気角位相差を有する一対の第1の入力信号のそれぞれと多対一の関係を有する第1の出力値とを対応付けるように前記第1の入力信号に第1の演算を行い定義された第1の入力値を受け、前記第1の入力値を引数とした一次関数に基づいて、前記第1の入力値に対応する前記一次関数上の第2の出力値を前記第1の出力値として出力する演算手段を有する演算装置。 Defined by performing a first operation on the first input signal so as to associate each of a pair of first input signals having a predetermined electrical angle phase difference with a first output value having a many-to-one relationship. A second output value on the linear function corresponding to the first input value based on a linear function having the first input value as an argument and the first output value. An arithmetic unit having arithmetic means for outputting as a value. 所定の電気角位相差を有する一対の第1の入力信号のそれぞれと多対一の関係を有する第1の出力値とを対応付けるように前記第1の入力信号に第1の演算を行い定義された第1の入力値を引数とした一次関数に基づいた前記第1の入力値に対応する前記一次関数上の第2の出力値と、前記第1の出力値と、の差分を、前記第1の入力値と対応付けるアドレス関数により定義されたアドレスを引数とする配列要素に格納した第1のテーブルを有する記憶部から前記第1のテーブルを読み出すとともに、前記第1の入力値を受け、前記第1の入力値に対応する前記第2の出力値と、前記第1の入力値に対応する前記配列要素に格納された値と、に基づいて前記第1の出力値を出力する演算手段を有する演算装置。 Defined by performing a first operation on the first input signal so as to associate each of a pair of first input signals having a predetermined electrical angle phase difference with a first output value having a many-to-one relationship. The difference between the second output value on the linear function corresponding to the first input value based on the linear function with the first input value as an argument and the first output value is the first Reading the first table from a storage unit having a first table stored in an array element having an address defined by an address function associated with an input value of 1 as an argument, receiving the first input value, Computing means for outputting the first output value based on the second output value corresponding to the first input value and the value stored in the array element corresponding to the first input value; Arithmetic unit having. 所定の電気角位相差を有する一対の第1の入力信号のそれぞれと多対一の関係を有する第1の出力値とを対応付けるように前記第1の入力信号に第1の演算を行い定義された第1の入力値を引数とした一次関数上の前記第1の出力値に対応する第2の入力値と、前記第1の入力値と、の差分を、前記第1の入力値と対応付けるアドレス関数により定義されたアドレスを引数とする配列要素に格納した第2のテーブルを有する記憶部から前記第2のテーブルを読み出すとともに、前記第1の入力値を受け、前記第1の入力値と、前記第1の入力値に対応する前記配列要素に格納された値と、に基づいて前記第2の入力値に対応する前記第1の出力値を出力する演算手段を有する演算装置。 Defined by performing a first operation on the first input signal so as to associate each of a pair of first input signals having a predetermined electrical angle phase difference with a first output value having a many-to-one relationship. The first input value is associated with a difference between the second input value corresponding to the first output value on the linear function with the first input value as an argument and the first input value. Reading the second table from a storage unit having a second table stored in an array element having an address defined by an address function as an argument, receiving the first input value, An arithmetic unit having arithmetic means for outputting the first output value corresponding to the second input value based on the value stored in the array element corresponding to the first input value. 前記第1の演算は、前記第1の出力値に応じた、前記一対の第1の入力信号の中間値を0とした絶対値が小さい一方の入力信号を絶対値の大きい他方の入力信号で除する演算を有する請求項1乃至請求項3に記載の演算装置。 In the first calculation, one input signal having a small absolute value with an intermediate value of the pair of first input signals corresponding to the first output value being 0 is replaced with the other input signal having a large absolute value. The arithmetic unit according to claim 1, wherein the arithmetic unit has an arithmetic operation to be divided. 前記第1の演算は、前記一対の第1の入力信号の最大値と最小値との差を同一の値とする演算を有する請求項1乃至請求項4に記載の演算装置。 5. The arithmetic device according to claim 1, wherein the first calculation includes a calculation in which a difference between a maximum value and a minimum value of the pair of first input signals is the same value. 前記一次関数が少なくとも2つの異なる複数の一次関数を有し、前記複数の一次関数は前記第1の入力値と、前記第2の出力値と、が一対一に対応し、前記第1の入力値と、前記第2の出力値のそれぞれが異なる請求項1、2、4、5に記載の演算装置。 The linear function has at least two different linear functions, and the first input value and the second output value have a one-to-one correspondence in the plurality of linear functions, and the first input 6. The arithmetic unit according to claim 1, 2, 4, or 5, wherein the value and the second output value are different from each other. 前記一次関数が少なくとも2つの異なる複数の一次関数を有し、前記複数の一次関数は前記第1の入力値と、前記第1の出力値と、が一対一に対応し、前記第1の入力値と、前記第1の出力値のそれぞれが異なる請求項3乃至5に記載の演算装置。 The linear function has at least two different linear functions, and the first input value and the first output value correspond one-to-one in the plurality of linear functions, and the first input 6. The arithmetic unit according to claim 3, wherein each of the value and the first output value is different. 前記一次関数が前記第1の入力値の全入力範囲において、同一の関数である請求項1乃至請求項5に記載の演算装置。 The arithmetic device according to claim 1, wherein the linear function is the same function in the entire input range of the first input value. 前記演算手段は、前記第1の入力信号の一周期中の電気角位相を示す第1の位相信号と、所定の電気角位相差を有する一対の第2の入力信号の一周期中の電気角位相を示す第2の位相信号と、を受け、前記第1の位相信号と前記第2の位相信号との差分である前記第1の入力信号に応じて変化する第1の位相差信号と、前記第1または第2の位相信号と、に基づいて、前記第1の位相差信号の基準値と前記第1の位相差信号との差分である第2の電気角位相差に対応したそれぞれ前記第1の入力信号または前記第2の入力信号の一周期分が入力された回数を示す第1の周期数または第2の周期数を演算する請求項1乃至8に記載の演算装置。 The computing means includes a first phase signal indicating an electrical angle phase in one cycle of the first input signal and an electrical angle in one cycle of a pair of second input signals having a predetermined electrical angle phase difference. A first phase difference signal that changes in response to the first input signal that is a difference between the first phase signal and the second phase signal. Each corresponding to a second electrical angle phase difference, which is a difference between a reference value of the first phase difference signal and the first phase difference signal, based on the first or second phase signal. The arithmetic unit according to claim 1, wherein a first cycle number or a second cycle number indicating the number of times the first input signal or one cycle of the second input signal is input is calculated. 対象物と、前記一対の入力信号を出力する出力手段と、の相対移動に応じて、前記出力手段が所定の電気角位相差を有する前記一対の入力信号を出力することにより、前記出力手段と、前記対象物と、の相対移動量を出力する請求項1乃至9に記載の演算手段を有する相対移動量測定装置。 The output means outputs the pair of input signals having a predetermined electrical angle phase difference in response to relative movement between the target and the output means for outputting the pair of input signals. 10. A relative movement amount measuring apparatus having a calculation means according to claim 1, which outputs a relative movement amount with respect to the object. 所定の電気角位相差を有する一対の第1の入力信号のそれぞれと多対一の関係を有する第1の出力値とを対応付けるように前記第1の入力信号に第1の演算を行い定義された第1の入力値を求めるステップと、前記第1の入力値を引数とした一次関数を求めるステップと、前記第1の入力値に対応する前記一次関数上の第2の出力値を前記第1の出力値として出力するステップと、を有する演算方法。 Defined by performing a first operation on the first input signal so as to associate each of a pair of first input signals having a predetermined electrical angle phase difference with a first output value having a many-to-one relationship. Obtaining a first input value, obtaining a linear function using the first input value as an argument, and obtaining a second output value on the linear function corresponding to the first input value. And outputting as an output value of 1. 所定の電気角位相差を有する一対の第1の入力信号のそれぞれと多対一の関係を有する第1の出力値とを対応付けるように前記第1の入力信号に第1の演算を行い第1の入力値を定義するステップと、前記第1の入力値を引数とした一次関数を求めるステップと、前記第1の入力値に対応する前記一次関数上の第2の出力値を求めるステップと、前記第2の出力値と、前記第1の出力値と、の差分を求めるステップと、前記第1の入力値と対応付けるアドレス関数によりアドレスを定義するステップと、前記アドレスを引数とした配列要素に前記差分を格納した第1のテーブルを求め記憶するステップと、前記第1の入力値を受け、前記第1のテーブルを読み出すとともに、前記第1の入力値に対応する前記第2の出力値と、前記第1の入力値に対応する前記配列要素に格納された値と、に基づいて前記第1の出力値を出力するステップと、を有する演算方法。 A first calculation is performed on the first input signal so as to associate each of the pair of first input signals having a predetermined electrical angle phase difference with the first output value having a many-to-one relationship. Defining a first input value; obtaining a linear function with the first input value as an argument; obtaining a second output value on the linear function corresponding to the first input value; A step of obtaining a difference between the second output value and the first output value, a step of defining an address by an address function associated with the first input value, and an array element having the address as an argument Obtaining and storing a first table storing the difference; receiving the first input value; reading the first table; and the second output value corresponding to the first input value; , The first input Calculation method with the value stored in the array element that corresponds, and a step of outputting the first output value based on the. 所定の電気角位相差を有する一対の第1の入力信号のそれぞれと多対一の関係を有する第1の出力値とを対応付けるように前記第1の入力信号に第1の演算を行い第1の入力値を定義するステップと、前記第1の入力値を引数とした一次関数を求めるステップと、前記第1の出力値に対応する前記一次関数上の第2の入力値を求めるステップと、前記第1の入力値と、前記第2の入力値と、の差分を求めるステップと、前記第1の入力値と対応付けるアドレス関数によりアドレスを定義するステップと、前記アドレスを引数とした配列要素に前記差分を格納した第2のテーブルを求め記憶するステップと、前記第1の入力値を受け、前記第2のテーブルを読み出すとともに、前記第1の入力値と、前記第1の入力値に対応する前記配列要素に格納された値と、に基づいて前記第2の入力値に対応する前記第1の出力値を出力するステップと、を有する演算方法。 A first calculation is performed on the first input signal so as to associate each of the pair of first input signals having a predetermined electrical angle phase difference with the first output value having a many-to-one relationship. Defining a first input value; obtaining a linear function with the first input value as an argument; obtaining a second input value on the linear function corresponding to the first output value; A step of obtaining a difference between the first input value and the second input value, a step of defining an address by an address function associated with the first input value, and an array element having the address as an argument Obtaining and storing a second table storing the difference, receiving the first input value, reading the second table, and corresponding to the first input value and the first input value To the array element Calculation method has a paid value, and a step of outputting the first output value corresponding to the second input value based on.
JP2011142907A 2011-06-28 2011-06-28 Arithmetic operation device, relative movement amount measurement apparatus, and arithmetic operation method Pending JP2013011456A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011142907A JP2013011456A (en) 2011-06-28 2011-06-28 Arithmetic operation device, relative movement amount measurement apparatus, and arithmetic operation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011142907A JP2013011456A (en) 2011-06-28 2011-06-28 Arithmetic operation device, relative movement amount measurement apparatus, and arithmetic operation method

Publications (1)

Publication Number Publication Date
JP2013011456A true JP2013011456A (en) 2013-01-17

Family

ID=47685457

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011142907A Pending JP2013011456A (en) 2011-06-28 2011-06-28 Arithmetic operation device, relative movement amount measurement apparatus, and arithmetic operation method

Country Status (1)

Country Link
JP (1) JP2013011456A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018031677A (en) * 2016-08-24 2018-03-01 日本電産サンキョー株式会社 motor
JP2020144113A (en) * 2019-03-08 2020-09-10 イーエム・ミクロエレクトロニク−マリン・エス アー Method for determining magnetic field absolute angle

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05346322A (en) * 1992-06-15 1993-12-27 Okuma Mach Works Ltd Position detection method
JP2005043228A (en) * 2003-07-22 2005-02-17 Asahi Kasei Electronics Co Ltd Digital angle measurement system
WO2006043403A1 (en) * 2004-10-20 2006-04-27 Kabushiki Kaisha Yaskawa Denki Encoder signal processor and processing method
JP2006343318A (en) * 2005-05-11 2006-12-21 Toyota Motor Corp Rotational position detector, and rotary electrical equipment driving unit provided therewith
JP2010236935A (en) * 2009-03-30 2010-10-21 Tokai Rika Co Ltd Rotation angle detection device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05346322A (en) * 1992-06-15 1993-12-27 Okuma Mach Works Ltd Position detection method
JP2005043228A (en) * 2003-07-22 2005-02-17 Asahi Kasei Electronics Co Ltd Digital angle measurement system
WO2006043403A1 (en) * 2004-10-20 2006-04-27 Kabushiki Kaisha Yaskawa Denki Encoder signal processor and processing method
JP2006343318A (en) * 2005-05-11 2006-12-21 Toyota Motor Corp Rotational position detector, and rotary electrical equipment driving unit provided therewith
JP2010236935A (en) * 2009-03-30 2010-10-21 Tokai Rika Co Ltd Rotation angle detection device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018031677A (en) * 2016-08-24 2018-03-01 日本電産サンキョー株式会社 motor
JP2020144113A (en) * 2019-03-08 2020-09-10 イーエム・ミクロエレクトロニク−マリン・エス アー Method for determining magnetic field absolute angle

Similar Documents

Publication Publication Date Title
US10775200B2 (en) Rotary encoder and absolute angular position detection method thereof
CN108592956B (en) Rotary encoder and absolute angle position detection method thereof
TWI650528B (en) Rotation angle detecting device and rotation angle detecting method
CN101939623B (en) Rotation angle detection device, rotating machine and rotation angle detection method
JP6484008B2 (en) Encoder and rotation angle position calculation method
JP6969581B2 (en) Rotation angle detector
EP3385679B1 (en) Redundant fault detection device and method
EP2495536A2 (en) 360-degree angle sensor
JP2011038855A (en) Magnetic sensor
JP5062454B2 (en) Magnetic sensor
JP2018132356A (en) Rotary encoder
JP5991031B2 (en) Magnetic sensor
CN110388943B (en) Encoder for encoding a video signal
JP2019219296A (en) Initial setting method and initial setting device
CN108885124A (en) rotation angle detector and torque sensor
JP2018132357A (en) Rotary encoder
JP5062453B2 (en) Magnetic sensor
JP2013011456A (en) Arithmetic operation device, relative movement amount measurement apparatus, and arithmetic operation method
JP5614046B2 (en) Look-up table generation method, angle sensor, and scale
EP4184122B1 (en) Magnetic angular position sensor
CN110388944B (en) Encoder for encoding a video signal
JP4805784B2 (en) Position sensor
JP6377335B2 (en) Data detection method and detection device in detection device
JP5212452B2 (en) Rotation sensor
JP2018132359A (en) Rotary encoder

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20140226

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20141015

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20141125

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20150407