5

ADVANCED AND SELF-ADAPTING METHODS OF FREQUENCY-TO-CODE CONVERSION

In spite of the fact that today frequency can be measured by the most precise methods by comparison with other physical quantities, precise frequency-to-code conversion with the constant quantization error in a wide specified measuring frequency range (from 0.01 Hz up to some MHz) and with non-redundant conversion time can only be realized based on novel measurement methods for frequency-time parameters of the electric signal. This requires additional hardware costs and arithmetic operations: multiplication and division for calculations of the final result of conversion. Therefore, additional measuring (conversion) devices should be included in the microsystem. These include two or more multidigital binary counters, the multiplier and the code divider, logic elements, etc. Different design approaches are used. In the authors’ opinion, a successful solution is the use of a microcontroller core in such microsystems. In this case, with the aim to minimize the built-in hardware, it is expedient to take advantage of the program-oriented methods of measurement developed for frequency-time parameters of signals.

5.1 Ratiometric Counting Method

We shall first consider the idea of the original method of the discrete count [98,117], called the ratiometric counting method, which allows frequency-to-code conversion with a small constant error in a wide frequency range, we shall then consider how this method can be realized.

Let's assume that the converted periodic signal is in the form of sine wave. By means of the input forming device it will be transformed into a periodic sequence of pulses, the period Tx of which is equal to the period of the converted signal. There are various devices and principles for the transformation of periodic continuous signals into a sequence of rectangular pulses. For the practical usage, we provide a simple enough circuit of such an input shaper (Figure 5.1). It has an input voltage range from +0.035 up to +24 V. The device includes an input amplitude limiter, an amplifier and a Schmitt trigger.

images

Figure 5.1 Circuit of input forming device

Regardless of this sequence the first reference time interval (gate time) T01 is formed (Figure 5.2). It is filled out by N1 pulses of the periodic sequence. The number N1 is accumulated in the first counter. The converted frequency f′x is determined according to the following

images

The frequency deviation from the value fx is determined by the quantization error, the reduction of which is the aim of this method.

Simultaneously, the second gate time T02, is formed. Its wavefront coincides with the pulse, appearing right after the start of the first gate time T01, and the wavetail, with the pulse appearing right after the end of the first gate time T01. Thus, the duration of the second gate time T02 is precisely equal to the integer of the periods of the converted signal, i.e.

images

The wavefront and the wavetail of the formed gate time are synchronized with the pulses of the periodic input sequence generated from the input signal, therefore the rounding error is excluded. The second gate time is filled out by pulses of reference frequency f0, whose number is accumulated in the second counter.

The formula for the calculation of the converted frequency can be obtained in the following way. The number of pulses which have got into the second gate time, as can be seen from Figure 5.2, is determined by the ratio

images

hence

images

where f0 is the reference frequency. This can be done in a PC or a microcontroller core along with the offsetting and scaling that must often be performed.

images

Figure 5.2 Time diagrams of ratiometric counting method

The accuracy of the frequency measurement is determined by the quantization error of the time interval N1Tx.

Let's withdraw the equation for the relative quantization error δq for the frequency-to-code conversion. First of all we shall determine the maximum value of the relative quantization error for the time interval T02 = N1Tx. As this interval is filled out by counting pulses with the period T0, the maximum absolute error is Δ2 = ±T0, and the maximum relative error is:

images

The equality N1Tx = T02 can be presented as fx = N1/T02. Then according to the rules of the error calculation for indirect measurements the measurement error of the function fx is connected with the measurement error of the argument T02 by the ratio (with the accuracy of the second order of smallness) δq = δ2. After substitution of δ2 from Equation (5.5) we have:

images

According to the standard direct counting method it is possible to write the equality T01 = N1/f′x. Substituting the relation fx/N1 = 1/T01, into Equation (5.6) instead fx/N1 we obtain:

images

This formula let us draw the conclusion that the maximum value of the relative quantization error for the frequency-to-code conversion for this method does not depend on converted frequencies and, hence, is constant in all conversion ranges of frequencies.

For a reference frequency f0 = 1 MHz and the first gate time T01 = 1 s the maximum value of the relative quantization error will be δq = ±10−4%.

If, by the measurement of the time interval T02 = N1Tx using the interpolation method considered in Chapter 4 with the same frequency and gate time we obtain δq = ±10−7%.

Equation (5.7) is suitable for engineering calculations. However, this equation is a simplified mathematical model. Its construction was based on two assumptions. In order to research limiting metrological characteristics of the method it is necessary to use the refined mathematical model of the quantization error [118].

In the common case, the number of pulses which have got into the second reference time interval T02 (Figure 5.2), is unequivocally connected to the phase crowding of reference frequency fluctuations during the time τ = N1Tx, expressed through 2π:

images

where ω0 is the radian reference frequency; ent { } is the integer part of a number. Omitting the ent, we have:

images

On the other hand, on the strength of formula for T02, it is possible to write down

images

This formula represents the refined mathematical model for the quantization error and can be used for frequency-to-code converter simulation for studying limiting metrological characteristics.

The graph of δq, T02 against fx is shown in Figure 5.3 and the functional relationship δq(fx, T01) in Figure 5.4. Functions δq = f(fx), δq(fx, T01) and T02 = ϕ(fx) have the finite discontinuity of the first kind. As the modelling results show, the quantization error in the neighbourhood of the point fx min is two times less than that calculated according to Equation (5.7). Thus, the second reference time interval T02 is increased by as many times.

Finally, we consider the block diagram of the converter (Figure 5.5), which realizes the frequency-to-code conversion according to the considered ratiometric counting method.

It contains two counters and a D-trigger clocked with the sensor output. All counter functions can be provided by the counter/timer peripheral component, which interfaces to many popular microcontrollers.

images

Figure 5.3 Graph of δq(a) and T02(b) against fx at T01 = 0.25 s and f0 = 133 333.33 Hz

images

Figure 5.4 Graph of δq against fx and T01 at f0 = 133 333.33 Hz

images

Figure 5.5 Ratiometric simplified counting scheme

This method can also be used for the period (Tx)-to-code conversion. Thus, the period is calculated according to the following formula

images

The main demerit of the considered conversion method is the redundant conversion time.

5.2 Reciprocal Counting Method

A variation of the method described above is the reciprocal counting method (Figure 5.6). The cyclicity of the conversion Tcycle is determined by the reset pulse. The beginning of the counting interval Tcount coincides with the next pulse of sequence fx, appearing after the ending of the ‘Start’ pulse, and the end coincides with the next pulse fx, appearing after the ‘End’ pulse [105]. The frequency is calculated during the interval Tcalc.

The frequency or the period are calculated similarly as described above according to Equations (5.4) and (5.11) accordingly. The quantization error is calculated according to the following:

images

However, in this method, the value of the first gate time Tcount can be determined only approximately. Having set the conversion cycle equal to 1 s, it is possible to assume only that images s. It is slightly inconvenient for engineering calculations of the quantization error δq.

This method has the same demerit as the ratiometric counting method–the redundant conversion time.

5.3 M/T Counting Method

The so-called M/T counting method, which also overcomes demerits of conventional methods (standard direct counting and indirect counting methods) and achieves high resolution and accuracy for a short detecting time was described in [110].

images

Figure 5.6 Time diagrams of reciprocal counting method

