Motor drive and magnetic disc apparatus

A back electromotive force detection circuit 12 incorporates an A/D conversion circuit 14 that converts the output from a differential amplifier circuit A2 into a digital signal and an offset calculation circuit 15 that sets the resistance value of a variable resistor R2 according to the output from the A/D conversion circuit 14. Based on the difference between the output from the A/D conversion circuit 14 as obtained when the drive current fed to a motor coil L equals zero and the output from the A/D conversion circuit 14 as obtained when the drive current fed to a motor coil L equals a predetermined value, the offset calculation circuit 15 sets the resistance value of the variable resistor R2.

TECHNICAL FIELD

The present invention relates to a motor driver that drives a direct-current motor, and more particularly to a motor driver that monitors a current flowing through a motor coil to correct an offset voltage in an input voltage. The present invention also relates to a magnetic disk apparatus in which a magnetic head is driven and controlled with such a motor driver.

BACKGROUND ART

A motor driver that drives and controls a direct-current motor, such as a VCM (voice coil motor) used to produce a mechanical force for moving a magnetic head in a hard disk drive, controls the speed of the direct-current motor by controlling the current value of the drive current fed to the motor coil provided in the direct-current motor. As a conventional technique, there has been proposed a speed control circuit for a direct-current motor wherein the back electromotive force that appears when the motor coil of the direct-current motor is driven is detected based on the current value of the current that flows through voltage division resistors, and, according to the back electromotive force thus detected, the speed of the direct-current motor is controlled (see Patent Publication 1 listed below).

In this speed control circuit, the resistance value of one of the voltage division resistors is changed so that the rotation speed is changed stepwise. Moreover, as the rotation speed of the direct-current motor is changed, the torque characteristic thereof against load changes accordingly. To suppress this change in the torque against load, the resistance value of a resistor connected in parallel with the direct-current motor between the voltage division resistors and the supply voltage is changed.

In a motor driver that controls the speed of a direct-current motor as described above, there is provided a back electromotive force detection circuit configured as shown inFIG. 7. This circuit includes: a resistor Rs of which one end is connected to one end of the motor coil L of the direct-current motor; a resistor R1of which one end is connected to the other end of the resistor Rs; a differential amplifier circuit A1of which the inverting input terminal is connected to the other end of the resistor R1and of which the non-inverting input terminal is connected to the node between the resistor Rs and the motor coil L; a variable resistor R2that is connected between the inverting input terminal and the output terminal of the differential amplifier circuit A1; a resistor R3of which one end is connected to the output terminal of the differential amplifier circuit A1; a resistor R4of which one end is connected to the other end of the resistor R3and that receives a direct-current voltage Vref at the other end thereof; a resistor R5of which one end is connected to the other end of the motor coil L; a differential amplifier circuit A2whose non-inverting input terminal is connected to the node between the resistors R3and R4and whose inverting input terminal is connected to the other end of the resistor R5; and a resistor R6that is connected to the inverting input terminal and the output terminal of the differential amplifier circuit A2.

Configured as described above, the back electromotive force detection circuit shown inFIG. 7operates as follows. The differential amplifier circuit A1outputs a signal containing, as a component thereof, the back electromotive force appearing in the motor coil L. Here, the resistance value of the internal resistance of the motor coil L varies with the ambient temperature of the motor driver, and thus an offset due to the change in the resistance value of the internal resistance of the motor coil L appears in the output of the differential amplifier circuit A2. To cancel this offset due to the change in the resistance value of the internal resistance of the motor coil L, the back electromotive force detection circuit shown inFIG. 7further includes: a differential amplifier circuit A3whose non-inverting input terminal is connected to the output terminal of the differential amplifier circuit A2and that receives, as a reference voltage, a direct-current voltage Voff at the inverting input terminal thereof; and a resistance adjustment counter100that performs counting operation according to the output of the differential amplifier circuit A3so as to change the resistance value of the variable resistor R2to a resistance value proportional to the counted value.

