This project, a fast reciprocal frequency counter method from
1990, details a method for creating a fast frequency counter using reciprocal counting technique.

The reciprocal counting technique is essential especially for measuring low frequencies.

The normal way you think of counting is to measure the edge transitions of the incoming signal over a set period of time. If the input frequency is low there is a chance of missing the incoming edge.

Reciprocal counting measures a clock frequency over a period of the incoming signal i.e. it is gated bu the input signal so the error can only be out by one clock period i.e. a far smaller error.

The interesting thing is that it uses a fast 8x8 multiplier and this piece of hardware is incorporated into the 18F series PIC chips - it may not fit the exaxt design here but is a good starting point.

A method and apparatus makes rapid frequency measurements by measuring time intervals for a series of blocks of event counts with the number of events in each block held constant. This makes the numerator of the events/time relationship constant so it does not have to be measured, processed or stored.

The frequency of the signal is determined by measuring the time interval, then taking the inverse of the measured value and multiplying by the appropriate constant. A fast inverse circuit uses a Taylor series expansion technique implemented in digital circuit, with the slope resolution adjusted for regions of small slope to improve accuracy.

Precision frequency counters typically include two counters, a time counter to accumulate events from a stable clock, and an event counter to accumulate events from an input signal. Dividing the number of events in the event counter by the result in the time counter provides the average frequency of the input signal.

The two counters are started and stopped by a signal called a gate. If the gate is synchronized with the clock, the gate time is controlled exactly and the number of input signal events is counted with some uncertainty (plus or minus one event). If the gate is synchronized with the input signal, the number of input signal events is counted exactly and the elapsed time is counted with some uncertainty (plus or minus one clock period). This latter method is called reciprocal counting.

Because the plus or minus one event count uncertainty gives relatively poor frequency resolution, virtually all modern precision frequency counters use the reciprocal counting method. Increased accuracy can be gained by averaging over more than one input signal event.

However, division is an inherently slow operation. In the digital circuits used in most modern instruments, division requires many processing cycles or a very large amount of circuitry because the computation of each output bit uses a carry through many bits of the intermediate results of the previous output bit.

One approach to avoiding division is to measure the period between successive pulses and generate the inverse of the period to produce the frequency. This approach is disclosed in U.S. Pat. No. 4,707,653 (Wagner). Wagner uses a PROM which includes a lookup table to provide the inverse of the period.

However, Wagner does not address making measurements over multiple cycles, which is necessary to produce high precision frequency measurements. Also, because Wagner's device measures on every input event, it is limited to relatively low frequency applications. Finally, the simple look up table limits the accuracy provided.

The limits imposed by division for measurements on multiple cycles made it difficult or impossible to make successive frequency measurements as rapidly as desired. Making more rapid frequency measurements would allow triggering a frequency versus time measurement on a frequency transition, making and displaying nearly real time frequency measurements of a frequency modulated or frequency agile signal, or producing histograms of frequency distribution of such signals. Another application is making a precision, wideband, programmable frequency to voltage converter.

Another application for making rapid frequency measurements is in an instrument for providing continuous time interval measurements on a signal. Continuous time interval measurements make it simpler to study dynamic frequency behavior of a signal: frequency drift over time of an oscillator, the frequency hopping performance of an agile transmitter, chirp linearity and phase switching in radar systems.

Continuous time interval measurements on a signal provide a way to analyze characteristics of the signal in the modulation domain, i.e., the behavior of the frequency or phase of the signal versus time. An example of an instrument that generates this type of time stamp and continuous time interval data is described in "Frequency and Time Interval Analyzer Measurement Hardware", Paul S.

Stephenson, Hewlett-Packard Journal, Vol. 40, No. 1, February, 1989.

One aspect of the design is a method and apparatus for making rapid frequency measurements by measuring time intervals for a series of blocks of event counts with the number of events in each block held constant. This makes the numerator of the events/time relationship constant so it does not have to be measured, processed or stored.

The frequency of the signal is determined by measuring the time interval, then taking the inverse of the measured value and multiplying by the appropriate constant.

Another aspect of the design is a fast inverse circuit. The circuit uses a Taylor series expansion technique implemented in digital circuitry, with the slope resolution adjusted for regions of small slope to improve accuracy.

Figure 1 : Shows a high level block diagram of a frequency counter using the constant event measurement method and the fast inverse circuit of the invention

for the fast reciprocal frequency counter

for the fast reciprocal frequency counter

