English
Language : 

AN929 Datasheet, PDF (2/22 Pages) Microchip Technology – Temperature Measurement Circuits for Embedded Applications
AN929
Frequency Output
Oscillators provide a frequency output proportional to
temperature that can be interfaced to a microcontroller,
as shown in Figure 2. While a Resistor-Capacitor (RC)
operational amplifier (op amp) oscillator can accurately
measure the resistance of an RTD, this circuit is
typically not used with a thermistor because of the large
logarithmic change in the sensor’s resistance over
temperature. The main advantage of a frequency
output is that an ADC is not required. A frequency
output is also useful in applications where the sensor
conditioning circuitry is combined with a remote sensor.
A logic-level output signal is less sensitive to noise than
an analog output signal that transmits information to
the microcontroller.
RTD
Clock
RC op amp
Oscillator
PICmicro®
Microcontroller
FIGURE 2:
Block Diagram of a
Frequency Output Sensor.
The accuracy of the frequency measurement is directly
related to the quality of the microcontroller’s clock
signal. Precision high-frequency microcontroller clock
oscillators are readily available. However, they are
relatively expensive. The two options available to
measure frequency are the fixed time or fixed cycle
methods. The microcontroller resources required for
determining frequency varies depending upon the
processor bandwidth, available peripherals and
desired measurement accuracy.
FIXED TIME METHOD
The fixed time method, shown in Figure 3, consists of
counting the number of pulses within a specific time
window, such as 100 ms. The frequency is then calcu-
lated by multiplying the count by the integer required to
correlate the number of pulses in one second. This
measurement approach inherently minimizes the effect
of error sources (such as jitter) by averaging many
oscillator pulses in the time window. The fixed time
method utilizes a firmware delay or hardware delay
routine. The firmware can poll for input edges, though
this consumes processor bandwidth. A more common
implementation uses a hardware timer/counter to count
the input cycles during a firmware delay. If a second
timer is available, the delay can be generated using this
timer, thus requiring minimal processor bandwidth.
Algorithm:
Count the number of clock pulses in a time window.
Oscillator
Signal
Time Window
Example: Measure the number of oscillation pulses in a
100 msec. window and multiply by 10 to
determine the frequency.
FIGURE 3:
Time Method.
Frequency Output - Fixed
FIXED CYCLE METHOD
In the fixed cycle method, shown in Figure 4, the
number of cycles measured is fixed and the
measurement time is variable. This approach
measures the elapsed time for a fixed number of
cycles. The number of cycles is chosen by the designer
based on the desired accuracy, input frequency,
measurement rate and the microcontroller clock
frequency (FOSC). FOSC determines the minimum time
an edge can be resolved. The measurement error will
then be proportional to the total amount of time versus
FOSC. Increasing the number of cycles measured will
increase the measurement time and reduce the error.
Increasing FOSC will also decrease the minimum time
to resolve an edge, thereby reducing the error.
Algorithm:
Determine the time between a fixed number of oscillation
pulses.
Oscillator
Signal
Time
Example: Measure time between four rising edges of the
oscillation signal.
FIGURE 4:
Cycle Method.
Frequency Output - Fixed
The fixed cycle method can utilize firmware to both
measure time and poll the input edges. This, however,
is processor-intensive and has accuracy limitations.
For example, a more common implementation is to uti-
lize the Capture/Compare/PWM (CCP) module of a
PICmicro® microcontroller configured in the Capture
mode. This approach uses the 16-bit timer TMR1
peripheral and has excellent accuracy and range.
DS00929A-page 2
 2004 Microchip Technology Inc.