As a result of the differential amplifier circuit A3operating as a comparator, the resistance adjustment counter100performs counting operation according to the output of the differential amplifier circuit A3every period of a clock fed in, and adjusts the resistance value of the variable resistor R2to make it commensurate with the counted value. Here, in a case where the controlled target is a VCM for moving a magnetic head in a hard disk drive, first the magnetic head is kept stationary in contact with a spindle or the inner wall of a ramp area so that no back electromotive force appears, and then the resistance adjustment counter100is reset to an initial value. Then, the output from the differential amplifier circuit A2is compared with the reference voltage Voff by the differential amplifier circuit A3, and, if the output from the differential amplifier circuit A2is higher, the differential amplifier circuit A3feeds a logically high output to the resistance adjustment counter100.

Thus, on receiving a clock pulse, the resistance adjustment counter100counts one, and then changes the resistance value of the variable resistor R2to make it commensurate with the counted value. After the resistance value of the variable resistor R2is changed in this way, a similar sequence of operations is repeated; specifically, the output from the differential amplifier circuit A2is compared with the reference voltage Voff and, if they are not equal, the resistance adjustment counter100performs counting operation and changes the resistance value of the variable resistor R2. By contrast, if the output from the differential amplifier circuit A2equals the reference voltage Voff, the differential amplifier circuit A3outputs a logic low. This makes the resistance adjustment counter100stop counting operation, and settles the resistance value of the variable resistor R2.

In this way, the resistance value of the variable resistor R2is adjusted so that the output from the differential amplifier circuit A2equals the reference voltage Voff and no offset appears. Thus, the back electromotive force detection circuit shown inFIG. 7can cancel the offset that appears due to the resistance value of the internal resistance, which varies with temperature, of the motor coil L of the direct-current motor.Patent Publication 1: Japanese Patent Application Published No. H8-4391

DISCLOSURE OF THE INVENTION

PROBLEMS TO BE SOLVED BY THE INVENTION

With the configuration shown inFIG. 7, the offset that appears due to the resistance value of the internal resistance of the motor coil L of the direct-current motor can be cancelled. However, until the offset is cancelled, the resistance adjustment counter100counts one by one and each time adjusts the resistance value to make it proportional to the counted value. Thus, it takes time to adjust the resistance value of the variable resistor R2until the offset is canceled. Accordingly, a motor driver incorporating a back electromotive force detection circuit like the one shown inFIG. 7requires a sufficient period to complete initial setting, and thus takes time until it starts to operate. Moreover, the speed control circuit for a direct-current motor disclosed in Patent Publication 1 does not include a mechanism for automatically canceling the offset that appears due to the resistance value, which varies with temperature, of the motor coil L of the direct-current motor.

In view of the inconveniences mentioned above, an object of the present invention is to provide a motor driver that is capable of automatically changing the resistance value of a variable resistor for automatically canceling an offset appearing in response to a change in temperature and that helps simplify this capability of automatically changing the resistance value of the variable resistor, and to provide a magnetic disk apparatus incorporating such a motor driver.

MEANS FOR SOLVING THE PROBLEM

To achieve the above object, according to the present invention, a motor driver is provided with a back electromotive force detection section that detects the back electromotive force appearing in a motor coil of a direct-current motor and outputs a detection signal; and a speed control section that, based on the back electromotive force detected by the back electromotive force detection section, sets and outputs the current value of a drive current fed to the motor coil. Here, the motor driver is further provided with: an offset calculation section that first establishes a state in which the direct-current motor cannot be driven via the motor coil and thus no back electromotive force appears, that then reads, as a first output, the output of the back electromotive force detection section as obtained when the current value of the drive current fed to the motor coil is made equal to zero, that then reads, as a second output, the output of the back electromotive force detection section as obtained when the current value of the drive current fed to the motor coil is made equal to a predetermined value, that then calculates, based on the difference between the first and second outputs, the offset that appears in the output of the back electromotive force detection section as a result of a change in the internal resistance of the motor coil, and that then eliminates the offset by changing the amplification factor of the back electromotive force detection section.

