SHAFT ANGLE ENCODER INTERFACE

Abstract: A shaft angle encoder interface for quadrature channel incremental shaft angle encoders utilises a quadrature decoder/counter interface integrated circuit (30) for providing a digital signal output representative of the angle. The digital signal output is provided by a high byte and low byte multiplexer (18). The integrated circuit (30) includes inhibit logic (21) for inhibiting updating the data when the output is read. A state machine (32) controls latches (34,35) that receive the high byte and low byte to assemble an output digital angle signal and provides control signals to the integrated circuit so that the inhibit mode is not activated.

Description: The invention relates to an interface apparatus for an incremental shaft angle encoder, with particular reference to incremental shaft angle encoders having quadrature channel outputs. Shaft angle encoders are utilised to measure the angular position of a rotating shaft. For example, the angle of a rotating antenna shaft with respect to a reference point in a radar system is utilised to display radar targets at the appropriate display bearings. Such shaft angle encoders may be of the incremental optical type that provide quadrature square waves and a reference pulse which are decoded to indicate the shaft angle. The reference pulse may be utilised to provide an azimuthal reference at, for example, 0° from which shaft rotation is measured. The reference pulse occurs once every 360°. The quadrature square waves relate to the rotation of the shaft with respect to angular position and direction of rotation. The quadrature square waves are generated optically by a rotating code wheel in the optical shaft angle encoder. Two tracks of radial slits on the rotating code wheel generate the quadrature square waves. Each of the tracks is comprised of alternating slits and opaque areas of equal width, one track being displaced 90° with respect to the other track. Light passing through the slits on the rotating code wheel impinge upon photodetectors associated with each of the tracks, thereby generating voltages. Since the code wheel is rotating, the photodetectors receive alternating periods of light and dark thereby generating the quadrature square waves The reference pulse is generated by a slit on the rotating code wheel at a reference position. The amount of rotation can be determined by counting the number of transitions from zero to a positive voltage and the direction of rotation is decoded by processing the quadrature square waves. Thus, the angular position of the shaft is encoded by the shaft angle encoder as square waves out-of-phase with respect to each other by 90°. These quadrature channel square waves require decoding to provide the angular resolution. Such shaft angle encoders require interface electronics to convert the quadrature square waves into a digital angle for use in the system. For example, in a radar display system, the digital angle may be utilised by the video system for positioning the radar targets at the proper bearings. The interface logic required to accomplish the decoding conversion from quadrature square wave channels to a digital angle utilising logic chips, such as gate arrays or discrete logic devices can be extensive, and hence very expensive, particularly with respect to determining the direction of rotation. Alternatively, integrated circuits are available for decoding quadrature channels when interfaced with a microprocessor. A chip of this type is available from the Hewlett Packard Company as the Quadrature Decoder/Counter Interface IC denoted as the HCTL-2000. Technical data sheets dated October 19, 1985 for the HCTL-2000 are available from Hewlett Packard. The HCTL-2000 decodes quadrature square waves and provides a 12 bit digital angle when interfaced with a microprocessor which provides control signals to the HCTL-2000. The use of the microprocessor is undesirable because of the excessive cost and board real estate required therefore. The microprocessor requires extensive source code assembly language preparation which must be downloaded into program memory. Since the microprocessor must be programmed to effect its control and decoding functions, the cost of the software and the cost of the microprocessor adds an undesired expense to the system. A further disadvantage of the quadrature channel decoding chip-microprocessor interface is that chips such as the HCTL-2000 have an internal inhibit mode that is automatically enabled during the time that the digital angle is read from the chip output. During enablement of the inhibit mode, the inhibit logic latches the current angle preventing updating from the shaft angle encoder of the chip output angle. Although the angle from the shaft angle encoder may change during the inhibit mode, the output digital angle signal from the HCTL-2000 is not changed until the inhibit mode is reset. Because the updating of the angle information is limited with such systems, the display generally lags some incremental angular error behind the actual shaft position. Although the data is maintained stable during the readout period, the accuracy of the system is adversely affected since the data transfer rate of the system is reduced. It is appreciated, however, that that HCTL-2000 up/down counter can continue to update the quadrature states. The information, however, is not made available until exiting from the inhibit mode. This may cause angle information data jumps rather than providing continuously updated data. The present invention is defined in the appended claim 1. Particular embodiments are outlined in the dependent claims. In essence, a state machine, preferably implemented by a programmable logic device (PLD)is provided to control an integrated circuit such as the quadrature channel decoding chip HCTL-2000. The state machine provides an updated digital angle every data sample time thereby disabling the decoding chip inhibit mode. The angular data is updated at the fastest possible rate and the cost and amount of hardware required to transform the shaft angle encoder output into a digital angle is minimised. The invention minimises the system cost by utilising the state machine to drive the HCTL-2000 instead of the microprocessor for which the HCTL-2000 was designed. PLD's are less costly than microprocessors and do not require the writing of extensive source code programming as do microprocessors. The state machine provides an updated digital angle at a substantially faster rate than the microprocessor interfaces. An embodiment of the present invention will now be described in greater detail, by way of example, with reference to the accompanying drawings, in which:- Figure 1 is a graph of quadrature square waves and the reference pulse generated by an incremental shaft angle encoder, with the reference pulse processed in accordance with the present embodiment of the invention also being illustrated, Figure 2 is a schematic block diagram of the HCTL-2000 chip, Figure 3 is a timing diagram of the operation of the HCTL-2000 chip, Figure 4 is a schematic block diagram of the shaft angle encoder interface implemented in accordance with the present embodiment of the invention, Figure 5 is a state machine timing diagram of the apparatus of Figure 4, and Figure 6 is a timing diagram illustrating the reset pulse waveshaping aspect of the apparatus of Figure 4. Referring to Figure 1, the quadrature channel square wave outputs of the shaft angle encoder are illustrated. The output denoted as channel A leads the angular position by 45° and the output designated as channel B lags the angular position by 45°. Thus, the channel B square wave output is in quadrature with the channel A square wave output. The channel A and channel B voltage levels represent four cyclically repeated states denoted as 1, 2, 3 and 4. In state 1, channel A is binary ONE and channel B is binary ZERO. In state 2, both channels are binary ONE. In state 3, channel A is binary ZERO and channel B is binary ONE and in state 4, both channels are binary ZERO. The incremental position of the encoder is tracked by detecting transitions in the state and incrementing or decrementing an up/down counter to provide a digital readout of the angle. The direction of rotation is decoded by comparing the previous state to the current state and controlling the counter accordingly. For example, the counter is controlled to count up for state transitions in the order 1, 2, 3, 4, 1, etc. and is controlled to count down for state transitions in the order 1, 4, 3, 2, 1, etc. Figure 1 also illustrates the reference pulse which is utilised to reset the up/down counter to zero. Typically, the reference pulse spans one cycle of the channel A and channel B square waves. In a manner to be explained, the reference pulse is processed to provide a processed reference pulse as illustrated so that the angle is held at zero for one count instead of four counts. Referring to Figure 2, a schematic block diagram of the HCTL-2000 chip utilised in the present embodiment is illustrated. The chip includes a digital filter 10 to reduce noise and decode logic 11 to decode the quadrature square waves from the shaft angle encoder into a digital angle at output D₀-D₇. The quadrature square waves from the encoder are applied at CH A (channel A) and CH B, (channel B), respectively. to the digital filter 10 through Schmitt trigger inputs 12 and 13. The digital filter 10 is configured to provide a new output for each channel if the input level has had the same value on three consecutive rising clock edges. Otherwise, the output of the filter 10 remains unchanged. In this manner, noise is rejected from the incoming quadrature signals. The channel A and channel B outputs from the filter 10 are applied to decode logic 11 directly and through respective D-flip-flops 14 and 15 so that the decode logic 11 receives the previous sampled state and the current sampled state. If the two states are different, the decode logic 11 provides a count signal CNT and an up/down signal UP/DN to a twelve-bit binary counter up/down counter 16. As discussed above with respect to Figure 1, the counter 16 is incremented or decremented when the previous sampled state of the quadrature square waves is different from the current state and the direction of count is controlled by comparing the states. The twelve bit angle output of the counter 16 is applied to a twelve-bit latch 17 which provides an eight-bit byte (high byte) and a four-bit byte (low byte) to an octal two-byte multiplexer buffer 18. The buffer 18 output D₀-D₇ provides the resulting digital angle. The angle is read in two sequential bytes (high byte and low byte) to provide a twelve bit result. The output enable input ( OE ) controls the chip readout and the select input (SEL) controls the readout of the high byte and the low byte. A clock signal CLK is applied through a Schmitt trigger input 19 to provide the clock input CK which controls the sampling of the OE and SEL lines as well as controlling the operation of the digital filter 10, the D-flip-flops 14 and 15, the counter 16 and the latch 17. The reference pulse from the shaft angle encoder is applied at RST through a Schmitt trigger input 20 to reset the angle to zero. The reset pulse clears the counter 16 and the latch 17. The HCTL-2000 chip includes inhibit logic 21 for inhibiting data entry into the latch 17 when the buffer 18 is in the process of being read out. Thus, during this time, changes in the angle data in the counter 16 are not displayed. The inhibit logic 21 provides the inhibit signal to the latch 17 when OE , SEL and CK are simultaneously low. The following illustrates a typical cycle of operation of the HCTL-2000 chip. Referring to Figure 3, with continued reference to Figure 2, a timing diagram for the HCTL-2000 chip is illustrated. The following actions are referenced to the encircled numerals on Figure 3. Action 1. On the rising edge of the clock, data from the counter 16 is transferred to the position data latch 17, provided the inhibit signal is low. Action 2. When OE goes low, the outputs of the multiplexer 18 are enabled onto the data lines D₀-D₇. If SEL is low, the high order data bytes are enabled onto the data lines. If SEL is high, the low order data bytes are enabled onto the data lines. Action 3. When the HCTL-2000 detects a low on OE and SEL during a falling clock edge, the internal inhibit signal is activated. This action blocks new data from being transferred from the counter 16 to the latch 17. Action 4. When SEL goes high, the data outputs change from high byte to low byte. Action 5. A first condition for resetting the inhibit logic 21 is satisfied when the HCTL-2000 detects a logic high on SEL and a logic low on OE during a falling clock edge. Action 6. When OE goes high, the data lines change to a high impedance state. Action 7. To complete the reset of the inhibit logic 21, after the first reset condition has been satisfied, the HCTL-2000 requires a logic high on OE during a falling clock edge. It will be appreciated that in prior art use of the HCTL-2000 chip, the shaft angle encoder provides the CH A, CH B and RST signals. A microprocessor (not shown) provides CLK, SEL and OE and receives the sequentially provided high byte and low byte on the data lines D₀-D₇ so as to format a twelve-bit digital angle. Software must be written for, and loaded into, the microprocessor to control providing and receiving these signals and to operate the HCTL-2000 in accordance with the timing diagram of Figure 3. Such software is complex, extensive and expensive and in addition the microprocessor imposes an undesirable expense and board real estate requirement on the system. Referring to Figure 4, a schematic block diagram of the shaft angle encoder interface of the present embodiment of the invention is illustrated. The interface includes and HCTL-2000 chip 30 coupled to receive the lead and lag quadrature channel signals from the shaft angle encoder at pins 6 and 7 thereof. The CLK input to the HCTL-2000 is applied at pin 2 thereof from a 13 KHz clock source provided by the system at a terminal 31. The HCTL-2000 receives the SEL and OE signals at pins 3 and 4 thereof respectively. These controls signals are generated by a state machine 32 preferably implemented by an EP310 PLD commercially available, for example, from the Altera Corporation. The EP310 also provides the reset pulse RST to the HCTL-2000 at pin 5 thereof, in a manner to be described. The chip outputs of the HCTL-2000 D₀-D₇ are provided at the output pins illustrated and are applied to an eight-bit parallel bus 33. The bus 33 is connected in parallel to the inputs of a high-byte latch 34 and to the inputs of a low-byte latch 35. The latches 34 and 35 sequentially receive the high byte and the low byte from the HCTL-2000 to assemble a twelve-bit digital angle on a bus 36. The latches 34 and 35 are preferably implemented by 74LS273 chips available, for example, from Texas Instruments, Incorporated. The latches 34 and 35 are controlled by the EP310 in a manner to be described. The digital angle output on the bus 36 is provided to the system under control of an azimuth ready signal AZREADY on a line 37. The interface output is schematically represented by an Angle Bus Out block 38 under control of the AZREADY signal to provide the interface angle on an output bus 39. The OE signal from the EP310 provides the azimuth ready signal so that bus reads are disabled during the time the HCTL-2000 is transferring the high and low bytes to the latches 34 and 35. The EP310 receives a 3.36 MHz system clock at pin 1 thereof and also receives the 13 KHz clock from the terminal 31 at pin 11 thereof. The 13 KHz clock is utilised as a READ signal by the EP310 to provide a digital angle sample. Pins 2 and 3 of the EP310 are connected to logic ONE for internal gating purposes. A signal BRESET is coupled to the EP310 as well as to the latches 34 and 35 to reset these components when the system in which the interface is utilised issues a board reset pulse for clearing the interface. The D₀ signal from the HCTL-2000 is applied to pin 8 of the EP310 and is utilised therein to generate an azimuth change pulse signal on a line 40 whenever the least significant bit of the digital angle changes. The azimuth change pulse signal on the line 40 is utilised for timing and control purposes within the system in which the interface of Figure 4 is utilised. The reset pulse from the shaft angle encoder is applied to a parallel output serial shift register implemented, for example, by a 74LS164 integrated circuit chip 41 available from, for example, Texas Instruments, Incorporated. The 74LS164 is coupled to the EP310 for processing the reset pulse to thereby provide RST to the HCTL-2000. Processing is effected to convert the reset pulse that spans four counts of the shaft angle encoder to the RST pulse that occurs for one count at 0° of the encoder. The 74LS164 is clocked by the 13 KHz signal from the terminal 31 and is reset by the board reset pulse BRESET . The state machine 32 generates the SEL, OE and RST signals for the HCTL-2000 as well as signals HI and LO for the latches 34 and 35, respectively, in response to the 13 KHz READ pulse from the terminal 31 and the 3.36 MHz clock. The timing for the operation of the state machine 32 is illustrated in Figure 5. The programming equations utilised to implement the state machine 32 are as follows:- The timing diagram of the EP310 is illustrated in Figure 5 and corresponds to the truth table set forth above. It will be appreciated, however, that the outputs of the EP310 include inversions that provide the outputs inverted with respect to the waveforms illustrated in Figure 5. During operation, the EP310 is controlled to operate in seven states S1-S7 and in a state PU (Power Up) when the system is first energised. A dummy variable RIDER is included to distinguish between the states S1 and S6. The state machine 32 enters state S1 under control of the 3.36 MHz clock when the 13 KHz READ signal goes high. In state S1, the state machine 32 is programmed to output SEL low and OE , HI and LO high. With OE high, the HCTL-2000 outputs D₀-D₇ are in the high impedance state. At the next 3.36 MHz clock pulse, the state machine 32 is programmed to enter state S2. During S2, SEL and OE are low and HI and LO are high. With OE low, the outputs D₀-D₇ of the HCTL-2000 are enabled. Since SEL is in the low state, the HCTL-2000 outputs the high byte onto the bus 33. On the occurrence of the next 3.36 MHz clock pulse, the state machine 32 enters the state S3. During S3, the HI signal is changed to the low state and latches the high byte on the bus 33 into the latch 34. Upon the occurrence of the next high frequency clock pulse, state S4 is entered which changes the state of the SEL signal and returns the HI signal to high. With SEL and OE as issued by the EP310 to the HCTL-2000 during state S4, the low byte is placed on the D₀-D₇ outputs of the HCTL-2000 and thus onto the bus 33. The next occurring high frequency clock pulse places the state machine 32 into state S5 for providing the LO pulse to the latch 35 thereby latching the low byte therein. The next occurring high frequency clock pulse advances the state machine 32 to the S6 state which turns off the LO signal as well as the OE signal thereby returning the HCTL-2000 outputs D₀-D₇ to the high impedance state. When OE goes high in state 6, the AZREADY signal on the line 37 is placed into its active state thereby permitting readout of the digital bus angle from the latches 34 and 35 onto the bus 39. It will be appreciated that during states S2-S5, when the latches 34 and 35 are being loaded, the AZREADY signal is in the inactive state, thereby disabling bus reads. When the 13 KHz READ signal goes low, the state machine 32 transitions from S6 to S7 and remains in state S7 until the next rising edge of the READ clock. When READ occurs in state S7, the state machine 32 enters the S1 state to commence reading another sample of the digital angle. On power up of the equipment, the state machine 32 is placed into the PU state and remains in this state until the first occurring rising edge of the 13 KHz READ clock. When READ occurs, the state machine 32 enters state S1. The reset pulse from the shaft angle encoder ( RSTi ) is processed by the EP310 via the 74LS164 to provide the RST pulse ( RSTq ) to the HCTL-2000. The RST waveshaping is illustrated in Figure 6. It is appreciated that by the shift register action of the 74LS164 and the appropriate programming of the EP310, the shaft angle encoder reset pulse that spans four counts is converted to a reset pulse that spans one count and occurs at precisely 0°. If the RST pulse were not processed, the angle on D₀-D₇ from the HCTL-2000 would be held at zero for four counts instead of one. Thus, with the reset pulse processing the azimuth count is zeroed every time the shaft rotates through 0° and then recommences counting thereafter. The processing occurs by gating the RST signal through the 74LS164 and causing the signal RSTq of the EP310 to be high when the following conditions with respect to the 74LS164 occur: Q D = 1, Q C = 0, Q B = 0, Q A = 0 and RSTi = 0. When this occurs, the reset ( RSTq ) is held low for one only one count. It will be appreciated with respect to Figures 2 and 3, that the conventional application of the HCTL-2000 requires a readout that spans a large number of the 13 KHz clock pulses. Thus conventionally, the HCTL-2000 is placed into the inhibit mode for significant periods of time. A comparison with Figure 5 illustrates that the embodiment according to the present invention provides an angle sample for each one of the 13 KHz clock pulses and takes the sample when the clock is high. Since a sample is never taken when the 13 KHz clock is low, the inhibit mode of the HCTL-2000 is never entered. Thus, the state machine of the present embodiment controlling the HCTL-2000, latches the digital angle at a rate not requiring the use of the inhibit mode. This fast update permits the digital angle to be read and updated continuously. The embodiment of the invention utilises a state machine implemented by a programmable logic device to drive the HCTL-2000 in contrast to the prior art utilisation of a microprocessor. PLDs are less costly than microprocessors and do not require down loading of assembly language as do microprocessors. Additionally, microprocessors require far greater board real estate than do PLDs. The shaft angle encoder interface invention provides a twelve-bit digital angle from a shaft angle encoder with minimal cost and hardware. In addition to the above, the present embodiment of the invention permits greater than 20% tolerance in the quadrature channels as compared to a tolerance of 12% as obtained in the prior art. This results from the high sampling rate obtained utilising the 3.36 MHz clock.

