The present invention relates, in general, to time interval measurement apparatus and methods.
Precise digital time interval measurement is an important part of the operation for many electronic sensor or conversion devices. The traditional method for conversion of a time to a numeric value (i.e. digital) is based on counting pulses from a constant frequency clock source.
If time interval to be measured is from time t1 to time t2, see
T=Tclock·N
There is a time measurement error associated with this method that is due to the occurrence of the starting and stopping signals for the interval relative to the clock edges used for counting. This includes (T1−t1) and (T2−t2) and these differences can add up to be Tclock. This error can be reduced by decreasing Tclock (i.e., increasing the clock frequency: Fclock=1/Tclock). However, as the frequency increases, so does the complexity, power consumption and cost of the measurement circuit.
In sensors that determine the value of the measured variable by means of time interval measurement, very precise time measurement is a critical aspect of the precision of the sensor. In the past, high frequency counters (greater than 100 MHz) and Application Specific Integrated Circuits (ASICs) were used to achieve these very fine measurements of time. These circuits have inherent drawbacks which include high cost, high power consumption (i.e. not conducive to battery powered devices), and are prone to EMC noise emissions.
It would be desirable to provide a time measurement apparatus and method which addresses the deficiencies of prior time interval measurement apparatus and methods. It would also be desirable to provide a time interval measurement apparatus and method which can very precisely measure time intervals at high frequency rates.
It would also be desirable to provide a time interval measurement apparatus and method which has minimal measurement error without requiring increased clock frequencies. It would also be desirable to provide a time interval measurement apparatus and method which is not only capable of measuring time periods with extremely high resolution, but provides the measurement over a very long time period without jeopardizing the time resolution. It would also be desirable to provide a time interval measurement apparatus and method which has these features without requiring costly ASICs or high frequency oscillator and counter circuitry.
An apparatus and method for measuring time intervals between an initial first measurement signal and one or more subsequent measurement signals.
In one aspect, a time interval measurement apparatus includes means for counting the total number of full clock periods, each having a set clock period, between an initial first measurement signal and each subsequent measurement signal, means for generating clock fractional time periods starting from the start of each of the first and each subsequent measurement signal and the start of the next respective clock period, and means for combining the generated clock fractional time periods and the total number of clock periods to generate the total time interval between the first and each subsequent measurement signal.
In another aspect, a method of measuring a time interval between an initial first measurement signal and one or more subsequent measurement signals comprises the steps of:
generating successive clock pulses having identical clock time periods between successive ones of leading and trailing clock pulse edges;
determining a total number of full clock time periods between the first and each subsequent measurement signal;
generating clock fractional periods between each of the first and subsequent measurement signals and the leading edge of the next clock time period; and
combining the total number of full clock time periods and all of the clock fractional periods between the first and each subsequent measurement signals to determine the total time interval between the first and each subsequent measurement signals.
In another aspect, a method of measuring time intervals between an initial first and one or more subsequent measurement signals comprises the steps of:
counting the total number of full clock time periods, each having a set clock period, between a first measurement signal and a subsequent measurement signal;
generating clock fractional periods starting from the start of each of the first and each subsequent measurement signal and the start of the next respective clock period; and
combining the generated clock fractional periods and the total number of clock time periods to generate the total time interval between the first and subsequent measurement signals.
The time interval measurement apparatus and method of the present invention addresses many of the deficiencies of previously devised timing apparatus and time measurement methods in that the present apparatus and method precisely measure time intervals at high frequency rates with minimal measurement error and without requiring increased clock frequencies for high resolution. The present apparatus and method also provide high timing measurement resolution over very long time periods. The present apparatus can be constructed with low cost components since the previously required costly ASICs or high frequency oscillator and counter circuitry are not required.
The various features, advantages and other uses of the present invention will become more apparent by referring to the following detailed description and drawing in which:
The present apparatus and method measures long time periods with high resolution by measuring the “long” portion of the period with a low frequency counter while the “high resolution” is achieved by precisely measuring the time difference between the starting and stopping edges of the actual signal period and the clocking edges of the clock used to measure the “long” time period. The entire measurement process is accomplished by using relatively low cost counters, linear ramp generators and analog to digital converters (ADCs), or implemented mostly by a microcontroller.
The long period time measurement is accomplished by simply activating a counter when the timing period is active. At the end of the timing period, the accumulated value from the counter is acquired.
The high resolution measurement technique is achieved by converting the time based measurement to an analog based measurement. This is done by using a linear ramp generator circuit gated by a fractional pulse generator signal. The peak voltage of the ramp should be set such that it does not exceed the ADC's input capabilities and the maximum time portion of ramp should be set to the longest period of measurement needed at the high resolution (i.e., the low frequency clock period). The linear ramp generator circuit has the capability to temporarily hold or store the output signal. This allows ADC time to convert the analog signals to digital values.
The analog ramp signal is fed into an ADC and is quantized at the resolution of the ADC. For example, if a 10 bit ADC is used, its resolution would be 1 part in 1024 (210). If the counter clock frequency was 1 Mhz and the ramp was set to span this period (i.e. 1 microsecond), then the resolution of this time measurement would be 1 microsecond divided by 1024 or 0.97 nanoseconds.
If the time interval measurement apparatus and method is implemented in the circuitry, the circuitry could have the ability to calibrate itself simply by measuring the period of the whole clock cycle, instead of letting the ramp signal start based its normal starting signal. This “calibration” cycle could be done periodically to compensate for various sources of electronic error (i.e., temperature drift).
A block diagram of one aspect of a time interval measurement circuit 10 is shown in
The clock source 12 supplies stable and accurate low frequency clock pulses to the clock counter 14 and the clock fraction measurement circuit 16. The stability of the clock source 12 should be better than the highest accuracy the circuit 10 is intended to provide, however, the symmetry of the clock cycle does need to be exactly 50% because the counter 14 is incremented always using the same clock edge (i.e., the rising edge).
The clock counter 14 measures coarse time values. As indicated in the timing diagram of
The microcontroller 18 collects all of the data and computes the measured high resolution time period utilizing formulas described hereafter.
The fractional clock measurement circuit 16 consists of three elements as shown in
The clock fraction pulse generator 20 combines the clock signal and the measurement signal or input pulse to create a pulse that has a width equal to the time difference between the edges of the signal being measured and the edge of the clock pulse, see
The ramp generator 22 converts the width of these pulses to a DC voltage. Tclock, T1 and T2 time values are converted to Vclock, V1, and V2 voltages, respectively. For a linear ramp generator 22 with a slope S, the relationship between the time periods and the voltages are described as follows:
Vclock=S·Tclock
V1=S·(T1)
V2=S·(T2)
In order to do multiple conversions using the same linear ramp circuit, the ramp generator 22 should have the capability of being reset to zero volts rapidly so that it can prepare for the next fractional clock period measurement.
The ADC 24 measures the ramp generator 22 voltages and converts the voltage to a numeric value (digital). The time interval measurement apparatus has the capability of calibrating itself including calibration of the ADC 24 function, the ramp generator, the effect of temperature drift or any component, etc. If the clock period is known (Tclock) and a crystal controller clock source 12 is being used (very stable with time and temperature) then the clock period can be measured with the linear ramp (Vclock) and a mathematical compensation can be performed for a change in the ramp's slope due to component variation and temperature drift. This relationship can be described by the following equations:
S=Vclock/Tclock
T1=Tclock·(V1/Vclock)
T2=Tclock·(V2/Vclock)
To effectively use the calibration process and to reduce the ramp slope drift errors, the measurement of the Vclock voltage should be taken close in time to the measurement of V1 and V2.
Tclock, as described above, may be employed at any time after the ramp signal value has been converted to a digital value and used to calculate one fractional clock time period, the entire apparatus may be recalibrated or the recalibration may be implemented at the end of the last measurement signal, such as measurement signal S3 in
A calibration ramp signal is generated to generate Vclock.
For an explanation of the conversion process, simple “round” numbers will be used for clarification purposes. Referencing
The low frequency clock source 12 is “free running” on a continuous basis.
The first or initial signal of the period to be measured is received (S1), signifying the beginning of the measurement period. At this point two events occur. The counter 14 is enabled, allowing the low frequency counter 14 to count, and also, the linear ramp circuit 22 (Ramp1) is released, allowing the voltage to begin its ramp.
As time transpires and the next rising edge of the clock is received (C1), the ramp generator circuit 22 is disabled and its amplitude is maintained at the level the ramp reached within that time. Also, the counter 14 increments its count value. The ADC 24 is initiated to measure Ramp1 and to acquire the voltage level of the ramp (V1).
As more time elapses, the low frequency counter 14 continues to count on every positive clock edge, two more times in this example, C2 and C3.
A second or subsequent signal of the period to be measured is then received (S2), signifying the end of one measurement period. At this point two further events occur. In one aspect, the gate of the counter 14 is disabled, preventing the low frequency counter 14 from further counting and, also, the linear ramp circuit 22 (Ramp2) is released, allowing the voltage to begin its ramp. In another aspect, the count from the counter 14 is stored at S2, while the counter 14 continues to count.
As the next rising edge of the clock is received (C4), the ramp generator circuit 22 is disabled and its amplitude is maintained at the level the ramp reached within that time. The ADC 24 is initiated to measure Ramp2 to acquire the voltage level of the ramp (V2).
At this point, all of the raw measurements have been taken, i.e., V1, the low frequency count, and V2. Calculations are performed on these values to derive the actual time period.
The calculation for the final time period measurement performed by the microcontroller 18 is as follows:
Tactual=T1+(N*Tclock)−T2
where:
As can be seen by this equation, Tactual, or the time interval between the first initial measurement signal and the second or other subsequent measurement signal, is generated by combining the clock fractional time periods and the total number of full clock time periods between the two measurement signals.
It will also be understood that instead of the separate clock source 12, clock counter 14, and ADC 24 shown in
It will be understood that the above-described time interval measurement apparatus and method for measuring the time interval between a first or initial measurement signal and a subsequent or second measurement signal can, using the same circuit shown in
It will also be understood that when multiple subsequent signals are to be measured for individual time intervals with respect to the first initial measurement signal, the counter, whether implemented as a hardwired component 14 as shown in
The present time interval measurement apparatus and method may be used in many different technologies and applications where any measurable quantity can be sensed as a time measurement. Such applications include magnetostriction, ultrasonic, radar, etc. In the case of magnetostriction, one example of a time propagation constant for a wave transmitted along a wire is 9.123 microseconds per inch. If the time interval between two signals generated during the transmission of the signal along the wire is determined by the method described above, the length or distance between the two measurement locations can be determined. The measurement signals may be generated by two magnets spaced along the magnetostrictive wire. Alternately, the two measurement signals may include the initial transit pulse on the magnetostrictive wire and a second measurement signal provided by a magnet associated with the wire.
There has been disclosed a novel time interval measurement apparatus and method which overcomes the deficiencies found in previously devised high speed or high resolution time interval measurement apparatus. The present time interval measurement apparatus and method very precisely measures time intervals, without requiring high frequency counters or ASICs which have a high cost, high power consumption which is not conducive to battery powered devices and are prone to EMC noise emissions.