ADVANTAGES OF THE INVENTION

According to the present invention, as a result of the motor driver being provided with the offset calculation section that eliminates an offset by changing the amplification factor of the back electromotive force detection section, it is no longer necessary to externally perform calculation to eliminate an offset, and thus it is possible to reduce the burden on an externally provided control section. Moreover, since an offset due to a temperature-related change in the motor coil can be eliminated, it is possible to control a direct-current motor with high precision regardless of temperature change in the environment where the motor driver is installed. Moreover, the motor driver can be initialized through simple calculation by the offset calculation section, and thus it is possible to reduce the time required for initialization. Furthermore, since the resistance value of the second resistor can be changed by the use of a digital signal from the back electromotive force detection section, it is possible to simplify the calculation performed by the offset calculation section.

LIST OF REFERENCE SYMBOLS

1Semiconductor Integrated Circuit Device

11Current Control Circuit

12Back Electromotive Force Detection Circuit

13D/A Conversion Circuit

14A/D conversion Circuit

L Motor Coil

BEST MODE FOR CARRYING OUT THE INVENTION

Hereinafter, an embodiment of the present invention will be described with reference to the drawings.FIG. 1is a block diagram showing the internal configuration of a semiconductor integrated circuit device that constitutes a motor driver embodying the present invention.FIG. 2is a circuit block diagram showing the internal configuration of a back electromotive force detection circuit formed within the semiconductor integrated circuit device that constitutes the motor driver shown inFIG. 1. InFIGS. 1 and 2, such parts and components as serve the same purposes as inFIG. 7are identified with common reference numerals and symbols, and no detailed explanations thereof will be repeated.

The semiconductor integrated circuit device1that constitutes the motor driver shown inFIG. 1includes: a current control circuit11that feeds a drive current to a motor coil L of a direct-current motor such as a VCM; a back electromotive force detection circuit12that receives the voltages at all different contacts of the motor coil L and a resistor Rs, which are connected in series, to detect the back electromotive force in the motor coil L; and a D/A conversion circuit13that performs D/A conversion on a current control signal, which is set by a CPU2according to a detection signal from the back electromotive force detection circuit12and which determines the current value of the drive current outputted from the current control circuit11, and then feeds the resulting signal to the current control circuit11.

In the motor driver built as the semiconductor integrated circuit device1described above, based on the voltages across the resistor Rs and the motor coil L, the back electromotive force detection circuit12detects the back electromotive force that appears in the motor coil L. When a detection signal representing the detected back electromotive force is fed from the back electromotive force detection circuit12to the CPU2, which is a separate device from the semiconductor integrated circuit device1, the CPU2, based on the detection signal, produces a current control signal that determines the current value of the current to be fed to the motor coil L. When this current control signal is fed back to the semiconductor integrated circuit device1, the D/A conversion circuit13converts it from a digital signal to an analog signal, and then feeds it to the current control circuit11. Thus, the current control circuit11outputs a current, of which the current value is set based on the value represented by the current control signal, and feeds it to the motor coil L. Hence, the direct-current motor is driven and controlled via the motor coil L.

As shown inFIG. 2, the back electromotive force detection circuit12includes, like the back electromotive force detection circuit shown inFIG. 7, resistors R1, R3to R6, a variable resistor R2, and differential amplifier circuits A1and A2, and further includes: an A/D conversion circuit14that performs A/D conversion on the output from the differential amplifier circuit A2; an offset calculation circuit15that performs calculation on the output from the A/D conversion circuit14to thereby calculate the offset of the differential amplifier circuit A2, and then sets the resistance value of the variable resistor R2; and a subtraction circuit16that subtracts from the output from the A/D conversion circuit14the offset stored in the offset calculation circuit15. The digital signal outputted from the subtraction circuit16is outputted, as a detection signal, to the CPU2.