FIG. 1 shows a high level block diagram of a frequency counter using the constant event measurement method and the fast inverse circuit of the design. A time counter 101 receives a clock signal on input line 103 from a stable, high frequency clock and produces an output of the accumulated count on line 109.

An input signal whose frequency is to be measured is applied on line 107 to a constant event counter 105, described in more detail below, that produces an output pulse on line 111 every N input signal events. The constant event counter 105 is programmable so that N can be varied.

The count data on line 109 is applied to the data input of latch 113 and the pulses on line 111 are applied to the enable input of latch 113. Thus, at each output pulse from the constant event counter 105, the current value in the time counter 101 is stored in latch 113. The data output of latch 113 on line 115 is a series of time values corresponding to the time of occurrence of sequential blocks of N input signal events.

The series of time values is applied to a time value processor 117. The time value processor produces a series of time interval values on line 119, representing the difference between sets of time values. The time values can be processed in a variety of ways, some well known, to produce time interval values.

The details of the processing methods are beyond the scope of this design. One simple way to process the time values, that is sufficient to demonstrate the operation of the design, is to take the difference between successive time values to yield a series of time intervals.

The time interval values on line 119 are applied to inverse circuit 121, which takes the inverse of the values to produce a series of corresponding frequency values on line 123. The operation of the inverse circuit is explained in more detail below.

The frequency output values on line 123 can be displayed or stored for postprocessing. Because they are derived from constant event measurements, the time interval signals on line 119 can be applied to triggering circuits with the appropriate time value limits to allow triggering on a desired frequency.

Figure 2 : Shows a more detailed block diagram of the constant event counter 105 in fig. 1

for the fast reciprocal frequency counter

for the fast reciprocal frequency counter

FIG. 2 shows a more detailed block diagram of the constant event counter 105 in FIG. 1. Counter 105 is a programmable count down counter that can be reloaded with an initial value when it reaches its terminal count without skipping any cycles. Because it is used to arm for measuring the same signal being counted, it must produce an output in time for a measurement on the immediately following edge. For a 100 MHz input signal, this will occur as soon as 10 ns after the edge initiating the output.

Counter 201 is an 8 bit down counter. This counter can be implemented in a variety of ways, with one preferred circuit being eight flip flops with the flip flops for the two least significant bits connected in a synchronous configuration and the remaining flip flops connected in a ripple through configuration.

The counter is asynchronously loaded with an initial state from register 203 via line 202, on the occurrence of a signal from a reload logic circuit 205 on line 204. Register 203 can be loaded with the desired preset initial value to provide an output every N input signal events.

The input signal to be measured, on line 107, is applied to counter 201 on line 206 through a delay 211, described below. The output of counter 201 is applied to terminal count logic 207 on line 208.

A latch output signal of terminal count logic 207 on line 210 is applied to the J input of output latch flip flop 209. Flip flop 209 is clocked by the input signal via line 212. Thus, on the next input signal edge after the latch signal is applied, flip flop 209 produces an output signal on line 111 that is applied to the latch 113 as described above. Latch flip flop 209 is reset at the start of each measurement.

A reload output signal of terminal count logic 207 is applied to reload logic 205 via line 214 to enable reloading when counter 201 reaches its terminal count. The input signal is applied to reload logic 205 via line 216. Reload logic 205 is reset at the start of each measurement block.

Delay 211 delays the input signal to the counter 201, to provide time for the counter to recover from the reload. However, this delay also subtracts from the setup time for the output latch flip flop 209. Thus, delay 211 must be long enough to allow the terminal logic and the reload logic, triggered by the undelayed input event edge, to reload the counter 201 before the following delayed input event arrives on line 206.

The delay must be short enough so the counter is not reloaded and starting to count when the delayed event edge arrives on line 206. The delay must be short enough so the latch output signal on line 210 reaches the flip flop 209 in time for it to be clocked by following undelayed input event edge on line 212.

Figure 3 : Shows a more detailed schematic block diagram of the inverse circuit 121 in fig. 1

for the fast reciprocal frequency counter

for the fast reciprocal frequency counter

FIG. 3 shows a more detailed schematic block diagram of the inverse circuit 121 in FIG. 1. The circuit includes a read only memory (ROM) 301, a multiplier 303, a bit field selector multiplexer 305 an a subtractor 307. The input to the inverse circuit 121 are the time interval values on line 119.

In the embodiment described, these are 16 bit binary words. The inverse circuit takes the inverse of the input interval values by approximating a Taylor series expansion.

A Taylor series expansion of 1/X from a nearby point Xo is:

This is an infinite series, but the higher order terms rapidly approach zero, particularly if Xo is close to X.

