AN753
M
Digital Coding Schemes for Mixed Signal Communication
Author:
Bonnie C. Baker
Median Analog Voltage
(V)
Digital Code
Microchip Technology Inc.
0.9375 FS (15
0.875 FS (14
16 FS)
0.8125 FS (13
16 FS)
0.75 FS (12
16 FS)
0.6875 FS (11/16 FS)
/
16 FS)
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
0000
OVERVIEW
/
An Analog-to-Digital (A/D) converter translates an ana-
log input signal into a discrete digital code. This digital
representation of the “real world” signal can be manip-
ulated in the digital domain for the purposes of informa-
tion processing, computing, data transmission or
control system implementation. In any application
where a converter is used, it is advantageous to have
the code structure complement the microcontroller’s
operands.
This application note describes the straight binary and
binary two’s complement code schemes that are out-
putted by Microchip’s Analog-to-Digital (A/D) convert-
ers.
/
/
0.625 FS (10
/16 FS)
0.5625 FS (9/16 FS)
0.5 FS (8/16FS)
0.4375 FS (7/16 FS)
0.375 FS (6/16 FS)
0.3125 FS (5/16 FS)
0.25 FS (4/16 FS)
0.1875 FS (3/16 FS)
0.125 FS (2/16 FS)
0.0625 FS (1/16 FS)
0
All code examples given in this application note are for
a 4-bit conversion. The median analog voltages in the
tables are the equivalent analog voltages that are at the
center of the digital code.
STRAIGHT BINARY CODE
TABLE 1:
The unipolar straight binary code
representation of zero volts is equal to a digital (0000).
The analog full-scale minus one LSB digital
representation is equal to (1111). With this code, there
is no digital representation for analog full-scale.
The straight binary code is more accurately called uni-
polar straight binary. This digital format for an A/D con-
version is the simplest to understand. As the name
implies, this coding scheme is used only when positive
voltages are converted. An example of this type of cod-
ing is shown in Table 1.
When this scheme is used to represent a positive ana-
log signal range, the digital code for zero volts is equal
to zero (0000 per Table 1). Given an ideal converter
with no offset, gain, INL or DNL error, the code transi-
tion from 0000 to 0001 occurs at the analog value of:
The A/D converters from Microchip that produce a
straight binary output code are from the MCP320X (12-
bit) and the MCP300X (10-bit) families.
These devices can be operated in a single ended, pos-
itive voltage input mode or a pseudo-differential input
mode, but in both cases the digital output represents a
positive input voltage. In the pseudo-differential mode,
the IN- input is limited to ±100 mV. This can be used to
cancel small noise signals present on both the IN+ and
IN- inputs. This provides a means of rejecting noise
when the IN- input is used to sense a remote signal
ground. The converter will produce digital code that
represents the analog input when the IN+ input range
is from IN- to (VFS -1 LSB). When the voltage level of
IN+ is less than IN-, the resultant code for the family of
devices will be still be ‘0’, which does not represent a
negative voltage.
1
2
First Code Transition = 0 + LSB
--
1
2
Second Code Transition = 1LSB + LSB
--
where:
+FS
LSB = ----------
2n
where:
n is equal to the number of bits in the converter
+FS is equal to the analog full-scale range.
2001 Microchip Technology Inc.
DS00753A-page 1