In the back electromotive force detection circuit12configured as described above, let the resistance values of the resistors Rs and R1, the variable resistor R2, and the internal resistance of the motor coil L be Rs, R1, R2, and RL, respectively, let the current value of the drive current to the motor coil L be Io, and let the back electromotive force in the motor coil L be Vx, then the output value V of the differential amplifier circuit A2is expressed by formula (1) below. In formula (1), the symbols A and B represent constants.
V=A×(Io×(RL−(R2/R1)×Rs)+Vx+B)  (1)

Thus, by adjusting the resistance value of the variable resistor R2so that RL−(R2/R1)×Rs=0, it is possible to eliminate from the detection signal expressed by formula (1) the element attributable to the current value Io of the drive current to the motor coil L, and thereby to make the output value V of the differential amplifier circuit A2proportional to the back electromotive force. In a case where the output value V from the differential amplifier circuit A2is in the range from zero to Vc, when the back electromotive force Vx in the motor coil L equals zero, the detection signal needs to be a digital signal of which the value corresponds to Vc/2. For that purpose, the output V from the differential amplifier circuit A2contains, as an offset, the value A×B−Vc/2. Accordingly, a digital signal of which the value corresponds to that offset A×B−Vc/2 is stored in the offset calculation circuit15and is fed to the subtraction circuit16. This permits the subtraction circuit16to output a detection signal that represents the back electromotive force in the motor coil L and that contains no offset.

Even when the variable resistor R2is adjusted as described above, as the temperature of the environment in which the motor driver is installed varies, the resistance value RL of the internal resistance of the motor coil L varies. Thus, when the resistance value of the internal resistance of the motor coil L changes from RL to RL±ΔRL, an offset of which the value equals ±ΔV=±A×ΔRL×Io appears in the detection signal outputted from the subtraction circuit16. To cope with this, when the motor driver starts to drive, for the purpose of avoiding such an offset due to a change in temperature, the resistance value of the variable resistor R2needs to be so changed as to eliminate, from the output of the differential amplifier circuit A2, an offset voltage corresponding to ±ΔV=±A×ΔRL×Io.

How the offset that appears in the detection signal due to a change in temperature is eliminated will be described in detail below. To eliminate the above-mentioned offset ΔV, in a case where the resistance value of the variable resistor R2changes from R2to R2±ΔR2, the offset ΔV and the change in the resistance value of the variable resistor R2need to fulfill the relationship expressed by formula (2) below. Suppose here that the output of the A/D conversion circuit14is an n-bit digital signal, the quantization unit Δv of the output value V of the A/D conversion circuit14equals Vc/2n, and the outputted digital signal has a value in the range from zero to 2n−1, Moreover, when the output of the differential amplifier circuit A1equals Vc/2, the value of the digital signal outputted from the A/D conversion circuit14equals 2n−. In this state, the offset ΔV that appears in the output value V of the A/D conversion circuit14due to a change in the internal resistance of the motor coil L is expressed by formula (3) below. Here, the symbol X represents an integer that fulfills 1≦X≦2n−1.
ΔV=A×Io×(ΔR2/R1)×Rs(2)
ΔV=Δv×X(3)

Moreover, suppose that the variable resistor R2changes in increments of Δr2, and that the change ΔR2equals X×Δr2, then the relationship between Δr2and Δv is expressed by formula (4) below. Thus, the resistance value of the variable resistor R2is divided into n bits, with the quantization unit equal to Δr2. Here, as shown inFIG. 3, the variable resistor R2is composed of: resistors Ra1, Ra2, . . . , Ran−1, and Ran that are connected in series and that have resistance values Δr2×2n−1,Δr2×2n−2, . . . , Δr2×21, and Δr2×20, respectively; and MOS transistors T1to Tn that are connected in parallel with the resistors Ra1to Ran, respectively. That is, the resistance value R2of the variable resistor R2can be varied within the range of 0≦R2≦Δr2×2n−1.
Δv=A×Io×(Δr2/R1)×Rs(4)