Time diagrams of the M/T counting method are shown in Figure 5.7. The detecting time T02 is determined by synchronizing the generated output pulse after a prescribed period of time T01.

It is easy to notice that the M/T method differs from the above described ratiometric counting method by the synchronization of the first reference time interval T01 with the pulse of the converted frequency fx. The converted frequency or the period are determined similarly according to Equations (5.4) and (5.11). The quantization error does not depend on the converted frequency and is constant for all frequency ranges.

The detecting time is calculated by the following formula:

images

The resolution QN is calculated when the clock pulses N2 are changed by one:

images

The method uses three hardware timers/counters. One of them works in the timer mode in order to form the first time interval T01, the rest are used in the counter mode.

images

Figure 5.7 Time diagrams of M/T counting method

The M/T method has the same demerit as the previous two methods–the redundant conversion time.

5.4 Constant Elapsed Time (CET) Method

The constant elapsed time (CET) method is another advanced method with the constant quantization error in a wide specified conversion frequency range [111]. Like the M/T counting method, the CET method is based on both counting and period measurements. Both measurements starting at a rising edge of the input pulse. The counters are stopped by the first rising edge of the input pulse occurring after the constant elapsed time T01. For its realization the method uses two software timers with two hardware timers/counters inside the microcontroller.

In order to eliminate repetitive starting and stopping counters that require a reinitialization, the time counters run continuously and the pulse counter is read at the end of each time interval. This method has the same demerit: the redundant conversion time.

5.5 Single- and Double-Buffered Methods

The single-buffered (SB) method is based on both pulse counting and measurement of the fractional pulse period before the interrupt sample time [112]. Instead of repetitive enabling/disabling of the capture register function, this function is always enabled. Each rising edge of the synchronized input pulse fx stores the content of the timer in the timer capture register. The same pulse is the clock for the pulse counter. The interrupt requests are generated using the interval timer, without any link to the pulse rising edges.

The time difference N2 in this method is determined using the difference between two readings of the capture register during the current and previous interrupt service routine accordingly.

The pulse difference N1 is determined using the difference between two readings of the pulse counter during the current and previous interrupt service routine accordingly.

The frequency fx is determined using the pulse difference, the time difference and the clock frequency f0 of the timer as Equation (5.4).

Each frequency-to-code converter consists of a free running timer with a timer capture register, a pulse counter and an interrupt generator. The hardware complexity for such a system, using a software timer instead of an interval timer, is similar to that of the CET method. Hardware for the SB system is available in some microcontrollers.

The SB method has the following disadvantages [112]:

  1. The reading of the timer capture register can be erroneous, if the reading is performed during the store operation of the content of the free running timer. The other problem occurs if the reading of the pulse counter is done during counting. Both problems require synchronization hardware.
  2. The rising edge of an external pulse at the time interval between the reading of the timer capture register and the reading of the pulse counter will cause the inadequacy of the content of the pulse counter compared to the necessary content. This is a source of a numerical error, especially during the low frequency measurement.

The converter based on the double-buffered (DB) method consists of an interval timer with an associated modulus register, a timer capture register, an additional capture register and a pulse counter with the counter capture register.

The problems of the SB method are inherently solved using synchronization with the rising and falling edges of the system clock. The maximum measured frequency for the DB method is limited by the synchronization logic. The equivalent hardware complexity for both methods is similar, because of the free running the timer consists of the register and associated logic. The maximum measured frequency for the DB method is, however, not limited by the software loop only by the hardware.

The measurement error for the SB and DB methods is caused by the synchronization of the pulse signal. The worst-case error is caused by missing one count of the system clock f0. The lower error limit of the SB and DB methods is the same as the error limit of the ratiometric, reciprocal, M/T and CET methods, while the higher error limit of the SB and DB methods is twice as much as the error limit of these methods. Like all the mentioned methods SB and DB methods also have the redundant conversion time in all specified conversion frequency ranges except for the nominal frequency.

5.6 DMA Transfer Method

The direct memory access (DMA) method [113] provides an average frequency measurement of the input pulses, based on both pulse counting and time measuring for constant sampling time. The time is measured by counting pulses of the reference clock with the frequency f0 in a free-running timer. Each rising edge of the input pulse activates a DMA request. The DMA controller transfers the content of the free-running timer into the memory (analogous to the timer capture register in the SB method) and decrements the DMA transfer counter (analogous to the pulse counter in the SB method). After each constant sampling time, the interval timer generates an interrupt request to the microcontroller, which reads the contents of both the DMA transfer counter and the memory in an interrupt routine. The measured frequency is calculated as in Equation (5.4).

Due to some specific errors for the DMA method the maximum error is greater than the error of all the above advanced conversion methods (sometime more than 10 times greater) in the case of the coincidence between an input pulse and the execution of the longest microcontroller instruction, just prior to reading in an interrupt routine.

5.7 Method of Dependent Count

The method of the dependent count (MDC) was proposed in 1980 [116]. It combines the advantages of the classical methods as well as the advanced methods ensuring a constant relative quantization error in a broad frequency range and at high speed. The method was developed for the measurement of absolute [116], relative frequencies [121], periods, their ratios, difference and deviations from specified values. The creation of these methods was a logical completion of the goal-oriented search for optimal self-adopted algorithms developed earlier by the authors.

One of the essential advantages of this method is the possibility to measure the frequency fxf0. In this connection we shall use the following denotations for the deducing the main mathematical formulas: F is the greater of the two frequencies fx and f0; f is the lower of the two frequencies fx and f0.

In general, the method of the dependent count (Figure 5.8) is based on simultaneous:

  • separate counts of the periods of two impulse sequences of measurand frequencies and reference frequencies at the relative and absolute measurement method accordingly
  • comparisons of the accumulative number with the number Nδ, program-specified by the relative error δ at the frequency measurement, or at first with the number N1 determined by the error δ1 of identification of the greater of the two frequencies and only then with the number N (at measurement of the ratio)
  • forming of the reference gate (quantization window) Tq equal to the integer number Nx of the periods τ of the lower frequency f
  • quantization of the created reference time Tq by duration of the periods T of the greater frequency F, the number of which is NNδ.

The microcontroller reads out the number N (for the consequent summation with the number Nδ and calculation of the result of the measurement) at the moment of appearance of the impulse of the next period τ, terminating the impulse count.

In methods of the dependent count, the frequency-to-code conversions are supplemented by arithmetic calculations. The latter can be executed simultaneously with the consequent measurement or before its beginning. The methods are suitable for single channel as well as for multichannel synchronous frequency conversions.

Let's consider the algorithms of absolute and relative methods of conversion in more detail.

images

Figure 5.8 Time diagrams of the absolute method of dependent count

5.7.1 Method of conversion for absolute values

The measurement (conversion) of frequency and its deviations from the program-specified values is executed automatically during one time step Tq. Modes of one-time, cyclic or continuous measurements with high accuracy and speed are possible. The measurements are realized by the separate count of the impulse with the normalized width of two sequences with the frequencies f0 and fx, summation and the continuous comparison of the stored numbers with the specified number Nδ for determination of the moment of equality to one of them. Simultaneously, the quantization window Tq is formed, equal to the integer number of the periods τ of the lower frequency f (fx or f0). This interval is quantized by duration of the periods T of the greater frequency (f0 or fx). The accumulation of the number N in the frequency F counter is necessary, but it is an insufficient condition for the count termination and summation of periods of both sequences. The impulse count is stopped only at the moment of appearance of the wavefront of the consequent period, ensuring the multiplicity of Tq to duration of the period τ. After reading the numbers n = Nx and N, fixed in the counters of lower f and greater F frequencies accordingly, the measuring conversion is supplemented by the numerical according to the formulas:

images

where N = Nδ + ΔN is the total number of periods T, that was accumulated in the counter of the frequency F during the quantization window Tq; ΔN is the complement number to the specified number Nδ of the periods T that will be accumulated in the counter of the frequency F after its nulling up to the measuring termination.

The time diagram of the count of the periods τ of the lower frequency f and the periods T of the greater frequency at the frequency measurement f is shown in Figure 5.8. It is obvious that:

images

where Δq = Δt1 − Δt2 is the absolute quantization error (the error of the method) of the time interval Tq. This error arises because of the non-synchronization of the first and last impulse of the frequency F with wavefronts of impulses of the frequency f, determining the start and the end of the quantization window.

The time of the measurement (conversion) is:

images

with the error, not exceeding the ±T. This time does not depend on the measurand frequency in the frequency range D1. The range D1 can vary from infralow frequencies up to the frequency f0 = fmax. The latter is determined by the greatest possible frequency that can be counted by the timer/counter.

In case, when τ = Tx (mode f0fx) and T = T0 = 1 /f0, Equations (5.15) and (5.17) should be written as:

images

If τ = T0 and T = Tx (mode fx > f0), then:

images

The frequency range is extended up to 2D1 and overlapped only by one specified measuring (working) range.

5.7.2 Methods of conversion for relative values

Unlike the algorithm for measurement of absolute values, the algorithm for measurement of relative values is executed in two steps [122]. The measurement of the ratio fx1/fx2 is executed without using the reference frequency f0 (Figure 5.9).

The first step is used for the determination of the greater one of the two unknown frequencies. To this effect the following procedures are carried out:

images

Figure 5.9 Time diagram of method for frequency ratio measurements

  1. The calculation of the number N1 = 1/δ1 according to the program-specified relative error of determination of the greater frequency.
  2. The separate count.
  3. The summation of Tx1 = 1/fx1 and Tx2 = 1/fx2 periods of impulse sequence.
  4. The comparison of the obtained sums up to reaching the equality to the number N1.

The impulse count of both frequencies is completed at the moment of accomplishment of this equality. The information about the greater of two frequencies is entered into the microcontroller.

The second step is used for measurement of the frequencies ratio fx1/fx2, if fx1fx2, or fx2/fx1, if fx1fx2. Thus:

  1. The number Nδ = 1/δ is calculated on the program-specified relative error δ of ratio measurement.
  2. The impulses of both sequences are calculated.
  3. Each of the accumulated sums is compared period by period with the number Nδ according to the algorithm of the absolute method of the dependent count.

The integer number n of the periods τ is fixed into the counter of the lower frequency f (fx1 or fx2). The count of impulses of the frequencies fx1 and fx2 is stopped after the counting by the counter of the frequency F (fx2 or fx1) the number (Nδ; + ΔN) of the periods T. The result of measurement is calculated according to the formula:

images

and displayed in the specific units of measurement (relative, %, per mille ‰, etc.). With regard for the result of determination of the greater of the two frequencies, the calculations will be carried out according to the formulas:

images

Thus, the relative error of measurement of the frequency ratio will not exceed the program-specified error δ.

Let us consider another method for frequency ratio. The second method is more complex. Its realization requires the addition generator of the reference frequency f0, the third counter of impulses for the frequency f0 and more complex software for the microcontroller.

Due to exception of the procedure for determination of the greater frequency (Figure 5.9), the ratio f/F is measured by one step. The measurements of frequencies f and F are executed simultaneously according to the method of the dependent count for absolute values, but with some features. In this case, the following procedures are executed:

  • The separate and simultaneous count of normalized impulses of frequencies F, f and f0.
  • Forming of the reference time intervals Tq1 and Tq2 equal to the sum of the integer of periods T and τ.
  • Their simultaneous and independent quantization by duration of the period T0.

The number of the latter is accumulated and continuously compared with the beforehand given Nδ = 1/δ. The accumulation of the number Nδ in the counter of the frequency f0 is necessary, but there is the insufficient condition for the count termination and summation of the durations of periods τ and T. The impulse count of the greater frequency F is terminated at first at the moment of appearance of the impulse followed by its period T. Due to this the equation Tq1 = Nx1T is true. Simultaneously the result of the frequency F to code conversion (the numbers Nx1 and ΔN1) is read out. Then the impulse count of the lesser frequency f is stopped. It happens at the moment of appearance of the impulse followed by its period τ. The last fact ensures the equality Tq2 = Nx2. After that the count of periods T0 with simultaneous reading of the numbers Nx2 and ΔN2, and determination of the greater of two frequencies fx1 or fx2 is stopped. The analog-to-digital conversion is supplemented by the calculations:

images

where ΔN1 and ΔN2 are the complementary numbers up to the number Nδ. They are read out from the counter of the reference frequency f0 after the first and second interrupt. The ratio of periods Tx1 and Tx2 can be determined from Equations (5.22). Besides it is possible to determine the absolute and relative differences of two frequencies or periods; absolute and relative deviations of the value of controlled parameters from one or several program-specified values.

The circuitry of the first and second methods for frequency ratio conversion is rather simple. It does not require a lot of hardware and accepts their margin and the program choice of one of them. The example of such a universal converter for the ratio of two frequencies constructed with the most complex hardware is shown in Figure 5.10.

The microcontroller expands the possibilities of such converters and realizes the functions of transmission of the results of conversion of frequency deviation by the pulse-width or code-impulse signals. It is necessary for realization of digital intelligent distributed sensor systems, the multichannel converter, etc. The hardware–software realization of the method for frequency ratios expands the range of measurand frequencies, due to the use of the hardware and virtual counters, realized inside the microcontroller. Therefore, the range of measurand frequencies practically is unlimited even at low frequencies.

images

Figure 5.10 Frequency ratio fx1/fx2 to code converter

The realization of wide-range frequency converters requires two addition hardware counter dividers of input frequency, some triggers and digital logical circuits.

For both methods of measurement the time of quantization Tq is non-redundant in all ranges of measurand frequencies and can be varied in the limits:

images

The absolute error of the methods is:

images

The relative quantization error:

images

5.7.3 Methods of conversion for frequency deviation

In some cases there is a necessity to convert deviations of frequency from the preset value into the code without additional hardware and with high software controlled accuracy or speed. The method of the dependent count allows these possibilities. Such a conversion assumes some arithmetic operations and is determined by the equation

images

where a, b and c are the certain constants, set in the same format and units of measurements, as the measuring results.

Thus, the following formulas are valid for numerical algorithmic transformations with the aim to determine the deviation of the measured frequency fx with software-controlled accuracy or speed from one (as at the limiting control)

images

or some preset values (as at the admissible control)

images

and frequency deviations

images

Let's specify, that the task of the control for frequency-time parameters of signals can also be solved: at the limiting control it will be determined if fx <> fxbasis, and at the admissible control, whether there is a controllable frequency inside some specified area of allowable values.

5.7.4 Universal method of dependent count

