Digital Converter. AN546 Datasheet 


M
AN546
Using the AnalogtoDigital (A/D) Converter
Authors:
Sumit Mitra,
Stan D’Souza, and
Russ Cooper
Microchip Technology Inc.
www.DataSheet4U.com
INTRODUCTION
This application note is intended for PIC16C7X users with
some degree of familiarity with analog system design.The
various sections discuss the following topics:
• Commonly used A/D terminology
• How to conﬁgure and use the PIC16C71 A/D
• Various ways to generate external reference
voltage (VREF)
• Conﬁguring the RA3:RA0 pins
COMMONLY USED A/D
TERMINOLOGY
The Ideal Transfer Function
In an A/D converter, an analog voltage is mapped into
an Nbit digital value. This mapping function is deﬁned
as the transfer function. An ideal transfer is one in which
there are no errors or nonlinearity. It describes the
“ideal” or intended behavior of the A/D. Figure 1 shows
the ideal transfer function for the PIC16C7X A/D.
FIGURE 1: PIC16C7X IDEAL TRANSFER
FUNCTION
FFh
FEh
Note that the digital output value is 00h for the analog
input voltage range of 0 to 1LSb. In some converters,
the ﬁrst transition point is at 0.5LSb and not at 1LSb as
shown in Figure 2. Either way, by knowing the transfer
function the user can appropriately interpret the data.
Transition Point
The analog input voltage at which the digital output
switches from one code to the next is called the “Tran
sition Point.” The transition point is typically not a single
threshold, but rather a small region of uncertainty
(Figure 3). The transition point is therefore deﬁned as
the statistical average of many conversions. Stated dif
ferently, it is the voltage input at which the uncertainty
of the conversion is 50%.
Code Width
The distance (voltage differential) between two
transition points is called the “Code Width.” Ideally the
Code Width should be 1LSb (Figure 1).
FIGURE 2: ALTERNATE TRANSFER
FUNCTION
FFh
FEh
Code Width
(CW)
04h
03h
02h
01h
00h
Analog input
voltage
04h
03h
02h
01h
00h
Analog input
voltage
© 1997 Microchip Technology Inc.
DS00546Epage 1

AN546
Center of Code Width
The midpoint between two transition points is called the
“Center of Code Width” (Figure 3).
FIGURE 3: TRANSITION POINTS
7
6
5
www.DataSheet4U.com
4
0%
3
2
1
0
Code
under
test
100%
50%
Center of
code width
Low side
transition
Transition
points
Differential NonLinearity (DNL)
It is the deviation in codewidth from 1LSb (Figure 4).
The difference is calculated for each and every
transition. The largest difference is reported as DNL.
It is important to note that the DNL is measured after
the transfer function is normalized to match offset error
and gain error.
Note that the DNL cannot be any less than 1LSb. In the
other direction, DNL can be >1LSb.
FIGURE 4: DIFFERENTIAL NONLINEARITY
7
DNL = 1/4 LSb
6
5
4
DNL = +3/4 LSb
Ideal transfer
function (for
reference only)
3
Actual transfer
function
2
1
0
DNL = 1/4LSb to +3/4LSb
Absolute Error
The maximum deviation between any transition point
from the corresponding ideal transfer function is
deﬁned as the absolute error. This is how it is measured
and reported in the PIC16C7X (Figure 5). The notable
difference between absolute error and integral nonlin
earity (INL) is that the measured data is not normalized
for full scale and offset errors in absolute error.
Absolute Error is probably the ﬁrst parameter the user
will review to evaluate an A/D. Sometimes absolute
error is reported as the sum of offset, fullscale and
integral nonlinearity errors.
Total Unadjusted Error
Total Unadjusted Error is the same as absolute error.
Again, sometimes it is reported as the sum of offset,
fullscale and integral nonlinearity errors.
No Missing Code
No missing code implies that as the analog input volt
age is gradually increased from zero to full scale (or
vice versa), all digital codes are produced. Stated
otherwise, changing analog input voltage from one
quantum of the analog range to the next adjacent range
will not produce a change in the digital output by more
than one code count.
Monotonic
Monotonicity guarantees that an increase (or decrease)
in the analog input value will result in an equal or
greater digital code (or less). Monotonicity does not
guarantee that there are no missing codes. However, it
is an important criterion for feedback control systems.
Nonmonotonicity may cause oscillations in such sys
tems.
The ﬁrst derivative of a monotonic function always has
the same sign.
FIGURE 5: ABSOLUTE ERROR
7
6
Error = 3/4LSb
5
Actual transfer
function
4
Ideal transfer
function
3
Error = 1/4LSb
2
Error = 1/4LSb
1
0
Absolute Error = +3/4LSb
DS00546Epage 2
© 1997 Microchip Technology Inc.

Ratiometric Conversion
Ratiometric Conversion is the A/D conversion process
in which the binary result is a ratio of the supply voltage
or reference voltage, the latter being equal to fullscale
value by default. The PIC16C7X is a ratiometric A/D
converter where the result depends on VDD or VREF.
In some A/Ds, an absolute reference is provided result
ing in “absolute conversion”.
Sample and Hold
In sample and hold type A/D converters, the analog
input has a switch (typically a FET switch in CMOS)
which is opened for a short duration to capture the
www.DataSheet4U.comCanoanlvoegrsiionnpuist
voltage onto
typically started
an
after
onchip capacitor.
the sampling switch
is closed.
Track and Hold
Track and Hold is basically the same as sample and
hold, except the sampling switch is typically left on.
Therefore the voltage on the onchip holding capacitor
“tracks” the analog input voltage. To begin a conversion,
the sampling switch is closed.
The PIC16C7X A/D falls in this category.
Sampling Time
Sampling Time is the time required to charge the
onchip holding capacitor to the same value as is on the
analog input pin. The sampling time depends on the
magnitude of the holding capacitor and the source
impedance of the analog voltage input.
Offset Error (or Zero Error)
Offset Error is the difference between the ﬁrst actual
(measured) transition point and the ﬁrst ideal transition
point as shown in Figure 6. It can be corrected (by the
user) by subtracting the offset error from each conver
sion result.
FIGURE 6: OFFSET ERROR
7
6
5 Actual transfer
function
4
Ideal transfer
function
3
2
1
Offset error
0
AN546
Full Scale Error (or Gain Error)
Full Scale Error is the difference between the ideal full
scale and the actual (measured) full scale range
(Figure 7). It is also called gain error, because the error
changes the slope of the ideal transfer function creating
a gain factor. It can be corrected (by the user) by multi
plying each conversion result by the inverse of the gain.
FIGURE 7: FULL SCALE ERROR
FFh
FEh
FDh
FCh
03h
02h
01h
00h
Actual transfer
function
Ideal
transfer
function
Actual fullscale range
Ideal fullscale range
Integral NonLinearity (INL), or Relative Error
The deviation of a transition point from its
corresponding point on the ideal transfer curve is called
“Integral NonLinearity” (Figure 8). The maximum dif
ference is reported as the INL of the converter.
It is important to note that Full Scale Error and the
Offset Error are normalized to match end transition
points before measuring the INL.
FIGURE 8: INTEGRAL NONLINEARITY
7
6
Deviation = +3/4LSb
5
Actual transfer
function
4
Ideal transfer
function
3
Deviation
2 = +1/4LSb
Deviation
1 = 11/4LSb
0
INL in this example is 1/4LSb to +3/4LSb
© 1997 Microchip Technology Inc.
DS00546Epage 3

@ 2014 :: Datasheetspdf.com :: Semiconductors datasheet search & download site (Privacy Policy & Contact) 