Let the middle value of the resistance value of the variable resistor R2be Rx (=Δr2×2n−1), then the resistance values of the resistors Ra1, Ra2, . . . , Ran−1, and Ran equal Rx/20, Rx/21, . . . , Rx/2n−2, and Rx/2n−1, respectively. The relationship between this resistance value Rx and the direct-current voltage Vc is expressed by formula (5) below. Thus, the current value Io may be constant, in which case the resistance value Rx equals Vc×R1/(2×A×Io×Rs), or alternatively the resistance value RX may be constant, in which case the current value Io equals Vc×R1/(2×A×Rx×Rs).
Vc=A×Io×(2Rx/R1)×Rs(5)

With the variable resistor R2configured as described above, the resistance value of the variable resistor R2is set by the offset calculation circuit15turning on and off the MOS transistors T1to Tn. Specifically, when the MOS transistor Tk (where k represents an integer fulfilling 1≦k≦n) is turned on, the resistance value of the resistor Rak is not added to the resistance value of the variable resistor R2; when the MOS transistor Tk is turned off, the resistance value of the resistor Rak is added to the resistance value of the variable resistor R2.

Moreover, in the offset calculation circuit15, first the output X1from the A/D conversion circuit14as obtained when the drive current fed to the motor coil L equals zero is read, and is recorded as the offset to be subtracted in the subtraction circuit16. Then, while the direct-current motor is kept at rest so that no back electromotive force appears in the motor coil L, the output X2from the A/D conversion circuit14as obtained when a drive current having a predetermined value Io is fed to the motor coil L is read, and, from the output X2of the A/D conversion circuit14as obtained when the drive current equals Io, the output X1of the AID conversion circuit as obtained when the drive current equals zero is subtracted. Then, based on the resulting value X2−X1, the MOS transistors T1to Tn are turned on and off to set the resistance value of the variable resistor R2.

When the offset calculation circuit15operates as described above, for example in a case where the motor driver of this embodiment is used to drive and control a direct-current motor that produces a driving force for moving a magnetic head21across the surface of a disk20as shown inFIG. 4A, the offset is detected with the magnetic head21kept in contact with either an outer edge portion of the inner wall of a ramp area22that is provided outside the disk20to store the magnetic head21away in or a spindle23provided at the center of the disk20.FIG. 4Ais a view from above the top face of the disk20, andFIG. 4Bis a sectional view. InFIG. 4A, the arrow Da that represents the direction from the ramp area22to the spindle23indicates the direction in which the magnetic head21is loaded, and the arrow Db that represents the direction from the spindle23to the ramp area22indicates the direction in which the magnetic head21is unloaded.

Specifically, with the magnetic head21kept in contact with an outer edge portion of the inner wall of a ramp area22, by feeding from the current control circuit11to the motor coil L a drive current flowing from the motor coil L to the resistor Rs so as to give a driving force that tends to move the magnetic head21in the direction indicated by the arrow Db, the resistance value of the variable resistor R2is set. Moreover, with the magnetic head21kept in contact with the spindle23, by feeding from the current control circuit11to the motor coil L a drive current flowing from the resistor Rs to the motor coil L so as to give a driving force that tends to move the magnetic head21in the direction indicated by the arrow Da, the resistance value of the variable resistor R2is set. Furthermore, it is assumed that, when the drive current is passed in the direction from the resistor Rs to the motor coil L, its current value has a positive value.

Thus, when the magnetic head21is kept contact with the spindle23, the drive current fed to the motor coil L has a positive value, and hence the offset that appears in the output from the A/D conversion circuit14equals X2−X1. Accordingly, the resistance value of the variable resistor R2is set to be Rx−Δr2×(X2−X1). On the other hand, when the magnetic head21is kept contact with the ramp area22, the drive current fed to the motor coil L has a negative value, and hence the offset that appears in the output from the A/D conversion circuit14equals −(X2−X1). Accordingly, the resistance value of the variable resistor R2is set to be Rx−Δr2×(X1−X2).