The algorithm of the universal method of the dependent count integrates algorithms of both absolute and relative methods. The distinctive feature of the measurement for absolute values according to the algorithm of the universal method of the dependent count is, that it will be executed in two steps. Owing to these, no additional measures for determination of the greater of two frequencies are necessary.

Thus, all three algorithms of the method include: the procedure of automatic count number of normalized on duration impulses, for assurance of the inequality τ image Tx min; the procedure of period-by-period comparison of the accumulated sums with the specified number; the procedure of processing of results of measurements. Theoretically, the count does not bring in an error by the usage of appropriate devices for its implementation.

The comparison error that is determined by the speed of the used devices and a number of bits of compared numbers can be also neglected. The calculation error of the result of measurement under the specified formulas can be neglected as well. The rounding error is distributed according to the uniform unbiased (equiprobable) distribution law. Therefore, the error of the frequency-to-code conversion will be determined only by the quantization error, the reference frequency stability and the trigger error in case of a harmonic signal and the effect of interference.

The consequent digital signal processing: scaling, determination of the difference and deviation of measurand values from program-specified, minimax, statistical and weight signal processing, sensor characteristics linearization, extrapolations, etc. can be used for the further processing of the result of the measurement.

5.7.5 Example of realization

The simplicity of the method realization using minimum hardware is an important advantage. The schematic diagram of the frequency-to-code converter based on the universal method of the dependent count is shown in Figure 5.11.

At the beginning the measuring mode (absolute or relative values) and the required relative errors δ1 and δ are set. Then the microcontroller calculates the numbers N1, Nδ and initializes the counters CT1, CT2. The measurements begin after actuation of the trigger T4 by a start impulse through the logical element OR_1. Then the elements AND_5, AND_6 are actuated. The formed impulses with the frequencies fx1 and fx2 at ratio measurement or fx1 and f0 at frequency measurement (the trigger T3 is switched off) feed on the inputs of the decrement counters. The signal from the zeroized counter is fed on the interrupt input of the microcontroller. The microcontroller switches off the trigger T4 and terminates the impulse count of both frequencies.

If the frequency fx2 was greater at the ratio measurement (the trigger T3 is actuated), the microcontroller downloaded the number Nδ = 1/δ only in the counter CT2 at repeated initialization. Then the trigger T1 is actuated again. The first impulse of the frequency fx1 through the open element AND_1 and the element OR_1 actuates the trigger T4 again and switches off the trigger T1. The new count cycle of periods and the decrement of the counters begins: CT1 from the Nmax = 2i (where i = 16, 32, 64); CT2 from the Nδ. After zeroizing the last one, the signal from the inverse output CT2 goes on the microcontroller's input. The μK actuates the trigger T1 again. The consequent impulse of the frequency fx1 switches off the triggers T1, T4 and eliminates the count of impulses of both frequencies. The signal from the inverse output of T4 goes on the third microcontroller's input and eliminates the count at the ratio measurement fx1/fx2.

If fx1 is the greater frequency, the microcontroller downloads the number Nδ only in the counter CT1 at initialization. The decrement of the counters is executed in a similar way from the values Nδ and Nmax. Thus, the quantization window is formed. It is equal to the integer number of the periods Tx2 = 1/fx2. After the last nulling, the signal from the inverse output of the trigger T4 goes again on the μK's input and eliminates the measurement. The μK reads the numbers Nx2 and ΔN1 (or Nx1 and ΔN2, if fx1fx2) and calculates the result of the measurement according to Equation (5.21).

images

Figure 5.11 Schematic diagram of universal method of dependent count

The average value of frequency is measured similarly. The mode of determination of the greater frequency is also necessary in this case. Due to this, after completion of the second step of measurement with accounting the result on the first step, the μK calculates the result as:

images

images

The determination of the greater frequency is possible without necessity of execution of the first step. It requires some more complicated software.

Let's note that this scheme is one of the most complex hardware realizations of the method, except the multichannel synchronous one with the simultaneous conversion of frequencies in all channels. It can be realized in the silicon, PLD or FPGA. The most simple is the program-oriented realization [123124]. The combine implementation [125] is somewhat more complex. In these cases, the measuring channel will be realized completely or partially on the virtual level inside the functional-logical architecture of the computer power.

5.7.6 Metrological characteristics and capabilities

The accuracy and time of measurement are the main characteristics of various methods for frequency-to-code conversion. These characteristics are the main quality indexes at any automatic measurements. However, in the case of frequency measurements they are more interconnected. The method of the dependent count differs from other conventional methods in that the indicated correlation is very loosed, because the quantization window Tq is non-redundant and, as it follows from Equation (5.16), practically does not depend on the measurand frequency. Moreover, the method of the dependent count has some additional possibilities. It is necessary to give them a quantitative evaluation.

5.7.7 Absolute quantization error Δq

Let's consider the time diagrams (Figure 5.12) illustrating one cycle of measurements of unknown frequencies with the periods τ1, τ2 > τ1 and τ3 > τ2.

images

Figure 5.12 Time diagram of conversion cycle

Each next conversion begins at once after the initialization of the counters by the microcontroller. The number Nδ = 1/δ is written into the counter of the greater frequency F = 1/T. Both logical elements are opened and after arrival of the impulse of the lower frequency f2 = 1/τ2 the quantization window Tq will be formed. Impulses of the frequency f2 with the duration t image τmin and impulses of the frequency F after the time 0 ≤ Δt1T are calculated in parallel. Therefore the numbers in the counters begin to decrement from 216 in the counter of the lower frequency and from Nδ = 1/δ in the counter of the greater frequency.

