3–314
Motorola Sensor Device Data
For More Information On This Product,
Go to: www.freescale.com
The PWM output is most linear when the ramp waveform’s
period consists mostly of the rising voltage edge (see
Figure 2). If the capacitor were allowed to completely
discharge (see Figure 3), a flat line at approximately 60 mV
would separate the ramps, and these “flat spots” may result in
non–linearities of the resultant PWM output (after comparing
it to the sensor voltage). Thus, the best ramp waveform is
produced when one ramp cycle begins immediately after
another, and a slight dc offset disallows the capacitor from
discharging completely.
Exaggerated
Capacitor Discharge
Figure 3. Non Ideal Ramp Waveform for the PWM Output Pressure Sensor
Mcrocontroller
Pulse Train
Ramp
Waveform
The flexibility of frequency control of the ramp waveform via
the pulse train sent from the microcontroller allows a
programmable–frequency PWM output. Using Equation 1 the
frequency (inverse of period) can be calculated with a given
capacitor so that the capacitor charges to a maximum
V of
approximately 2.5 V (remember that the current source needs
approximately 2.5 V across it to output a stable current). The
importance of software control becomes evident here since
the selected capacitor may have a tolerance of
±
20%. By
adjusting the frequency and positive width of the pulse train,
the desired ramp requirements are readily obtainable; thus,
nullifying the effects of component variances.
For this design, the ramp spans approximately 2.4 V from
0.1 V to 2.5 V. At this voltage span, the current source is stable
and results in a linear ramp. This ramp span was used for
reasons which will become clear in the next section.
In summary, complete control of the ramp is achieved by the
following adjustments of the microcontroller–created pulse
train:
Increase Frequency: Span of ramp decreases.
The dc offset decreases slightly.
Decrease Frequency: Span of ramp increases.
The dc offset increases slightly.
Increase Pulse Width: The dc offset decreases.
Span decreases slightly.
Decrease Pulse Width: The dc offset increases.
Span increases slightly.
THE COMPARATOR STAGE
The LM311 chip is designed specifically for use as a
comparator and thus has short delay times, high slew rate,
and an open–collector output. A pull–up resistor at the output
is all that is needed to obtain a rail–to–rail output. As Figure 1
shows, the pressure sensor output voltage is input to the
non–inverting terminal of the op amp and the ramp is input to
the inverting terminal. Therefore, when the pressure sensor
voltage is higher than a given ramp voltage, the output is high;
likewise, when the pressure sensor voltage is lower than a
given ramp voltage, the output is low (refer to Figure 5). As
mentioned in the Pressure Sensor section, resistors R1
and
R2 of Figure 1
comprise the voltage divider that attenuates the
pressure sensor’s signal to a 2.0 V span ranging from 0.25 V
to 2.25 V.
Since the pressure sensor voltage does not reach the
ramp’s minimum and maximum voltages, there will be a finite
minimum and maximum pulse width for the PWM output.
These minimum and maximum pulse widths are design
constraints dictated by the comparator’s slew rate. The
system design ensures a minimum positive and negative
pulse width of 20
μ
s to avoid nonlinearities at the high and low
pressures where the positive duty cycle of the PWM output is
at its extremes (refer to Figure 4 ). Depending on the speed of
the microcontroller used in the system, the minimum required
pulse width may be larger. This will be explained in the next
section.
F
Freescale Semiconductor, Inc.
n
.