Digital frequency detector
RELATED APPLICATIONS 
     This application is related to the co-pending application entitled AUTOMATIC/REMOTE RF INSTRUMENT READING METHOD AND APPARATUS, filed on Feb. 20, 1985 and identified by Ser. No. 703,621 and to the co-pending application entitled IMPROVED AUTOMATIC/REMOTE RF INSTRUMENT MONITORING SYSTEM, filed in the U.S. Patent and Trademark Office on Mar. 14, 1986 and identified by Ser. No. 839,889. This is also related to my co-pending application entitled DATA DEMODULATOR, filed in the U.S. Patent and Trademark Office on Apr. 16, 1986 and identified by Ser. No. 852,539 and to the application entitled REMOTELY INTERROGATED TRANSPONDER, filed in the U.S. Patent and Trademark Office on June 1, 1987 and identified by Ser. No. 058,636. 
     TECHNICAL FIELD 
     A digital electronic circuit for detecting the presence or absence of a predetermined, discrete frequency is disclosed. The circuit is especially designed to be implemented in CMOS hardware, or equivalent hardware having extremely low current drain characteristics. 
     BACKGROUND ART 
     The advent of CMOS and other advanced semiconductor technologies has permitted the design of low power consumption digital circuits with current drains in the picoamp region. Heretofore, frequency detection circuits have required the use of band pass filters and other analog components typified by relatively high power consumption characteristics. A circuit that could determine the presence of a predetermined, discrete frequency through digitally implemented logic could take advantage of the new, semiconductor technology and provide a low power frequeny detector. 
     SUMMARY OF THE INVENTION 
     The frequency detector hereof incorporates a completely digital design that can be implemented through CMOS or similar semiconductor technology having low current drain characteristics. The detector indicates the presence or absence of an input signal of predetermined frequency through the combination of a unique, digitally implemented phase locked loop, and a digitally implemented amplitude detector and integrator. The input signal is presented to the detector, through an amplitude comparator or amplitude limiter, as a clipped and squared digital signal. A pulse inserter network in the phase locked loop sets the lock range of the phase locked loop to a predetermined bandwidth for discrimination of a preselected input frequency band. The amplitude detector and integrator provide a detection output signal only after the phase locked loop has locked onto an input signal of the desired frequency for a predetermined validation period. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a schematic, logic diagram of the digital frequency detector in accordance with the present invention; 
     FIG. 2 is a schematic diagram of an amplitude comparator for converting an analog input signal into a digital input signal for presentation to the frequency detector; 
     FIG. 3 is a timing diagram depicting the output of the pulse inserter portion of the detector phase locked loop; 
     FIG. 4 is a timing diagram depicting the output of the detector amplitude comparator, when the detector phase locked loop is locked on an input signal having a frequency equal to the phase locked loop center frequency; and 
     FIG. 5 is a timing diagram depicting the detect output of the detector comparator. 
    
    
     DETAILED DESCRIPTION OF THE DRAWINGS 
     Referring to the drawings, the digital frequency detector 10 in accordance with the present invention broadly includes clock 12, digital phase locked loop 14, amplitude detector 16, integrator 18, comparator 20, and timer circuit 22. An amplitude comparator circuit 24 provides a squared up, digital input signal to input terminal 26 of the frequency detector. 
     Phase locked loop 14 is a first order phase locked loop including a phase detector 28, pulse inserter 30, and feedback loop 32. The pulse inserter 30 and feedback loop 32 function as the digital counterpart to a voltage controlled oscillator in an analog phase locked loop. Phase locked loop 14 receives an input from clock 12 via lead 34. 
     Phase detector 28 of phase locked loop 14 comprises exclusive or gate 35 having one input lead 36 connected to signal input terminal 26, and a second input lead 38 connected to digital VCO 32. 
     Pulse inserter 30 includes and gate 40, asynchronous ripple counter 42, and exclusive or gate 44. The input terminals of and gate 40 are connected to clock 12, and the output of the exclusive or gate 35 of phase detector 28 via leads 34 and 43, respectively. The clocked input of asynchronous ripple counter 42 is connected to the output of and gate 40 via lead 45. The input terminals of exclusive or gate 44 are connected to the clock 12 and the output of asynchronous ripple counter 42 via leads 34 and 46 respectively. 
     Feedback loop 32 comprises asynchronous ripple counter 48 having its clocked input tied to the output of exclusive or gate 44 of pulse inserter 30 via lead 50. Counter 48 provides a ÷N and a ÷N/2 output. 
     The amplitude detector 16 comprises exclusive nor gate 52. The input terminals of exclusive nor gate 52 are connected to the output of the phase locked loop phase detector 28 and the ÷N/2 output of counter 48 via leads 43 and 54 respectively. 
     Integrator 18 comprises and gate 56 and asynchronous up counter 58. The input terminals of and gate 56 are connected to clock 12 and the output of amplitude detector 16 via leads 34 and 60 respectively. The clocked input of counter 58 is connected to the output of and gate 56 via lead 62. 
     Asynchronous up counter 58 is provided with a number of output terminals that change states at various, respective counts. For instance, the logic state presented on leads 64, 66, 68 change at counts that are multiples of 2 n , 2 n+1 , and 2 n+2 , respectively. 
     Comparator 20 includes triple input and gate 70 and or gate 72. The input terminals of or gate 72 are connected to the 2 n  terminal of counter 58 and threshold input terminal 74 by leads 64 and 76, respectively. The input terminals of and gate 70 are connected to the 2 n+1  and 2 n+2  output terminals of counter 58 via leads 66 and 68, respectively, and to the output of or gate 72 via lead 78. The output terminal of and gate 70 is connected to the output terminal 80 of digital frequency detector 10 via lead 82. 
     Timer 22 includes counter 84 and D flip flop 86. The clocked inputs of counter 84 and D flip flop 86 are tied together and connected to the master clock 12 via lead 34. The D input of D flip flop 86 is connected to the output terminal of counter 84 by lead 88. The Q output of D flip flop 86 is connected to the reset terminals of timer counter 84 and integrator counter 58 via lead 90. 
     Referring to FIG. 2, amplitude comparator 24 comprises differential amplifier 92, input terminal 94, reference terminal 96, output terminal 98, coupling capacitor 100, and biasing resistors 102, 104. The amplitude comparator 24 produces a squared up, digital signal (depicted as Vout in FIG. 2) for presentation to frequency detector input terminal 26, from a sinusoidal analog input signal (depicted as V in  in FIG. 2). 
     The function of the phase locked loop 14 will now be described. In general, pulse inserter network 30 responds to the output of phase detector 28 to selectively insert additional pulses into the clock pulse train presentation to counter 48. The addition (or lack of addition) of pulses to the normal clock train input to counter 48 makes the output of feedback loop 32 appear that it can vary in frequency. 
     The detailed operation of phase locked loop 14 is best understood by first considering the instance whre the input signal (F in ) presented to the phase detector 28 and the ÷N output signal (F VCO (÷N)) of counter 48 presented to the phase detector 28 are at the same frequency and exactly lined up in phase. The opposite case will then be considered, wherein the input signal (F in ) and the feedback signal of counter 48 are at the same frequency but exactly opposite inphase. Finally, the intermediate case, wherein the input signal and the feedback signal presented to the phase detector 28 are at the same frequency, but 90° out of phase, will be considered. 
     Given the assumption that the input signal F in  presented at terminal 26, and the ÷N output of counter 48 presented to phase detector 28 are of the same frequency and exactly lined up in phase, the output of exclusive or gate 35 will always be low. This is so because both of the input signals to the exclusive or gate 35 will be low during the same half cycle, and will be high during the same half cycle. The output of exclusive or gate 35 is presented via lead 43 to and gate 40 of the pulse inserter circuitry 14. In the instant case, where the input signal and the feedback signal from counter 48 are of the same frequency and in phase, the output of phase detector 28 is always low and no pulses from the pulse train of clock 12 will be passed through and gate 40 to counter 42. The counter 42 will therefore remain in o ne of its two logic states and will not count. The output of exclusive or gate 44 will be a replica of the clock pulse train, either in phase, or 180° incremented in phase, relative to the clock pulse train, depending on the output logic state of counter 42. 
     The input signal (F in ) presented at terminal 26, and the ÷N output signal of counter 48 presented to the phase detector circuitry 28, were presumed to be at the same frequency and in phase. The numeric value of N for counter 48 is therefore dictated by the master clock frequency (F cl ), with reference to the frequency of the input signal (F in ), such that the clock frequency divided by N equals the frequency of the input signal (F in ). More simply put, counter 48 divides the input clock frequency (F cl ) by the number N, such that F cl  ÷N=F in . 
     The opposite case will now be considered, wherein the input signal (F in ) presented the phase detector 28,. and t he output of the counter (F VCO (÷N)) presented to phase detector 28 are of the same frequency, but exactly opposite in phase. In this case, the output of exclusive or gate 35 of phase detector 28 will always be high, because whenever the input signal (F in ) presented to exclusive or gate 35 of phase detector 28 is high, the digital VCO output (F VCO (÷N)) will be low, and vice versa. The pulse train of the master clock 12 will in this case always be gated into counter 42 of pulse inserter 14, through and gate 40. The output of counter 42 will accordingly change states everytime a number (k) of master input clock pulses are counted by the counter 42. More simply put, counter 42 divides the pulse train presented at its clocked input by k. In the instant case, where the entire pulse train of the clock is gated to the clocked input of counter 42, the frequency of the output signal from the counter 42 (F k ) times k will equal the frequency of the clock signal, subh that (k)(F k )=F cl . 
     The effect of counter 42 changing states on the output of pulse inserter 30 will now be described. The master clock input signal (F cl ) presented to exclusive or gate 44 via lead 34 is depicted in the timing diagram of FIG. 3, together with the input presented by counter 42 to exclusive or gate 44 (F k ), and the output of the exclusive or gate 44 (F pi ). Referring to FIG. 3, it will be understood that the output of pulse inserter 14 (F pi ), will increment in phase by 180 degrees, each time the output of counter 42 changes states. Moreover, an additional half pulse will be inserted into the output of the pulse inserter 14 when counter 42 changes states, since the master clock is applied directly to exclusive or gate 44, but experiences propagation delay through the asynchronous, ripple counter 42. The propagation delay of counter 42 must be at least as long as the pulse width necessary to clock counter 48, as depicted by pulsesd I1 and I2 of FIG. 3. In this regard, it will be understood that counter 42 could be a synchronous counter, so long as another means for inserting an appropriate propogation delay were provided, to delay the output of counter 42 (F k ) at least as long as the pulse width necessary to clock counter 48. 
     It will be appreciated that the number of pulses preseneted to counter 48 during a given time period will be the number of pulses in the master clock train, plus each half pulse added to the master clock train when the counter 42 changes states. In other words, the frequency of the pulse train of the signal F pi  presented to the counter 48 is the sum of the frequency of the clock signal F cl  and the freqency of the output signal F k  of counter 42. Because the output signal (F k ) of counter 42 is the frequency of the clocked input signal divided by the constant k, and because the clocked input to counter 42 can be no greater than the master clock frequency (occurring in the above described situation where the input signal to phase detector 28 and the signal presented to phase detector 28 by counter 48 are at the same frequency and 180° out of phase), the maximum frequency of the signal F pi  that can be presented by the pulse inserter 30 to the counter 48 is the master clock frequency (F cl ) plus the frequency of the master clock divided by k, or F pi (max) =F cl  +(F cl  ÷k). 
     As explained above, the maximum frequency of the signal F pi  presented by pulse inserter 30 to counter 48 of feedback loop 32 is F cl  +(F cl  ÷k). The minimum frequency of the signal F pi  presented by the pulse inserter 30 to counter 48 is the frequency of the clock (F cl ) (occurring, as described above, when the input signal F in  presented at terminal 26 of phase detector 28 and the output signal F VCO (÷N) of counter 48 presented to phase detector 28 are of the same frequency and in phase). Considering that counter 48 divides the frequency of the signal (F pi ) presented to it by the pulse inserter 30 by the number N, it will be understood that the maximum input signal frequency (F in ) that the phase locked loop 14 can acquire is (F cl  +(F cl  ÷k))÷N, or F cl  /N(1+1/k). The minimum input signal frequency that the phase locked loop 14 can acquire is F cl  ÷N). Subtracting the minimum lock frequency from the maximum lock frequency yields a lock range of F/N(1+1/k)-F cl  /N or F cl  /Nk. The center frequency of the lock range is the minimum lock frequency plus one-half of the lock range, or F cl  /N+1/2F cl  /Nk=F cl  /N(1+1/2k. Examination of the above formulae reveals that the lock range of the phase locked loop 14 can be narrowed (thereby increasing the frequency selectivity of the digital frequency detector), by decreasing F cl , or increasing the product of constants k and N. 
     Turning to FIG. 4, the final case, wherein the input signal (F in ) presented at terminal 26 of phase detector 28 of the phase locked loop 14, and the output of the counter 48 (F VCO (÷N)) presented to the phase detector 28 are of the same frequency but 90 degrees out of phase will be considered. The output signal (F pd ) of exclusive or gate 35 of phase detector 28 will in that instance have a 50 percent duty cycle, as shown in FIG. 4, and will be a square wave signal having a frequency of twice the input signal (F in ). And gate 40 of pulse inserter 14 will therefore gate the master clock input pulse train to counter 42 fifty percent of the time, and the frequency of the pulse train presented by the pulse inserter 14 to the counter 48 will be F cl  +1/2F cl  /k or F cl  (1+1/2k). Recalling that counter 42 divides the pulse inserter output signal frequency by N, the output signal frequency of the counter 48, as presented to the phase detector 28 will be F cl  /N (1+1/2k), which is the previously calculated center frequency of the phase locked loop lock range. 
     The operation of the amplitude detector 16, integrator 18, comparator 20, and timer 22 can now be understood, with reference to the above described operation of the phase locked loop 14. The output of phase locked loop 14 is connected to the amplitude detector 16 of digital frequency detector 10 by leads 54 and 43. In particular, lead 43 connects one input terminal of exclusive nor gate 52 to the output of counter 48. The operation 28, and lead 54 connects the other input terminal of exclusive nor gate 52 to the ÷N/2 output of counter 48. The operation of the amplitude detector 16 is best understood by considering the instance where the phase locked loop 14 has locked onto an input signal (F in ) having a frequency equal to the center frequency of the phase locked loop. The output signal of the amplitude detector 16 presented on lead 60 in such instance is depicted by F ad  in the timing diagram of FIG. 4. 
     In particular, and referring to FIG. 4, the output of the ÷N/2 terminal of counter 48 is a square wave pulse train having a frequency exactly double the frequency of the ÷N output of counter 48, with the trailing edge of each pulse of the ÷N output terminal pulse train synchronized with a trailing edge of an output pulse of the ÷1/2N output terminal of the counter 48. As is best determined from the timing diagram of FIG. 4, the output signal F pd  of phase detector 28, when the ÷N output of counter 48 is of the same frequency and incremented 90° in phase from the input signal (F in ) (which as described above, occurs when the frequency of the input signal (F in ) equals the center lock frequency of the phase locked loop 14), will be of the same frequency and in phase with the ÷N/2 output of counter 48. Accordingly, the output of exclusive nor gate 52 of amplitude detector 16 (F ad ), will be a continuous logic high level. As the frequency of the input signal F in , and thus the phase relationship between F in  and the ÷N output of counter 48, change from the values established by the center lock frequency of the phase lock loop 14, the output of the amplitude detector F ad  presented on lead 60 will no longer be continuous; that is to say, the duty cycle will become less than 100 percent. The duty cycle of the output signal of amplitude detector 16 will decrease to fifty percent if the incoming signal F in  is totally out of the lock range of the phase locked loop 14. 
     Integrator 18, threshold detector 20, and timer 22, act together to provide a detect output signal on digital frequency detector output terminal 80 only when an input signal (F in ) of preselected frequency is presented to the input terminal 26 of frequency detector 10 for an amount of time preselected by the setting of integrator 18 and comparator 20. In particular, the pulse train of the master clock signal (F cl ) is gated through and gate 56 to counter 58 of integrator 18 only when the output of amplitude detector 16 is a logic high, and the duty cycle over which the output of amplitude detector 16 is a logic high is a function of whether phase locked loop 14 has acquired an input signal (F in ) of preselected frequency. Timer 22 resets the counter 58 of integrator 18 at a periodic, predetermined interval. Counter 58 will provide a detect output signal, through comparator 20, only if a predetermined number of clock train pulses are gated to the counter 58 through and gate 56 during the time interval established by timer 22. 
     As described above, the duty cycle of amplitude comparator 16 varies from 50%, when the frequency of input signal (F in ) is outside of the lock range of phase locked loop 14, to 100%, when the frequency of input signal F in  is at the center frequency of the lock range of phase locked loop 14. During a given reset interval for counter 58 (as established by timer 22), the output of amplitude detector will therefore be high at least 50% of the interval, and at least 50% of the clock signal pulse train will be presented to the counter 58. Comparator 20 must therefore be set to provide a detect output only when at least more than 50% of the pulse train of clock signal (F cl ) presented during a given time interval has been counted by counter 58. This is conveniently accomplished by resetting counter 58 at a 1 hertz interval, and setting the comparator 20 to provide a detect output only when a number of pulses equal to more than one-half the frequency of F cl  has been counted. 
     It will be appreciated that the duty cycle of amplitude comparator 16 will increase from 50% towards 100% as the frequency of the input signal (F in ) approaches the center frequency of the lock range of phase locked loop 14 (previously calculated as F cl  /N(1+1/2k)). The frequency selectivity of the detector 10 can accordingly be adjusted by increasing the number of clock pulses that must be counted by counter 58 during a given time interval before comparator 20 provides a detect output signal. Stated another way, the frequency of the input signal (F in ) must be close enough to the center lock frequency of phase locked loop 14, such that the duty cycle of amplitude detector 16 is large enough to gate the required number of pulses from the clock signal (F cl ) through and gate 56 to counter 58, such that the count of counter 58 reaches a high enough number for comparator 20 to provide a detect output before the counter 58 is reset by timer 22. It will be appreciated that, with the timer 22 conveniently set to provide a reset pulse at a frequency of 1 hertz, comparator 20 can be set to provide a detect output at a count no higher than a count corresponding to the frequency of the clock signal (F cl ). 
     Referring to the timing diagram of FIG. 5, the operation of comparator 20 to selectively respond to different count outputs of counter 58 of integrator 18 will be described. Counter 58 includes output terminals that change states each time a count that is a multiple of 2 n , 2 n+1 , and 2 n+2 , respectively are reached by the counter. The timing diagram of FIG. 5 assumes that counter 58 is continuously clocked at a regular frequency, thereby providing symmetrical square wave outputs from each of the counter output terminals. It will be understood that, if there were a hiatus in the clock input to counter 58, each of the wave forms depicted in FIG. 5 would be elongated at the point of hiatus until the input clock pulse train was reapplied to counter 58, and the appropriate count were reached for the output terminals to change logic states. Also, for simplicity of explanation, the timing diagram of FIG. 5 assumes that the frequency of the clocked pulse signal (F cl ) applied to the clocked input of counter 58 is 2 n+2 , and that counter 58 counts both leading and trailing edges of each pulse. The logic state of the 2 n  output of counter 58 will therefore change states every eight second, the output of the 2 n+1  output will change states every 1/4 second, and the output of the 2 n+2  output will change states every half second. As depicted in the timing diagram of FIG. 5, the logic levels of all three counter outputs are high simultaneously only at the seventh/eighths second mark. 
     A threshold signal (F th ) can be applied to the comparator 20 through or gate 72, essentially cancelling the effect of the 2 n  output of counter 58 presented to comparator 20 via lead 64. Referring to the timing diagram of FIG. 5, it will be seen that setting the logic level of the threshold signal (F th ) at a logic high, will produce a continuous logic high signal to and gate 70 from or gate 72, producing a detect out signal from gate 70, an eighth of a second earlier than when the threshold signal logic level is at a logic low. 
     Timer 22 provides a reset pulse to counter 58 of integrator 18 at a predetermined interval. Counter 84 of timer 22 is clocked by the input clock signal (F cl ) to provide an output via lead 88 to D flip flop 86 after counter 84 reaches a predetermined count. When the D input of D flip flop 86 is brought to a high logic level by counter 84, a reset pulse will be provided on the Q output of D flip flop 86 when the next pulse from clock signal (F cl ) is presented to the clocked input of D flip flop 86. The Q output of D flip flop 86 will go to a high logic level for on clock pulse width, also resetting counter 58 and counter 84.