If zeroing happens before the arrival of an impulse of the frequency F2 (case 2), the impulse count proceeds and the counter decrement begins again from the number Nδ. Through the time interval (T − Δt2) after arrival of the last impulse of the ΔN′ the impulse of the lower frequency comes. It finishes the creation of the quantization window and eliminates the impulse count by both counters. The calculation (Equations (5.18) or (5.19)) begins after reading the numbers Nx′ and ΔN′ (the number Nδ is stored in μK's memory). The measurements in the first and the third cases are executed similarly. Thus, with the absolute quantization error Δq = Δt1 − Δt2, that does not exceed the |T | for all three cases (Figure 5.12) the following equations are true:

images

Let's note that the conversion of the unknown frequency f according to the method of the dependent count can be considered as the determination of the average frequency of the sequence consisting of the (Nδ + ΔN) impulses with the period T with the help of the rectangular weighting function of the single-level integrating window of Dirichlet. The duration of the window is equal to the integer number of periods τ. The Δt1 and Δt2 are independent random components of the quantization error Δq, because of non-synchronization of the Dirichlet window with the first and last impulse of the sequence with the period T. These components of errors are distributed according to the uniform, asymmetric distribution law:

images

with the expectation value |0.5T | and the variance D = T2/12.

The absolute error Δq is equal to the sum of components Δt1 and Δt2. It is distributed according to the symmetrical triangular distribution Simpson law with the following numerical characteristics:

  • the expectation value M(Δq) = M(Δt1) − M(Δt2) = 0
  • the maximum value Δq max = ±T
  • the mean square error

    images

  • the variance D(Δq) = σ2(Δq) = T 2/6.

5.7.8 Relative quantization error δq

The relative quantization error δq characterizes more completely the accuracy of the measurement than the absolute one. It is obvious (Figures 5.8, 5.12) that the error arises because the variable time interval formed during the measurement is equal to the quantization window Tq = Nxτ = Nx/f. The interval Tq will be varied at the change of the frequency f. Therefore, the number N of the periods T (Figure 5.12) will also vary within the limits of 0–Nmax due to the ΔN changes. The latter is determined by the duration of the time interval τ and the frequency F:

images

The error Δq is distributed according to the symmetrical distribution Simpson law. This error is maximal at the N = Nmin = Nδ = 1/δ and minimal at the N = Nmax = Nδ + ΔNmax = 2Nδ − 1. It is determined as:

images

where Tδ = T/δ is the program-specified time of measurement in the mode of the specified speed in addition to the mode with the specified accuracy δ. It is obvious

images

where k is the coefficient of the change of the error.

The dependencies of the error δq(δ, fx) illustrating these features and advantages of the method are shown in Figure 5.13.

Thus, the equation Tq = = Nx Tx is true for all the frequencies of the measuring range D1. Each time, when it is defaulted, the specified number of the impulses Nδ is automatically increased on the ΔN due to the extension of the integrating Dirichlet window up to assurance of the multiplicity Tq and τ(Tx or T0). Therefore, until Nδ image ΔN the error Δq is constant, does not exceed the specified δ and identical at frequencies fx < f0 and fx > f0, symmetrical concerning the middle of Df, in which fx = f0. The dependence of the error δq from the frequency begins to be apparent at increase of the number ΔN. The δq decreases on the fbound and Fbound boundaries of the range Df and becomes equal to 0.5δ. The error δq continues to decrease in relation to the 1/2N at further increase of the number ΔN, if the counter capacity allows.

images

Figure 5.13 Distribution laws of the relative quantization error δq

Therefore, due to the method of the dependent count it is possible to realize the self-adopted mode of frequency measurements with the specified relative error δ or the time of measurement T in a broad range of frequencies from infralow up to high, limited by double value of the reference frequency f0. Thus, the possibility of the extension of the range Df in the lowest frequencies is determined only by the counter capacity m:

images

In hardware realization the decrease of the lower boundary fbound can be reached due to increase of the used number of counters with the capacity m = 32, 48, 64 bits and are more, moreover by decrease of the frequency f0. For combined and program-oriented realizations, the extension to low and infralow frequencies practically is not limited. It is only determined by the maximum acceptable time Tq = Tx max (Nx = 1). The high boundary Fbound is determined only by the greatest possible frequency of count for timers/counters and frequency dividers. Thus, the width of the frequency range in the common case is equal to:

images

5.7.9 Dynamic range

Let's determine the dynamic range of the frequency-to-code converter based on the hardware realization of the method of the dependent count. The decrement counters, used for its realization, limit the width of the range Df. The high bound Fbound is determined by the maximum acceptable frequency fclc, which can be calculated by these counters, and the low fbound by the number of 16-bit counters. Therefore

images

Table 5.1 Dynamic range at Δδq = 0.5δ

images

With regard for the above, the decrease of the error δq relative to the specified δ does not exceed the values:

images

Having accepted for simplification ΔNmaxτF, Nx = 1, and N ≈ 2Nδ, we receive the formulas for determination fbound, Fbound and Df:

images

The calculated results according to the Equation (5.41) for that case, when Δδq = 0.5 δ, are adduced in Table 5.1. The width of the frequency range Df is shown in Table 5.2.

The possibilities of the symmetrical extension and shifting of the range Df by the decrease of the error δ and the change of the frequency f0 are obvious from these tables. By the decrease of the error δ the range Df symmetrically extends concerning the middle–the frequency f0, for which:

images

The time Tq is minimum possible:

images

Table 5.2 The width of the frequency range Df

images

In frequency counters based on traditional methods of measurement, the relative quantization error δq increases according to the hyperbolic law by the decrease of the measurand frequency fx or the period Tx:

images

Therefore, their range Df is much narrower. It is asymmetric concerning the frequency f0 and equals only to one decade. Thus δq = 10δfrequency and δq = 10δperiod at fx = 0.1 fxNom Tx = 0.1TxNom. Unlike the method of the dependent count the quantization window Tq and the quantization frequency fq remain constant within the limits of one decade:

images

They are redundant for all measurand frequencies and periods from the range Df, except the nominal one. Further increase of the range Df is possible. However, it requires additional hardware and special technical solutions.

The method of the dependent count allows to set not only the maximum error δ, that does not depend on the measurand frequency, but also the coefficient k > 0.5 (for example, k = 0.9–0.98 or lower). This coefficient can be used for limitation from below the error δq (in the boundaries kδ < δq < δ) and from above the time Tq. However, the range Df (kδ) is narrowed down. In this case, Equations (5.41) should be rewritten:

images

images

The ways of the extension of the range Df() or its shifting remain similar to those explained above. The δ decreasing does not require additional hardware.

5.7.10 Accuracy of frequency-to-code converters based on MDC

The accuracy of conversion and metrological reliability are the most important performances of a smart sensor. The main components of static and dynamic errors of the method of the dependent count are shown in Figure 5.14.

The static error is stipulated by the trigger error, the reference frequency instability, the quantization error and the calculating error. The latter is determined by calculation of the result of measurement according to the specified formulas with the use of the numbers Nx, ΔN and consequent rounding of the result.

images

Figure 5.14 Components of static and dynamic errors

The dynamic error is stipulated by the change of the measurand frequency during the time interval Tq and between the cycles of measurement. The method of the dependent count organizes the two-channel mode of continuous frequency measurement without loss of speed and accuracy. In this case, the dynamic error will be determined only by duration of the quantization window Tq.

The maximal δf max and the mean-square static errors σf are determined as:

images

images

where δTriggerErrormax and σTriggerError, δq max and σq, δ0 max and σ0, δCalculation and σCalculation are the maximal relative and the mean-square trigger error, the quantization error, the reference frequency error and the calculation error, respectively.

At first, let us consider the components of the static error.

5.7.11 Calculation error

The use of modern μP and μK realizes the condition rather easily:

images

5.7.12 Quantization error (error of method)

images

It is determined by the program-specified error δ and does not depend on the measurand frequency. It is supposed, that the counters do not bring in the additional component to this error because of the time and temperature trigger instability.

5.7.13 Reference frequency error

The reference clock quartz generator (with the period T0 and the duration τ image T0 (Figure 5.12) is a source of the error δ0. Its influence on the result follows from the definition of the measurand frequency according to the method of the dependent count (Equations (5.18) and (5.19)). It is stipulated by the long-term and short-term frequency instability:

images

The change of the frequency f0 at the constant measurand frequency fx will result in changing of the number N, and consequently, of the result. In the mode, when fx > 0, the time interval Tq will be varied. Thereof the result of measurement will be also changed.

The long-term changes depend on the systematic deviations of the frequency f0 stipulated by the time drift. It is 10−9–10−11 for one day, and causes the systematic component of the error δ0.

The short-term changes depend on the frequency fluctuation. They cause the random component of the error δ0 because of short-term temperature and time drifts.

The systematic component of the error δ0 can be reduced by the correction of the frequency error up to the random level. In practice it is necessary to take into account only temperature and time instabilities, that is equal to ≈10−7–10−9 and is determined by the quality factor of a quartz resonator. The last one can achieve the value 50 × 10−6 and higher for precision quartz resonators. Due to this the random variation of the frequency of the reference generator can be not worse than 10−11.

Therefore, the error δ0 should be considered as a random error with the uniform distribution law within the boundaries ±δ0 max:

images

The temperature control and temperature compensator for quartz generators reduce the error δ0 max and increase considerably the frequency stability.

The use of external generators with more stable reference frequency, connected with the atomic frequency standard is rather perspective. The caesium and rubidium frequency standards are widely used in this case. Their instability does not exceed (2–3) × 10−12 and (1–3) × 10−11 accordingly. For example, the use of the device OFS2/2 from Gould Advance Corporation guarantees the frequency stability not worse than ±1 × 10−10 during 1000 seconds. It determines the maximal value of the period Tx = Tq, which can be measured with such stability.

As the relative error δ can be varied over a wide range, each time, when δ > δ0 max in 3–5 times it is possible to consider the latter very little and not take into account Equations (5.48) and (5.49).

5.7.14 Trigger error

The input blocks F1 and F2 (Figure 5.11), consist of an attenuator, a controlled amplifier and a Schmitt trigger. They select the period of the input signal and form the sequence of rectangular impulses with the period T′x and the duration t image T xmin, and ensure the triangular unbiased distribution law of the quantization error δq. Because of incomplete signal processing limited by possibilities of the F1 and F2, the period T′x differs from the real period Tx of the frequency fx on the value ±ΔTx = ±δTriggerError Tx. The quantization window T′ q = NxTx′ will differ from the conventional true value Tq on the value ±NxΔTx′ which can be large. Therefore, the accuracy of the frequency-to-code converter can be determined by the error δTriggerErrormax, instead of the errors δ0 max and δq max. Especially it is characteristic for conversion of low frequencies of the harmonic signal (Nx → 1).

The first of two components of the images is the trigger level setting error due to deviation of the actual trigger level from the set trigger level. The second component of the error δTriggerErrormax occurs when the measurement starts or stops too early or too late because of noise on the input signal. At rather low noise level the influence on the selection of the period Tx can be reduced and even eliminated by a choice of the trigger hysteresis. The smooth narrow-band noise changes the moment of operation of the input device and can also reduce to greater difference of the duration Tx′ from the Tx. In all cases, the noise appears both at the beginning and at the end of each period of the input signal. By the broadband noise, it is difficult to determine the period Tx, as the time intervals between adjacent operations of the input device do not characterize the period Tx any longer. Special measures, for example, the usage of input filters with the cut-off frequency are necessary for the elimination of this influence:

images

Thus, fluctuations of the operation level and noise reduce work of the trigger up to or after the necessary moment. Therefore because of such a false operation of the Schmitt trigger, the time interval Tq′ = Tq ± NxΔtx′ will be quantized by impulses with the period T0 if fxf0 or Tq = NxT0 by impulses with the period Tx = Tx± ΔTx, if fx > f0 instead of the interval Tq = NxTx. If special measures are not employed, there will be an absolute error of measurement of the frequency Δfx.

The mean-square value of the deviation ΔTx of the period Tx of a harmonic signal and the relative error of definition of its conventional true value are determined as in [95]:

images

where VNeff is the effective noise voltage; Vm is the amplitude of the sinusoidal voltage of the measurand frequency.

Even the low noise reduces in significant errors images. So, for example, if Vm = 10 V, VNeff = 0.1 V (1% in relation to the input signal) and the quantization level Vq = 0.3 V, the error will be images ≈ ±0.225%. As it was determined at a signal/noise ratio equal to 40 dB the error will be images = 0.3%.

With the aim of decreasing the images it is necessary to quantize some periods images. In this case, the error images will be decreased Nx times. In the case when higher frequencies are measured and Nx image 1, the error images can be neglected.

By the measurement of the frequency of impulse sequence, the error images will decrease. In this case, it depends on the number Nx, the period Tx, the set trigger level, its drift Δ and the wavefront steepness S [95]:

images

The error images can also be neglected by measuring frequency fx of pulses with steep wavefronts.

Now let us consider the dynamic error and its components. By frequency measurements, this error essentially depends on the dynamic properties of the researched process and the speed of the method of measurement. The decrease of the dynamic error is possible by the increase of speed and continuous correction of the measurement results.

The method of the dependent count has the highest speed at measurement of all frequencies of the range Df and consequently allows reduction of the dynamic error for the same frequencies of researched physical values, as well as for traditional methods of measurement. The main components of the dynamic error are the tracking error and the approximating error.

The first component depends on the time Tq. The result of the measurement of duration of the period or several periods of low frequencies composing the time Tq, corresponds to their average value on the time interval equal to their duration. The inevitable availability of such an average and also the change of the researched value during the latency time if it is not eliminated, is the reason of the rise of the so-called average error.

The second component is the approximation error of the continuously varying value of the lattice function with the appropriate approximation between points of its discrete values. The approximation error is determined by the digitization interval and a kind of approximation. In one-channel and multichannel measuring instruments the digitization interval cannot be lower than the time of the measurement Tq.

The decrease of the dynamic error can be reached by minimization of the time Tq by the choice of the algorithms, the eliminating latency time of the next cycle of conversion.

The dynamic error should not exceed the static. Under this condition, the acceptable time Tq at the known frequency of change of the researched value and its maximum value at the selected Tq are determined. This algorithm can also be used at higher frequencies of the range Df, if the time of the measurement is large, even in the case of the method of the dependent count.

5.7.15 Simulation results

The quantization error δq is the function of many variables and is determined by the given relative error δ and the frequencies f and F. This function δq(δ, F, f) is piecewise-smooth and has a final number of discontinuities of the first kind. In this analysis of the family of characteristics we will start from the function δq(δ, F) at f = const. All characteristics of the given family are symmetric concerning the middle of the range Df(δi, F). In this point ΔN = 0 and f = F. Therefore in these points and their neighbourhoods δq = δq max = δ. Change of the ordinate δi for any of these functions at F = const reduces in its parallel moving up (down) at increase (decrease) of the error δi. By this, the range Df, within the limits of which the condition (5.36) is satisfied varies. If the counter capacity is sufficient, the frequency measurement outside the range Df with the errors δq < 0.5 δ is possible. Simultaneously the number Nbreak of discontinuity of the first kind will be varied. By this, their number is increased with decrease of the error δ.

The change of the frequency F at δ = const reduces the shift of the characteristic of the family towards low frequencies, at its decrease, and towards high ones, at its increase, without the change of the range Df. However, the maximum measurand frequency fmax ≤ 2F therefore will be varied.

Now let's consider the characteristic δq(f, F) at δ = const. If the frequency f varies relatively to the F, the dependence of the error δq from the frequency f becomes apparent in a various degree from some value. Due to the self-adopting of the method this dependence is expressed much more poorly than in the traditional methods of comparison. The number ΔN is increased from 1 up to ΔNmax symmetric relatively to the frequency F = f0 boundaries fbound and Fbound of the range Df because of the automatic change of the Dirichlet window. The error δq is decreased from δ up to the minimal value δq min = 0.5δ. In the common case, on the boundaries Df:

images

Let us investigate the required frequency dependence of the error δq, its jumps in the points Nbreak, the boundaries of the discrete steps and their value Δδq in more detail. For simplification we shall consider only the first half of the D1 of the range Df of the function δq(f, F), in which f = fxF0 = F and δ = const and f0 = const. Due to the symmetry, the obtained results will also be true for the second half of the D2 of the range Df.

The mathematical analysis of the function δq(fx, f0) on continuity has confirmed the availability of discontinuities of the first kind and has shown, that by the change of the frequency fx in the last interval (Nx − 1)TxNxTx in the quantization window Tq the change of the number N is a reason for jumps in the points Nbreak. It makes the following conclusions.

(1) The values of the jumps Δδqi, the number ΔNi = tif0 and the time intervals 0 ≤ t′ ≤ Tx are decreased and tend to zero by the increase of the frequency fx. Therefore in this greater part of both halves of the range Df contiguous to its middle, the plot of the function δq(fx, f0) presents a significant number of slanting sites of hyperbola of various lengths, divided by the jumps Δδqi in the points Nbreak with co-ordinates:

images

In accordance with the decrease of the number ΔNi the value of the jumps Δδqi decreases, and the segments of the hyperbolas δq(fx, f0) juxtapose up to full junctions and coincide with the plot of a hypothetical (ideal) method. The latter represents a direct line, parallel to the axis of frequencies with the ordinate δ. Therefore the error δq practically does not depend on the frequency fx (Figure 5.15(a). Such a dependence is saved by the change of the frequency f0 over the wide range and the error δ = 0.0005–0.00005.

(2) By the decrease of the frequency fx the Dirichlet window is extended. The duration ti, the number ΔNi and Δδqi between adjacent partial segments of hyperbolas composing the function δq(fx, f0) is increased. On the low bound fbound the number ΔN = ΔNmax = Nδ − 1, the error δq = δq min = 0.5δ, and Δδq = 0.5δ.

The simulation results of the functions δq(fx, f0) for a wide range of low frequencies are shown in Figure 5.15(b). The segment of the piecewise-smooth function composed from the partial segments of the hyperbolas at f0 = 20 kHz and fx images 1–8 Hz is shown in the foreground of the figure. The analysis of these functions for other values of f0 has confirmed the dependence of the error δq from the fx in the extreme minority of the range D1 that exists and weakens by the increase of the f0.

Thus, in both cases the error δqi never exceeds the given value δi in the whole range Df of measurand frequencies from fbound up to Fbound. Each function from the set δqi(fx, f0) at δi = const is piecewise-smooth. It consists of the final number of partial segments of hyperbola divided by jumps of the various value δΔqi in the discontinuities Nbreak of the kind. Their number considerably increases by the decrease of the program-specified error δ.

Let's determine the boundaries of discontinuities of the piecewise-smooth function δq(δ, fx) and the value of the jumps Δδq in the points Nbreak between them. For that purpose, we shall take the advantage of a known technique and Equation (5.58). By the increase of the frequency fx and approximation to the point Nbreak from the left the error δq goes to the limit:

images

Figure 5.15 Simulation results: (a) the dependence of the quantization error on the frequency in the whole range of measurand frequencies; (b) the dependence of the quantization error on frequency in the low frequency range; (c) the dependence of time of measurement on frequency and error of measurement

images

and the left-side boundary of the function will be formed.

By the decrease of the frequency fx and approximation to the point Nbreak from the right the error δq goes to the limit:

images

and the right-side boundary of the function will be formed.

As δq(Nbreak–0) ≠ δq(Nbreak + 0), the function has the discontinuity in the point Nbreak and the finite jump Δδq, determined as:

images

The negative sign specifies that the left boundary is always more than the right one and by the decrease of the frequency fx the error δq decreases and the jump Δδq increases. By this, the time Tq is increased at the cost of the extension of the Dirichlet window. As follows from Equations (5.17) and (5.18), the Dirichlet window practically does not depend on the measurand frequency. It is variable and non-redundant for each of the frequencies from the range D1 and is set up automatically during the measurement. Therefore, in comparison to all known methods, the method of the dependent count is a self-adopted method. Due to this, the method has high metrological performances. The real function δq(fx, f0) coincides in greater part of the range with ideal, hypothetical. The simulation results of the set of the functions tx(δ, fx) at f0 = const are shown in Figure 5.15. They confirm high dynamic properties of the method, due to which the dynamic error of the measurement is minimal possible.

5.7.16 Examples

In order to compare the method of the dependent count with the standard counting methods as well as with other advanced methods for the frequency-to-code conversion let us determine the coefficient of variation for the quantization error α = δq max /δq min for these methods. So, for the method of the dependent count if fx is lower of two frequencies (fx = f), and f0 is greater of the frequencies (f0 = F), i.e. fx < f0, from the following equations

images

and taking into account Equation (5.34) we will have

images

or

images

At fx > f0

images

Let's determine how many times the quantization error will be varied by the measuring frequency fx = 2 Hz, if f0 = 106 Hz and Nδ = 106 (δ = 10−6 × 100% = 0.0001%). From Equation (5.64) we have

images

i.e. the greatest error δmax = 1/Nδ = 10−6, and the lowest δmin = 0.67 × 10−6. As the greatest quantization error for the method of the dependent count is constant for any measurand, it is possible to characterize the possible range of variation of this error in the specified measuring range of frequencies by the coefficient of variation α. From this example it follows that the error variation is not more than 1.5 times in the frequency range 2–106 Hz (the time of the measurement is constant for the given quantization error). By the use of the standard direct counting method or the indirect method measuring period, the variation of the quantization error will be 500 000 (at the same time of measurement).

Let us consider another example. It is necessary to measure fx = 104 Hz at f0 = 106 Hz and Nδ = 104. According to the method of the dependent count the maximum time of conversion (5.17) is

images

In turn, according to the standard counting method, the time of measurements necessary for the same accuracy is Tq max = 0.5 sec. In other words, the time of measurement for the proposed method is non-redundant in all specified measuring ranges of frequencies. In the standard counting method, the time of measurement is redundant, except for the nominal frequency. Moreover, for the method of the dependent count the time of measurement can be varied during measurements depending on the assigned error.

5.8 Method with Non-Redundant Reference Frequency

Power consumption and dissipation on the elements becomes actual by smart sensor creation. The dynamic average power of a circuit can be given as

images

where VDD is the supply voltage; fclc is the clock frequency; Ceff is the effective capacitance of the circuit [126]. VDD and Ceff are constant for the specific integrated circuit and technology. For many smart sensors VDD is reduced up to 2.8–3.5 V. The power consumption is directly proportional to the system clock. If the clock speed doubles, the current doubles. Obviously, power can be saved by operating the device at the lowest possible clock speed [127]. The reduction of fclc is in contradiction to that necessary to increase the metrological performances for precise measurements. In the majority of methods for frequency-to-code conversion, the reference frequency f0 directly influences the conversion accuracy: the reduction of f0 will increase the quantization error. In order to eliminate this inconsistency, another self-adapting method of frequency-to-code conversion with non-redundant reference frequency f0 was proposed [114].

The essence of this method consists of the following. The embedded microcontroller or the arithmetic unit calculates the value of the necessary reference frequency according to the given quantization error δi:

images

where k = 1/T0 = const (T0 is the first reference gate period). The reference frequency f0i, which is received by division/multiplication of the clock frequency fclc and the measurand frequency of a quartz generator is calculated by two counters. The time of measurement is equal to the integer number of periods of fx. This frequency is calculated similarly, as for the majority of advanced methods for frequency-to-code conversion:

images

The quantization error does not exceed that given beforehand:

images

Similar to the other advanced methods for frequency-to-code conversion, this method ensures a constancy of the quantization error in the total specified measuring range of frequencies–from infralow up to high frequencies. Besides that, the reference frequency f0i is non-redundant and determined by the given quantization error δi. Thus, by the use of the method with the non-redundant reference frequency in smart sensors it is possible to receive further benefits. It has a high accuracy of measurement, a constancy of the quantization error and a reduction of the power dissipation during the conversion by the use of the lower (on the average by 1–2 order) reference frequency.

Modern achievements in microelectronics easily realize this method with the minimum possible hardware. The MSP430 microcontroller family for metering applications from Texas Instruments [128] is the most appropriate for realization of such a method for frequency-to-code conversion. These microcontrollers have capabilities that make them suitable for low-power embedded applications. As follows from this reference, one of the main characteristics of a power-efficient microcontroller core is the flexible clocking. This performance makes the MSP430 microcontroller family ideally appropriate.

The system clock frequency fsystem in the MSP430 microcontroller family depends on two values:

images

where N(3 − 127) is the multiplication factor; fcrystal is the frequency of the crystal (normally 32 768 Hz). The normal way to change the system clock frequency is to change the multiplication factor N. The system clock frequency control register SCFQCTL is loaded with (N − 1) to achieve the new frequency [129].

images

Figure 5.16 Connection of frequency-time domain signal to the MSP430

Figure 5.16 shows the connection of the frequency signal to the MSP430 microcontroller. It can be connected to any of the eight inputs of Port0 and counted via the interrupt. If the frequencies to be measured are above 30 kHz then the universal timer/port or the 8-bit interval timer/counter may also be used for counting. The first reference time window is formed by the basic timer.

If the information to be converted is represented by pulse distances or pulse widths then it is also easy to be converted with the MSP430. The left part of Figure 5.16 shows how to do this.

The signal to be converted is connected to one of eight inputs of Port0. Each one of these I/Os allows interrupt on the trailing and on the leading edge. With the basic timer an appropriate timing is selected for the required resolution and the conversion is made. The universal timer/port may be used for this purpose too: the pulse to be measured is connected to the pin CIN and the time measured from edge to edge.

Even better resolution is possible with the Timer_A. The input signal is connected to one of the TA-inputs and the capture register is used for the time measurements.

5.9 Comparison of Methods

For choice of method for frequency-to-code conversion, it is expedient to prefer one that has high metrological characteristics and simple realization by its universality. The main performances of all the methods considered above are adduced in Table 5.3. Here number 1 is the indirect counting method (period measurement); 2 is the standard direct counting method (frequency measurement); 3 is the ratiometric counting method; 4 is the reciprocal counting method; 5 is the M/T counting method; 6 is the constant elapsed time (CET) method; 7 is the single-buffered and double-buffered method; 8 is the DMA transfer method; 9 is the method with the non-redundant reference frequency; 10 is the method of the dependent count.

Table 5.3 Main performances of methods for frequency-to-code conversion

images

images

Figure 5.17 Width frequency ranges Df for different methods of frequency-to-code conversion

As it can be seen from the table, the majority of modern advanced counting methods overcome the demerit inherent to classical conversion methods. Namely, it means the inconstancy of the quantization error in all specified ranges of converted frequencies. However, most of them (methods with the constant conversion time as well as with the slightly varied conversion time) have a redundant conversion time for all frequencies, except the nominal one. The exceptions are the method of the dependent count and the classical indirect counting method (period measurement). Only one of methods, namely the method of the dependent count measures the frequency fxf0, and only one method, namely method 9 has the non-redundant reference frequency.

Conversion ranges for all considered methods are shown in Figure 5.17.

5.10 Advanced Method for Phase-Shift-to-Code Conversion

The phase shift φx between two periodic sequences of pulses with the period Tx can be converted by the method of coincidence [104]. Time diagrams of the method are shown in Figure 5.18. In this case the number N1 pulses with the period T0 and the number N1 pulses of the first sequence Tx between coincident pulses of these sequences is counted. Then

images

Similarly, the number N2 of pulses T0 and the number N2 of the second sequence with the period Tx, shifted on the tx and taking place between the first moment of coincidence of the first pair of pulses and the nearest moment of coincidence of the second pair of the pulse are counted. Then

images

From these two equations, we receive the formula for the phase-shift calculation

images

images

Figure 5.18 Time diagrams of the method of coincidence for phase-shift-to-code conversion

and for the converted time interval

images

The analysis of Equations (5.71) and (5.74) shows that φx and tx do not depend on the period Tx. Conversion errors will be determined mainly by pulses duration only. For reduction of these errors, the method of forming of pulse packets of coincidences can be used. Thus, the absolute error of measurement for tx can be reduced up to 0.5 × 10−12 s and the absolute conversion error for the phase shift φx up to 0.05° at 1 MHz.

Summary

Due to advanced methods for frequency-to-code conversion, it is possible to achieve a constant quantization error for all ranges of converted frequencies.

The method of the dependent count is optimal for microcontroller-based frequency-to-code converters of a new generation for the measurement of absolute and relative frequencies in smart sensors. The developed conversion technologies based on the method of the dependent count open the possibilities of the creation of frequency-to-code converters of a new generation.

The accuracy of conversion is one of the most important quality factors for smart sensors that together with reliability characterize their serviceability and high metrological trustiness of obtained results. In traditional methods and frequency-to-code converters it predetermines such metrics of the economic efficiency as dimensions, the weight, the power consumption and the cost price. As a rule, cheaper converters have low accuracy and reliability. The method of the dependent count breaks this link and ensures higher metrics economic efficiency. Among them are:

  • The self-adapting mode of measurement for frequency or a period, absolute and relative deviations and ratios. Due to this mode the error of conversion is constant for a wide range of measurand frequencies and the maximal quantization error does not depend on latter.
  • Intellectualization of the measurements.
  • Programmability of characteristics and functionalities at high metrological trustiness of the obtained results.
  • The non-redundant conversion time for all frequencies of the measuring range: from infralow up to high frequencies. Due to this the time of quantization is a variable, set up individually during the quantization for each of frequencies according to the program-specified relative error and thereof is minimal possible.
  • The possibility to measure various electrical and non-electrical values transformed beforehand into the frequency with representation of the results into program-specified units.
  • The parallelism at synchronous measurements of frequencies practically without the degradation of metrological and dynamic characteristics.
  • High efficiency of measurements by super accurate measurement by using an external frequency standard.
  • The possibility of creating virtual measuring instruments and systems.

All these are possible due to the simple circuitry and the use of the computational power (microcontroller) as part of the measuring channel.

Due to the method of the dependent count precision and multifunctional smart sensor systems will be more available for customers for the execution of reference measurements at the level of accuracy and stability of the physical constants, as, for example, in the case of the proposed measuring instrument of the magnetic induction based on nuclear magnetic resonance [130].

The method of the dependent count (the method with the non-redundant conversion time) and the method with the non-redundant reference frequency are self-adapting. The first chooses automatically the required conversion time in order to provide the set value of the conversion error. The second method chooses automatically the reference frequency on the set value of the conversion error, thus saving the power consumption in those conditions of the measurement when a precise conversion is not required.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.81.240