The initial setting operation of the back electromotive force detection circuit12configured as described above will be described below with reference to the timing charts shown inFIGS. 5 and 6. Here, it is assumed that n=4, and thus that the AID conversion circuit14perform conversion into a four-bit digital signal. Specifically, the variable resistor R2is composed of resistors Ra1, Ra2, Ra3, and Ra4having resistance values Rx/20, Rx/21, Rx/22, and Rx/23, respectively, and MOS transistors T1to T4connected in parallel with the resistors Ra1to Ra4, respectively.

At the start of the initial setting operation, in response to a signal corresponding to (24−1)10=(1000)2, the MOS transistor T1, which receives at its gate a signal corresponding to “1” in the first digit from the offset calculation circuit15is turned off, and the MOS transistors T2to T4, which receive at their gates signals corresponding to “0” in the second to fourth digits, are turned on. As a result, in the variable resistor R2, the Ra1and the MOS transistors T2to T4, which are turned on, are connected in series, and thus the variable resistor R2has a resistance value Rx/20.

Subsequently, when the offset is checked with the magnetic head21kept in contact with the spindle23, as shown inFIG. 5, when the first internal clock pulse C1is inputted to the back electromotive force detection circuit12, the drive current fed to the motor coil L is made equal to zero. Then, when the second internal clock pulse C2is inputted, the offset calculation circuit15reads the output X1from the A/D conversion circuit14, and stores (X1−8)10as the offset to be fed to the subtraction circuit16.

