Vehicle compass with electronic sensor
FIELD OF THE INVENTION 
     This invention relates to magnetic compasses for vehicles. More particularly, it relates to compasses of the type which utilize an electronic magnetic field sensor. 
     BACKGROUND OF THE INVENTION 
     Magnetic compasses are commonly used in vehicles, including land vehicles, boats and aircraft, as an aid in direction finding and navigation. There is an increasing demand for magnetic compasses especially for use in passenger cars. In this field of use, there is an increasing requirement for a compass of low cost which exhibits a relatively high degree of accuracy with great reliability and which is of small size and weight. 
     Magnetic compasses for vehicles may be classified according to the type of the magnetic field sensor. One type is a magnetic rotor sensor which utilizes a magnetized element rotatably mounted to align itself with the ambient magnetic field. Examples of this type of vehicle compass are disclosed in Schierbeek et al U.S. Pat. No. 4,862,594 granted Sep. 5, 1989 and in co-pending application Ser. No. 07/597,854 filed Oct. 15, 1990 by Schierbeek et al, now U.S. Pat. No. 5,131,154, granted Jul. 21, 1992. Said patents are assigned to the same assignee as this application. 
     Another type is a flux gate sensor which utilizes a saturable magnetic core with excitation and sense windings for sensing the direction and field strength of an ambient magnetic field. Examples of vehicle compasses with flux gate sensors are represented by Baker et al U.S. Pat. No. 3,683,668 granted Aug. 15, 1972; Bower et al U.S. Pat. No. 4,733,179 granted Mar. 22, 1988; Hormel U.S. Pat. No. 4,720,992 granted Jan. 26, 1988; and Van Lente et al U.S. Pat. No. 4,953,305 granted Sep. 4, 1990. 
     There is a need, especially in vehicle compasses for passenger cars, for an improved magnetic field sensor to achieve the goals of accuracy, reliability, small size and weight and low cost. However, one of the problems in meeting these goals is that of providing deviation compensation for the compass, which is required to provide a high degree of accuracy, without a large cost penalty. It is known that a magnetic compass installed in a vehicle must be calibrated in the vehicle to account for the disturbing effect of the vehicle magnetic field. It is known that vehicles produce a magnetic field due to the presence of ferromagnetic materials, electric current carrying wires and the like and this magnetic field interferes with the earth field at locations within and adjacent the body of the vehicle. The magnetic field sensor of a compass responds to the localized magnetic field in which it is immersed for the purpose of direction finding with reference to the earth magnetic field. The magnetic field vector produced by the vehicle, herein referred to as the deviating magnetic field vector, combines with the earth magnetic field vector to produce a resultant or external magnetic field vector which, without calibration or compensation is unsuitable for reliable and accurate direction finding. Fully automatic deviation compensation is needed to meet present-day demands for passenger cars. 
     It is known to provide deviation compensation in a magnetic compass with a rotor type sensor by use of a pair of compensation coils which are energized with current to generate a magnetic field which is equal and opposite to the deviating magnetic field. This method of deviation compensation requires the vehicle to be oriented in certain cardinal directions relative to magnetic north and adjustments of coil current must be made. This adjustment may be carried out by the vehicle driver or it may be automated in a computer controlled compass. It results in inaccuracy unless the vehicle heading is accurately aligned relative to magnetic north. Deviation compensation of this type is disclosed in the above cited Schierbeek U.S. Pat. No. 4,862,594. 
     Another method of deviation compensation for vehicle compasses is referred to as the one hundred eighty degree compensation method. In this, the resultant magnetic field is measured with the vehicle in any selected orientation relative to the magnetic north and then the resultant field is measured with the vehicle in an orientation displaced one hundred eighty degrees from the first orientation. Using the measured values of the magnitude and directions of the resultant fields, the deviating field is calculated for both magnitude and direction. The calculated value is stored and subtracted from the magnetic field measurements subsequently taken by the compass in use for direction finding to thereby compensate it for deviation. The use of this method for a flux gate compass is disclosed in the above cited Bower, U.S. Pat. No. 4,733,179, the Hormel, U.S. Pat. No. 4,720,992 and the Baker et al, U.S. Pat. No. 3,683,668. 
     Fully automatic deviation compensation systems for vehicle compasses have been proposed wherein no manual intervention is required. In the Tsushimo, U.S. Pat. No. 4,445,279, granted May 1, 1984 an automatic system is disclosed using a flux gate sensor. An A-to-D converter and microprocessor are used to calculate an offset correction to compensate for the deviating field of the vehicle after driving the car in a full circle. A fully automatic compensation system is described in the Al-Attar, U.S. Pat. No. 4,807,462 granted Feb. 28, 1989. In the system of this patent, a flux gate sensor measures three headings with the car moving, and using the headings, the coordinates are derived for the center of the earth field circle and the directional offset values are computed by using the coordinates. Another fully automatic deviation compensation system is described in the Van Lente, U.S. Pat. No. 4,953,305 cited above. In this system, a flux gate sensor is used and the maximum and minimum signal values are recorded while the vehicle is driven through a closed loop. Then, the value of the deviating vehicle field is calculated from the recorded values. The compensating current is applied to the respective X and Y axis sense coils of the flux gate sensor to nullify the deviating field. 
     In the prior art, it is proposed to use magnetoresistive sensors in magnetic compasses. Such a compass is shown in the Picard U.S. Pat. No. 1,946,170 granted Feb. 13, 1934 wherein the magnetoresistive elements are connected in a bridge circuit. A compass using thin film magnetoresistive sensors is described in the Stucki et al U.S. Pat. No. 3,942,258 granted Mar. 9, 1976. In this system three magnetoresistive sensors are disposed in orthogonal relationship to develop a signal corresponding to the angular relationship between the compass platform and the magnetic north. The sensors are provided with a pumping coil and an output coil wound around the film at ninety degrees to each other. The pumping coil applies an alternating bias magnetic field to the magnetoresistive film. The Sansom U.S. Pat. No. 4,525,671 granted Jun. 25, 1985 describes a magnetoresistive sensor with a single magnetoresistive element capable of sensing two components of a magnetic field. A current strap extends parallel to the magnetoresistive element and other current strap extends at right angles to the magnetoresistive element. One of the current straps carries current in alternate directions during a periodic cycle while the other strap carries current in a single direction. Another magnetic compass comprising a magnetoresistive thin film is disclosed in UK patent application No. 8707218 published Sep. 28, 1988. Two pairs of magnetoresistive thin films are arranged at right angles to each other. Means are provided to produce a biasing magnetic field and to measure a change in electric resistivity of the magnetoresistive material. The Boord et al U.S. Pat. No. 4,533,872 granted Aug. 6, 1985 describes a magnetoresistive thin film sensor of particular configuration for use as an electronic sensor in a compass. 
     As indicated above, the prior art is replete with vehicle compass technology in great detail. While the use of magnetoresistive sensors for compasses is suggested in the prior art, practical application requires an acceptable technique for fully automatic deviation compensation in a vehicle. Even though the prior art includes many different methods of deviation compensation for vehicle compasses, the art is lacking in respect to deviation compensation for magnetoresistive sensors. 
     A general object of this invention is to provide an improved vehicle compass using a magnetoresistive sensor which overcomes certain disadvantages of the prior art. 
     SUMMARY OF THE INVENTION 
     In accordance with this invention, a vehicle compass is provided which provides a high degree of accuracy and reliability with small size and weight and which is of low cost. This is accomplished using a thin film magnetoresistive sensor provided with a current conductor for providing switchable magnetic bias and a current conductor for nullifying a deviating field. 
     Further, in accordance with this invention, an electronic compass is provided which employs a closed loop system to nullify deviating magnetic fields. 
     A complete understanding of this invention may be obtained from the detailed description that follows taken with the accompanying drawings. 
    
    
     DESCRIPTION OF THE DRAWINGS 
     FIG. 1 depicts a single-axis magnetoresistive sensor; 
     FIG. 2 is a graphical representation of the operation of a single-axis magnetoresistive sensor; 
     FIG. 3 is a diagram representing a typical relationship of the compass sensor and certain magnetic field vectors with the directional axis of a vehicle in which the compass of this invention is installed; 
     FIG. 4 is a block diagram of a compass embodying this invention; 
     FIGS. 5A and 5B are a graphical representation of the operation of the compass of FIG. 4; 
     FIG. 6 is a timing diagram to aid in explanation; 
     FIG. 7 is a flow chart representing the program executed by the microcomputer of the compass; 
     FIG. 8 is a schematic diagram of the Y-axis signal channel of the compass embodying this invention; 
     FIG. 9 is a schematic diagram of the X-axis signal channel; 
     FIGS. 10A and 10B taken together form a schematic diagram of electronic circuits, including the microcomputer, which are coupled with the circuits of FIGS. 8 and 9 of the compass; and 
     FIG. 11 is a schematic diagram of the bias current circuit for set and reset of the sensor. 
    
    
     BEST MODE FOR CARRYING OUT THE INVENTION 
     Referring now to the drawings, there is shown an illustrative embodiment of the invention in a magnetic compass for vehicles which utilizes a magnetoresistive sensor. It will be appreciated as the description proceeds that the invention is useful in other applications and may be realized in different embodiments. 
     Before describing the compass of this invention, it will be helpful to consider the magnetoresistive sensor used in the compass. A single-axis magnetoresistive sensor is illustrated schematically in FIG. 1. The sensor 10 comprises a bridge circuit 12 including a set of four magnetoresistive elements 14 connected in the bridge circuit. The magnetoresistive elements 14 are formed of a magnetic material which exhibits the magnetoresistive effect, such as permalloy, which changes its resistivity in the presence of an external magnetic field. The bridge circuit 12 is excited with a DC voltage across the input terminals and an output signal voltage Vo is developed across the output terminals in response to an external magnetic field. The sensor 10 is provided with a bias current strap 16 which is energized by a set/reset voltage at its input terminal to produce a magnetic bias field M B  which is of reversible polarity in accordance with the input voltage. Also, the sensor 10 is provided with an offset current strap 18 which is energized by a reversible polarity offset voltage applied to its input terminals. The current strap 18 produces an offset magnetic field M o  which is reversible polarity in accordance with the input signal voltage. The functions of the bias current strap 16 and the offset current strap 18 will be discussed subsequently. 
     Preferably, the sensor 10 is fabricated on a silicon substrate on which the magnetoresistive elements 14 are deposited as a thin film. In this construction, the bias current strap 16 is formed as a current conductive layer. It overlays a soft magnetic layer which in turn overlays the elements 14. A pulse of current in one direction through the current strap 16 produces a magnetic field of sufficient strength to saturate the magnetic layer and provide a positive bias field. When the current is removed, the device remains in a biased condition under the influence of the magnetic layer. Similarly, a pulse of current in the opposite direction provides a negative bias. The offset current strap 18 is formed as a current conductive layer which overlays the magnetoresistive elements 14 and carries current in a direction perpendicular to the current carrying direction of the strap 16. The offset magnetic field M o  produced by the current strap 18 is effective to oppose an external magnetic field to which the magnetoresistive elements 14 are subjected. Magnetoresistive sensors constructed by the deposition of a thin film ferromagnetic material on a silicon substrate are well-known in the art, as indicated by the Boord U.S. Pat. No. 4,533,872. 
     The operation of the sensor 10 will be described with reference to the graph of FIG. 2. The curve V represents the output voltage of the sensor 10 as a function of magnetic field strength in a direction perpendicular to the current flow in the magnetoresistive elements 14. When the field strength is zero, the output voltage V has a maximum value and as the field strength is increased from zero in either direction, the output voltage decreases symmetrically. (The terms `positive` and `negative` and the symbols therefor are used in a relative sense to denote opposite directions or polarity of magnetization.) The voltage curve near the peak is highly non-linear and tends to become substantially linear in a mid-range of the voltage variation. In order to obtain directional information regarding an external magnetic field, a bias field having a field strength alternating between +M B  and -M B  is applied to the magnetoresistive elements 14. This is accomplished by the bias current strap 16 and the associated soft magnetic layer which is alternately driven into magnetic saturation by current pulses of alternate polarity through the current strap 16. When a current pulse is applied in one direction the device will operate with a positive bias, +M B , which herein is called the &#34;set mode&#34; until the saturation of the soft iron magnetic layer is reversed. A current pulse in the opposite direction will reverse the direction of saturation and the device will operate with a negative bias, -M B , herein called the &#34;reset mode&#34;. 
     When the device is operated in the alternating set/reset modes and when subjected to zero field strength, the output voltage V will have a value V R  in the set mode and also in the reset mode so that the output voltage remains constant at the V R  level. When the sensor 10 is subjected to an external magnetic field M c , the external field is combined with the bias field M B . As shown in FIG. 2, if the external field is of positive polarity, i.e. +M c , it will add to the bias field +M B  to produce a resultant field strength M B  +M c  which results in an output voltage -V c . In the reset mode, the external field +M c  decreases the bias field -M B  to produce a net field strength of -M B  +M c . This produces an output voltage in the reset mode of +V c . Thus, the output voltage of the sensor 10, when subjected to an external magnetic field of +M c , is an alternating square wave voltage of the same frequency as the alternating square wave voltage applied to the bias current strap 16. The output voltage varies from a positive peak value of +V c  in the reset mode to a negative peak value of -V c  in the set mode. As indicated in FIG. 2, the peak-to-peak value of the output voltage Vo represents the external field M c . As will be discussed subsequently, the voltage V R  is an offset voltage which is removed from the output voltage V o  by AC coupling. It is noted further that if the output voltage V o  is positive in the reset mode, the external field M c  is positive and if the output voltage V o  is positive in the set mode the external field is negative. It is only necessary to measure the positive portion of the output voltage V o  to determine the magnitude of the external field and the direction of the external field M c  will be known from its polarity and whether it is in the set or reset mode. 
     Now consider the sensor 10 installed in a vehicle 26, such as a passenger car, as depicted in FIG. 3. In order to determine the direction of the external field M c , it is necessary to use two single-axis sensors 10 and 10&#39; which are orthogonally oriented relative to each other. The sensor 10 is mounted in the vehicle with its sensitive axis SA parallel to the direction reference axis, i.e. the longitudinal axis Y--Y of the vehicle 26. The sensor 10&#39; is of the same construction as sensor 10 and is mounted adjacent the sensor 10 with its sensitive axis extending parallel to the X--X axis of the vehicle. In such an installation, the sensors are subject to the earth magnetic field M N  which is stationary with reference to the earth and it is also subjected to the vehicle magnetic field M v  which is stationary with respect to the vehicle. The external field M c  to which the sensor 10 is subjected is the vector sum of the earth field and the vehicle field. Accordingly, the sensor 10 responds to the Y-axis component of the vehicle field and the sensor 10&#39; responds to the X-axis component. The vehicle field M v  remains constant regardless of the direction heading of the vehicle 26. However, the external magnetic field M c  includes a component due to the earth field M N  and the output voltages of the sensors 10 and 10&#39; vary with vehicle heading relative to the magnetic north direction, as will be discussed below. 
     The electronic compass of this invention is shown in block diagram in FIG. 4. In general, the compass comprises a two-axis sensor 32 and a multiplexer 34 which are mounted on a sensor circuit board 36. It also comprises a microcomputer 38, an analog-to-digital converter 42 and a digital-to-analog converter 44 which are mounted on a mother board 46. The circuits of FIG. 4 are operative to measure the X and Y-axis output signals and to process the signals to eliminate the DC voltage offset and to nullify the effect of the vehicle deviating magnetic field to obtain deviation compensation of the compass. The microcomputer 38 is operated under a control program to process the signals to achieve deviation compensation and to compute the magnetic heading of the vehicle, as will be described subsequently. 
     The circuit of FIG. 4 will now be described in greater detail. The two-axis sensor 32 comprises the Y-axis sensor 10 and the X-axis sensor 10&#39; mounted with respect to each other and the vehicle 26 as described above. A multiplexer 34 has an address select input 52 for selecting X or Y-axis output signals. The output signal of the Y-axis sensor 10 is applied to an input 56 of the multiplexer and the X-axis output signal of the sensor 10&#39; is applied to an input 54 of the multiplexer. The output signal of the multiplexer at output 58 is coupled through a capacitor 62 to the input 64 of the A/D converter 42. The capacitor 62 provides AC coupling between the multiplexer output 58 and the A/D converter input 64 to block the DC offset voltage V R  discussed above with reference to FIG. 2. Thus, the amplitude of the output voltages of the sensors 10 and 10&#39; which must be measured by the A/D converter 42 is reduced by the value of the DC offset voltage. 
     The output of the A/D converter 42 is applied to inputs 63 of the microcomputer 38. The microcomputer 38 processes the digital signal outputs of the A/D converter 42 in accordance with an algorithm for determining the nullifying magnetic field for the respective X-axis and Y-axis sensors 10&#39; and 10 to offset and nullify the effect of the deviating vehicle magnetic field on the sensors. This algorithm is embodied in the program (see FIG. 7) of the microcomputer 38 which will be described subsequently. 
     The manner in which the compass is compensated for deviation due to the vehicle magnetic field will be described, in general, with reference to FIGS. 5A and 5B. With the compass represented in FIG. 4 installed in the vehicle 26, as described With reference to FIG. 3, the output signal of the sensor 10 as it is applied through AC coupling to the input of the A/D converter 42 is represented by the waveform V cy  in FIG. 5A. This signal V cy  has an offset component D y , prior to deviation compensation, which is of constant value and produced by the Y-axis component of the vehicle field. The Y-axis output signal V cy  has an alternating component E Y  which is produced by the earth magnetic field in accordance with the direction heading of the vehicle 26. The component E Y  varies in a sinusoidal manner as shown in FIG. 5A relative to the signal level D y  as the vehicle is driven through various directions relative to magnetic north. The waveform V cy  of the Y-axis output signal may be produced over a relatively short time period or a long time period; it is depicted in FIG. 5A without regard to time. The output signal, instead, is plotted as a function of vehicle direction. When the vehicle is headed in the direction of magnetic north, the output signal V.sub. cy is at its maximum value V cymax  and when it is headed in the magnetic south direction it is at a minimum value, V cymin . When the heading is either west or east, the value of the Y-axis signal V cy  is at the value of the deviation component D Y  which is half way between the maximum and minimum values. 
     It is required to determine the current in the deviation offset strap 18 for nullifying the Y-axis component of the deviating magnetic field. For this purpose, the A/D converter 42 is set with a full-scale range of reading capability which is equal to or slightly greater than the maximum value of the earth field component E Y  which occurs within the geographical range, such as the North American continent, in which the vehicle may be operated. This full scale range of the A/D converter 42 is represented by the signal voltage level designated A/D in FIG. 5A. The operation of the compass circuit to achieve the deviation offset current in strap 18 of the sensor 10 will be described subsequently. 
     In a manner analogous to that described above for the Y-axis output signal of sensor 10, with reference FIG. 5A, the X-axis sensor 10&#39; produces an X-axis output signal V ex  as depicted in FIG. 5B. It is noted that this signal V ex  has a component D x  which is constant as a result of the X-axis component of the deviating vehicle field. It also has an alternating component E x  due to the earth field which varies in accordance with the direction heading of the vehicle. However, the alternating component, while varying in a sinusoidal manner, is ninety degrees out-of-phase with the variable component E Y  in the output signal of the Y-axis sensor 10. It is noted that the deviation component D x  of the output signal V ex  of the X-axis sensor 10&#39; is typically different in magnitude from the deviation component D Y  of the output signal V cy  of the Y-axis sensor 10; the relative magnitudes depend upon the direction of the vehicle magnetic field vector M v  and they are equal to each other only when the vector is at forty-five degrees or an odd multiple thereof relative to the longitudinal axis of the vehicle. On the other hand, the alternating component E x  in the X-axis sensor output signal V ex  has the same amplitude as the alternating component E Y  the output signal V EY  of the Y-axis sensor 10. As indicated in FIG. 5B, the full scale range of the A/D converter 42, designated by the signal level A/D, is the same for the sampling of both the Y-axis and X-axis output signals by the A/D converter 42. 
     The operation of the electronic compass will now be described with reference to FIGS. 4, 5A, 5B, 6 and 7. An accurate determination of the vehicle magnetic heading can be made only if the influence of the deviating magnetic field of the vehicle is nullified. When such nullification is achieved, the Y-axis and X-axis output signals correspond only to the components of the earth magnetic field and can be combined in a known functional relationship to determine the direction of the magnetic north vector. The operation of the magnetic compass for achieving nullification of the deviating magnetic field, for deviation compensation of the compass, will now be described. 
     A timing diagram depicting the operation for nullification of the deviating vehicle magnetic field and measurement of the earth magnetic field is shown in FIG. 6. The sensors 10 and 10&#39; are alternately operated in the set mode and the reset mode simultaneously with each other under timing control signals from the microcomputer 38. In particular, the bias current straps 16 and 16&#39; of sensors 10 and 10&#39;, respectively, are connected in series and are energized with the same current pulse in the reset direction for a reset period, say five milliseconds, and are energized with the same current pulse in the set direction for a set period, say five milliseconds. During the reset mode, as indicated in FIG. 6, the output signal of the X-axis sensor 10&#39; is measured by the A/D converter 42. Initially, as indicated in FIG. 5B the amplitude of the output signal V ex  is greater than the full scale of the A/D converter. As a result of such measurement, the microcomputer 38 produces an output signal to the D/A converter 44 which causes it to produce an increment of deviation offset current having a polarity, in the deviation offset current strap 18&#39; of the sensor 10&#39;, such that it nullifies an increment of the X-axis component of the vehicle deviating field. Further, as shown in FIG. 6, during the set mode, the output signal of the Y-axis sensor 10 is measured by the A/D converter 42. Initially, as indicated in FIG. 5A, the value of the output signal V ey  will be greater than the full scale of the A/D converter. As a result of this measurement, the microcomputer 38 will provide a control signal to the D/A converter 44 to produce an increment of deviation offset current in the offset current strap 18 of the Y-axis sensor 10 with a polarity such that it nullifies an increment of the Y-axis component of the vehicle deviating field. Next, as indicated in FIG. 6, the output signal of the y-axis sensor 10 is measured during the reset cycle. Following that, the output signal of the X-axis sensor 10&#39; is measured during the set mode and then it is measured during the reset mode. For each output signal measurement which determines that the signal magnitude is greater than the full scale of the A/D converter 42, the current in the corresponding deviation offset current strap 18 or 18&#39; is incrementally increased. This process continues until the deviation offset current in the current strap 18 of the Y-axis sensor is at a level within the full scale of the A/D converter 42 which is of such value that the Y-axis component of the vehicle deviating field is substantially nullified. The same is done with respect to the X-axis sensor. In this condition, the values of the Y-axis output signal and the X-axis output signal correspond accurately to the earth magnetic field for the particular vehicle headings during which measurements are made. The deviation compensation process is continuous during vehicle operation; the first cycle of compensation is completed when the vehicle has turned through a full circle from any arbitrary starting point. Turning of a full circle is indicated by the occurrence of the peak values V eymax  and V eymin  corresponding to the maximum and minimum output signals of the Y-axis sensor and the occurrence of V exmax  and V exmin  corresponding to the maximum and minimum values of the output signals of the X-axis sensor. 
     FIG. 7 is a flow chart representing the program of the microcomputer 38. At block 100, the execution of the program is started and it proceeds to block 102 which reads the output signal of the X-axis sensor 10&#39;. In block 104 the program determines whether the value of the X-axis signal is within the full scale range of the A/D converter 42. If it is not, the program advances to block 106 which determines whether the value of X is greater than the full scale of the A/D converter 42. If it is, block 108 increases the nullifying field in the -X direction and the program loops back to block 102. If block 106 determines that X is not greater than the full scale, block 112 increases the nullifying field in the +X direction and the program loops back to block 102. 
     If at block 104 it is determined that the measured value of X-axis output signal is within the full scale range of the A/D converter 42, the program advances to block 144 which reads the measurement of the output signal of the Y-axis sensor 10. Then, block 116 determines whether the value of the Y-axis signal is within the full scale range of the A/D converter 42. If it is not, block 118 determines whether the value is greater than the full scale range. If it is, block 122 increases the nullifying field in the Y-axis sensor 10 in the -Y direction. Then, the program loops back to block 102. If at block 118 it is determined that the output signal of the Y-axis sensor is not greater than the full scale range of the A/D converter, block 124 increases the nullifying field of the Y-axis sensor in the +Y direction and the program loops back to block 102. This program execution is continued until at block 104 it is determined that the X-axis output signal is within the full scale range of the A/D converter 42 and further it is determined at block 116 that the output signal of the Y-axis sensor is within the full scale range. Then, the program advances to block 126 which determines whether the maximum value or positive peak of the output signal of the X-axis sensor 10&#39; has been identified. If it has not, the program loops back to block 102. If it has, the program advances to block 128 which determines whether the minimum value or negative peak of the output signal of the X-axis sensor has been identified. If it has not, the program loops back to block 102; if it has, the program advances to block 132. Block 132 determines whether the maximum value or positive peak of the output signal of the Y-axis sensor has been identified. If it has not, the program loops back to block 102. If it has, the program advances to block 134. Block 134 determines whether the minimum value or negative peak of the output signal of the Y-axis sensor has been identified. If not, the program loops back to block 102. If it has, it is determined that the deviation compensation procedure has completed a full cycle. 
     In this state, the X-axis and Y-axis output signals correspond substantially to the earth magnetic field and are suitable for computing the magnetic heading of the vehicle. It will be understood that the process described is repeated continuously and adjusts the deviation compensation in accordance with changes in the vehicle magnetic field that may occur and to continually enhance the accuracy of the heading indication. When the block 134 determines that a full cycle of deviation compensation has been executed, the program advances to block 136 which computes the magnetic heading of the vehicle. Then, block 138 adds a stored value of variation compensation to obtain the true heading of the vehicle. The true heading is displayed for the information of the vehicle driver by block 142. 
     The circuit of the electronic compass is shown in the schematic diagrams of FIGS. 8, 9, 10A, 10B and 11. FIG. 8 shows the Y-axis signal channel 202 for developing the output signal V ey  from the output sensor 10. The bridge circuit of the sensor 10 is excited with a D/C voltage V cc . The output of the bridge circuit is supplied to the input of a first stage amplifier 204 which provides a voltage gain of about ten or twelve. The amplified output is applied through an AC coupling capacitor 206 to the input of a second stage amplifier 208 which provides a gain of about twenty. The output of the amplifier 208 is applied through an AC coupling capacitor 212 to a terminal 214 for application of the signal V ey  to the circuit shown in FIG. 10A which will be described presently. 
     The X-axis channel 222 for developing the output signal V ex  from the output sensor 10&#39; is shown in FIG. 9 and is similar to that of FIG. 8. The bridge circuit of the sensor 10&#39; is excited with the DC voltage V cc . The output of the bridge circuit is supplied to the input of a first stage amplifier 224 which provides a voltage gain of about ten or twelve. The amplified output is applied through an AC coupling capacitor 226 to the input of a second stage amplifier 228 which provides a gain of about twenty. The output of the amplifier 228 is applied through an AC coupling capacitor 232 to a terminal 234 for application of the signal V ex  to the circuit shown in FIG. 10A which will be described presently. 
     FIGS. 10A and 10B taken together form a schematic diagram of the electronic circuits, including the microcomputer 38, which are coupled with the circuits of FIGS. 8 and 9 described above and the circuit of FIG. 11 which will be described below. The microcomputer 38 is, in the illustrative example, an eight bit microprocessor type COP881C available from National SemiConductor, Inc. of Palo Alto, Calif. As shown in FIG. 10A, the microcomputer 38 is provided with a reset circuit 242 of conventional design coupled with the pins V cc , Reset and Ground as indicated. The microcomputer is also provided with a clock circuit 244, also of conventional design, and connected with the pins CK1 and CK0. As shown in FIG. 10B, the microcomputer 38 is coupled with an EEPROM 246 at pins G1, G5, G4, and G6. The EEPROM 246 serves as a permanent memory for data to be stored when the power to the electronic circuit is interrupted. A compass heading display 248, such as a vacuum fluorescent display, is coupled to pins G5, G4 and G6. Referring again to FIG. 10A, a manual switching circuit 252 is coupled with microcomputer pins 10, 11, 12 and 13. A manual switch 254 is provided for use in connection with compensating the compass for variation. Also, a manual switch 255 is shown for changing the brightness of the display 248 but automatic means could be provided. The remaining circuits associated with the microcomputer 38, which will be described presently, are operative to control the sensors 10 and 10&#39; and to process the output signals thereof to provide deviation compensation and to develop the heading direction signals. The heading is presented in alphanumeric form on the display 248 to indicate the cardinal and intercardinal compass points heading to the vehicle driver. 
     A driver circuit 282 for the set/reset current straps 16 and 16&#39; of the sensors 10 and 10&#39; is shown in FIG. 11 The switching signal for the driver circuit 282 is produced by the microcomputer 38 at output pin D0 and applied to the input terminal 284. The driver circuit 282 comprises a pair of Darlington transistors 286 and 288 which are alternately switched conductive and non-conductive in response to the switching signal on connector 284. Accordingly, the current straps 16 and 16&#39; are energized with current pulses as shown in the timing diagram of FIG. 6 and described above to provide the set and reset modes for the sensors 10 and 10&#39; for the measurement of the Y-axis sensor output signal and X-axis sensor output signal, respectively. 
     As shown in FIG. 10A, the multiplexer 52 receives the Y-axis sensor output signal at terminal 214 and receives the X-axis sensor output signal at terminal 234. The multiplexer 52 is provided with an address signal from the data output pins D1 and D2 of the microcomputer 38 which is applied to pins A and B of the multiplexer 52. Thus, output signals of the Y-axis and X-axis sensors 10 and 10&#39; are accessed alternately in timed relation with the set and reset modes as described with reference to FIG. 6. The sensor output signals are alternately outputted through pin 0/1 of the multiplexer to the A/D converter 42 shown in FIG. 10A. The A/D converter includes a comparator 256 which has its inverting input connected with the 0/1 output pin of the multiplexer 52. The non-inverting input of the comparator 256 is connected with the output of a ramp generator 258 which receives a pulsed input from pin D3 of the microcomputer 34. A clamp circuit 262 is coupled with the ramp generator 258 and clamps the ramp generator output at a certain voltage level so that the output does not go all the way to ground after each ramp which would require a time delay on build-up to the ramp reference voltage. The comparator 256 is operated with a reference voltage, for example, of about 2.5 volts on the non-inverting input. The A/D converter has a full scale range of 2.0 volts above the reference and, for example, the clamp voltage is about 2.3 volts. The ramp voltage is incremented at the rate of one millivolt per microsecond and the pulse count required to reach the signal voltage level at comparator 256 is stored in a register and represents the measured value of the sensor voltage applied to the A/D converter at comparator 256. The pulse count register indicates when the signal measurement is greater than the full scale range of the A/D converter 42. 
     As shown in FIG. 10B, the D/A converter 44 is coupled with output pins L0 through L7. The D/A converter 44 is a ladder network known as an R2R network and, for example, develops an output voltage of 2.5 volts at a register count of 127. The output of the D/A converter is applied through a voltage-to-current converter comprising amplifiers 262 and 266. The current amplifier 266 develops the offset current supply at connector 268 for the offset current straps 18 and 18&#39; which are shown in FIG. 10A. The offset current return circuit 272 of FIG. 10A comprises an amplifier 274 which has its non-inverting input coupled with pin 2 of the multiplexer 52. The output of the amplifier 274 provides the offset current return at the terminal 276. The operation of the A/D converter 42 and the D/A converter 44 for developing the offset current required to provide deviation compensation is described above with reference to FIGS. 5A and 5B. 
     Although the description of this invention has been given with reference to a particular embodiment, it is not to be construed in a limiting sense. Many variations and modifications will now occur to those skilled in the art. For a definition of the invention, reference is made to the appended claims.