For a binary word X, Xo can be the more significant bits of X (with the less significant bits assumed to be zero) and (X-Xo) can be the less significant bits. For example, if X is a 16 bit binary number, Xo is the 8 most significant bits and (X-Xo) is the 8 least significant bits. Thus subtraction is not needed to produce the (X-Xo) term used in the expansion.

The two most significant bits of the input are applied to an or gate 309, and the output is applied to the bit field select multiplexer 305, to control its operation as explained below.

The eight most significant bits of the input value (representing Xo) form the address applied to ROM 301. ROM 301 is a 256 word by 24 bit memory. ROM 301 operates as a lookup table with two data outputs, a 16 bit word offset representing the inverse of Xo (1/Xo), and an 8 bit word slope representing 1/Xo

Multiplier 303 also receives the 8 least significant bits of the input value (representing X-Xo) and multiplies this input by the 8 bit slope (1/Xo

Subtractor 308 subtracts the second term value on line 308 from the first term offset value on line 302 to produce a final 16 bit output value that represents the inverse (1/X) of the 16 bit time interval input value (X).

Without the adjustment function that the bit field selector enables the circuit to perform, the circuit would have about 8 bit accuracy for a 16 bit input. The adjustment function and a small reduction of the offset values stored in ROM 301 from the actual values improves the accuracy to about 12-13 bits.

First, the sum of the higher order Taylor expansion terms is always positive, so by reducing the values for the offset stored in ROM 301, the average error can be reduced. In effect the piecewise linear approximation is adjusted to more closely overlay the actual 1/X function curve.

Second, the magnitude of the slope (1/Xo

The shifting function is accomplished by the bit field select multiplexer 305, controlled by the ORed 2 most significant bits of the time value input on line 312.

Figure 4a : Illustrates the combination of bits sent to the subtractor 307 if x is in the lower 1/4 of the input range

for the fast reciprocal frequency counter

for the fast reciprocal frequency counter

The operation of the bit field select multiplexer is illustrated in FIGS. 4A and 4B. FIG. 4A illustrates the combination of bits sent to the subtractor 307 if X is in the lower 1/4 of the input range. This is indicated when the two most significant bits of the input value on line 119 are both 0, and the ORed value on line 312 is thus 0.

Of the 16 bits produced by multiplier 303, the 4 least significant bits are discarded and the 12 most significant bits are applied to the 12 least significant bits of the subtractor.

Figure 4b : Illustrates the combination of bits sent to the subtractor 307 if x is in the upper 3/4 of the input range

for the fast reciprocal frequency counter

for the fast reciprocal frequency counter

FIG. 4B illustrates the combination of bits sent to the subtractor 307 if X is in the upper 1/4 of the input range. This is indicated when either or both of the two most significant bits of the input value on line 119 are 1, and the ORed value on line 312 is thus 1. Of the 16 bits produced by multiplier 303, the 8 least significant bits are discarded and the 8 most significant bits are applied to the 8 least significant bits of the subtractor. In this case the multiplier output is shifted down by 4 bits to adjust for the 16 times slope values stored in the ROM table.

Figure 5 : In fig. 1

for the fast reciprocal frequency counter

for the fast reciprocal frequency counter

FIG. 5 graphically illustrates the operation of the inverse circuit 121. The horizontal axis is the input value X, and the vertical axis is the output value 1/X. The curve 501 shows the 1/X relationship. Point 503 represents a particular (16 bits) input value X. Point 505 represents the Xo (8 bits) applied as the address for ROM 301.

The hash marks on the horizontal axis illustrate the quantization limit of the 8 bit approximation. Point 511 represents the approximation offset value 1/Xo stored (16 bits) in ROM 301, and applied to subtractor 307. The length of dashed line segment 507 indicates the difference X-Xo (8 bits), sent to multiplier 303.

The slope of dashed line segment 515 indicates the slope value (1/Xo

Finally, point 513 on the vertical axis represents the output (16 bits) of subtractor 307, approximating 1/X.

While there have been shown and described what are at present considered the preferred embodiments of the present design, it will be obvious to those skilled in the art that various changes and modifications may be made therein without departing from the scope of the design as defined by the appended claims.

Click here for more project
ideas.

Jump from the fast reciprocal frequency counter method page to

Best Microcontroller Projects Home Page.

Site Map | Terms of Use

512-8607

## Comments

Have your say about what you just read! Leave me a comment in the box below.

Don’t see the comments box? Log in to your Facebook account, give Facebook consent, then return to this page and refresh it.