Subsequently, as shown inFIG. 5, when the third internal clock pulse C3is inputted, the current value of the drive current fed to the motor coil L is made equal to Io, which has a positive value. Thereafter, when the fourth internal clock pulse C4is inputted, the output X2from the A/D conversion circuit14is read to calculate (8−(X2−X1))10, and a four-bit signal corresponding to (8−) (X2−X1))10is outputted to the variable resistor R2. Thus, with the four-bit signal corresponding to (8−(X2−X1)10, the MOS transistors T1to T4are turned on or off, and the resistance value of the variable resistor R2is set accordingly.

For example, suppose that the output X1read when the internal clock pulse C2is fed in is (1001)2, and that the output X2read when the internal clock pulse C4is fed in is (1011)2. In this case, when the internal clock pulse C2is fed in, as the offset to be fed to the subtraction circuit16, (X1−8)10=(1001)2is stored in the offset calculation circuit15.

Later, when the internal clock pulse C4is fed in, (8−(X2−X1))10=(1000−(1011−10001))2,=(0110)2is calculated by the offset calculation circuit15, and is fed to the variable resistor R2. Thus, the MOS transistors T2and T3, which receive at their gates signals corresponding to “1” in the second and third digits, are turned off, and the MOS transistors T1and T4, which receive at their gates signals corresponding to “0” in the first and fourth digits, are turned on. As a result, in the variable resistor R2, the resistors Ra2and Ra3and the MOS transistors T1and T4, which are turned on, are connected in series, and thus the resistance value of the variable resistor R2now equals Rx/21+Rx/22.

Suppose now that the output X1read when the internal clock pulse C2is fed in is (1001)2, and that the output X2read when the internal clock pulse C4is fed in is (0111)2. In this case, when the internal clock pulse C2is fed in, as the offset to be fed to the subtraction circuit16, (X1−8)10=(0001)2is stored in the offset calculation circuit15.

Later, when the internal clock pulse C4is fed in, (8−(X2−X1))10=(1000−(0111−1001))2=(1010)2is calculated by the offset calculation circuit15, and is fed to the variable resistor R2. Thus, the MOS transistors T1and T3, which receive at their gates signals corresponding to “1” in the first and third digits, are turned off, and the MOS transistors T2and T4, which receive at their gates signals corresponding to “0” in the second and fourth digits, are turned on. As a result, in the variable resistor R2, the resistors Ra1and Ra3and the MOS transistors T2and T4, which are turned on, are connected in series, and thus the resistance value of the variable resistor R2now equals Rx/20+Rx/22.

On the other hand, when the offset is checked with the magnetic head21kept in contact with the ramp area22, as shown inFIG. 6, when the first internal clock pulse C1is inputted to the back electromotive force detection circuit12, the drive current fed to the motor coil L is made equal to zero. Then, when the second internal clock pulse C2is inputted, the offset calculation circuit15reads the output X1from the A/D conversion circuit14, and stores (X1−8)10as the offset to be fed to the subtraction circuit16.

Subsequently, as shown inFIG. 6, when the third internal clock pulse C3is inputted, the current value of the drive current fed to the motor coil L is made equal to-Io, which has a negative value. Thereafter, when the fourth internal clock pulse C4is inputted, the output X2from the A/D conversion circuit14is read to calculate (8+(X2−X1))10, and a four-bit signal corresponding to (8+(X2−X1))10, is outputted to the variable resistor R2. Thus, with the four-bit signal corresponding to (8+(X2−X1)10, the MOS transistors T1to T4are turned on or off, and the resistance value of the variable resistor R2is set accordingly.

For example, suppose that the output X1read when the internal clock pulse C2is fed in is (1001)2, and that the output X2read when the internal clock pulse C4is fed in is (1011)2. In this case, when the internal clock pulse C2is fed in, as the offset to be fed to the subtraction circuit16, (X1−8)10=(0001)2is stored in the offset calculation circuit15.

Later, when the internal clock pulse C4is fed in, (8+(X2−X1))10=(1000+(1011−1001))2=(1010)2is calculated by the offset calculation circuit15, and is fed to the variable resistor R2. Thus, the MOS transistors T1and T3, which receive at their gates signals corresponding to “1” in the first and third digits, are turned off, and the MOS transistors T2and T4, which receive at their gates signals corresponding to “0” in the second and fourth digits, are turned on. As a result, in the variable resistor R2, the resistors Ra1and Ra3and the MOS transistors T2and T4, which are turned on, are connected in series, and thus the resistance value of the variable resistor R2now equals Rx/20+Rx/22.

Suppose now that the output X1read when the internal clock pulse C2is fed in is (1001)2, and that the output X2read when the internal clock pulse C4is fed in is (0111)2. In this case, when the internal clock pulse C2is fed in, as the offset to be fed to the subtraction circuit16, (X1−8)10=(0001)2is stored in the offset calculation circuit15.

Later, when the internal clock pulse C4is fed in, (8+(X2−X1))10=(1000+(0111−1001))2, =(0110)2is calculated by the offset calculation circuit15, and is fed to the variable resistor R2. Thus, the MOS transistors T2and T3, which receive at their gates signals corresponding to “1” in the second and third digits, are turned off, and the MOS transistors T1and T4, which receive at their gates signals corresponding to “0” in the first and fourth digits, are turned on. As a result, in the variable resistor R2, the resistors Ra2and Ra3and the MOS transistors T1and T4, which are turned on, are connected in series, and thus the resistance value of the variable resistor R2now equals Rx/21+Rx/22.

Through operations as performed in the different examples described above, the value obtained by eliminating from the output of the differential amplifier circuit A2the offset due to the internal resistance of the motor coil L is outputted from the A/D conversion circuit14. Thus, when the internal clock pulse CS is fed in with the current value of the drive current to the motor coil L kept equal to Jo, which has a positive value, the output from the A/D conversion circuit14equals (1001)2. Then, the subtraction circuit16subtracts the offset (0001)2, and thus the detection signal outputted from the subtraction circuit16has a value (1000)2.