Claims: Interface apparatus for an incremental shaft angle encoder for measuring the angular position of a shaft, the encoder providing two alternating signals phase displaced with respect to each other, and the interface apparatus providing an output digital angle signal in accordance therewith representative of said angular position, characterised in that the apparatus comprises:- a low frequency clock for providing a low frequency clock signal, a high frequency clock for providing a high frequency clock signal, an integrated circuit (30) responsive to the alternating signals and to the low frequency clock signal for providing a digital signal in accordance with the alternating signals representative of the angular position, the integrated circuit being responsive to control signals including an output enable signal for controlling outputting the digital signal, the low frequency clock signal being utilised to sample the alternating signals and to time the integrated circuit, and a state machine (32) responsive to the low and high frequency clock signals for outputting a sequential plurality of states providing the control signals to the integrated circuit in response to the low frequency clock signal, the states being sequenced by the high frequency clock signal, the digital signal providing said output digital angle signal. Apparatus according to claim 1, characterised in that the integrated circuit (30) includes inhibit logic (21) for inhibiting updating the digital signal in accordance with changes in the alternating signal outputs, the state machine outputting said states in response to the low frequency clock signal so that the inhibit logic is not enabled. Apparatus according to claim 1 or 2 for incremental shaft angle encoders of the type where the alternating signals are square waves in quadrature with respect to each other, characterised in that the integrated circuit (41) includes:- an up/down counter (16), digital logic (11) responsive to the quadrature square waves for controlling the counter to increment in an upward or downward direction in accordance with changes in relationship between the quadrature square waves, latch means (17) for latching the output of the counter, the latch means being responsive to the inhibit logic for inhibiting latching the counter output therein, and multiplexer means (18) responsive to the latch means for sequentially providing a first byte and a second byte comprising the digital signal, the control signals including a select signal (SEL) for selecting between the first byte and the second byte. Apparatus according to claim 3, characterised in that it further includes a first byte latch (34) and a second byte latch (35) responsive to the multiplexer means (18) for receiving and latching the sequentially provided high byte and low byte, respectively, the sequential plurality of states including (state 1): the output enable signal and the select signal to load the first byte into the multiplexer, (state 2): the output enable signal and a strobe signal to the first byte latch, (state 3): the output enable signal and the select signal to load the second byte into the multiplexer, (state 4): the output enable signal and a strobe signal to the second byte latch, said first and second byte latches providing the output digital angle signal. Apparatus according to claims 3 or 4, characterised in that the integrated circuit (30) is designed to sample the quadrature square waves on a first polarity edge of the low frequency clock signal and to activate the inhibit logic on the other polarity edge of the low frequency clock signal, and the state machine (32) is designed to provide the control signals to the integrated circuit in response to the first polarity edge of the low frequency clock signal. Apparatus according to any of claims 3, 4, or 5, characterised in that the apparatus further includes reset pulse waveshaping means for providing a reset pulse spanning only one count of the counter (16) in response to a reference pulse provided by the encoder, which spans a plurality of counts of the counter (16). Apparatus according to claim 6, characterised in that the reset pulse waveshaping means comprises:- shift register means responsive to the reference pulse and the low frequency clock signal for providing a sequence of pulses in response thereto, the state machine (32) including means responsive to the shift register means for providing the reset pulse. Apparatus according to any of the preceding claims, characterised in that the integrated circuit comprises an HCTL-2000 and the state machine comprises an EP310. Apparatus according to claim 4 or to any of claims 5 to 8 when appended to claim 4, characterised in that the first and second byte latches each comprise a 74LS273. Apparatus according to claim 7 or to any of claims 8 or 9 when appended to claim 7, characterised in that the shift register means comprises a 74LS164.

Inventors: BAGINSKI, MARK J.
Applicants: SPERRY MARINE INC.
Application year: 1989
Main classification: G01B7
IPC codes: G01D5, G01P9, H03M1