Datasheet
MCP3302/04
DS21697F-page 24 2011 Microchip Technology Inc.
FIGURE 6-1: Output Code Transfer Function.
6.2 Communicating with the MCP3302
and MCP3304
Communication with the MCP3302/04 devices is done
using a standard SPI-compatible serial interface.
Initiating communication with either device is done by
bringing the CS
line low (see Figure 6-2). If the device
was powered up with the CS
pin low, it must be brought
high and back low to initiate communication. The first
clock received with CS
low and D
IN
high will constitute
a start bit. The SGL/DIFF
bit follows the start bit and will
determine if the conversion will be done using single-
ended or differential input mode. Each channel in
Single-ended mode will operate as a 12-bit converter
with a unipolar output. No negative codes will be output
in Single-ended mode. The next three bits (D0, D1, and
D2) are used to select the input channel configuration.
Table 6-1 and Tabl e 6-2 show the configuration bits for
the MCP3302 and MCP3304, respectively. The device
will begin to sample the analog input on the fourth rising
edge of the clock after the start bit has been received.
The sample period will end on the falling edge of the
fifth clock following the start bit.
After the D0 bit is input, one more clock is required to
complete the sample and hold period (D
IN
is a “don’t
care” for this clock). On the falling edge of the next
clock, the device will output a low null bit. The next 13
clocks will output the result of the conversion with the
sign bit first, followed by the 12 remaining data bits, as
shown in Figure 6-2. Note that if the device is operating
in the Single-ended mode, the sign bit will always be
transmitted as a ‘0’. Data is always output from the
device on the falling edge of the clock. If all 13 data bits
have been transmitted, and the device continues to
receive clocks while the CS
is held low, the device will
output the conversion result, LSB, first, as shown in
Figure 6-3. If more clocks are provided to the device
while CS
is still low (after the LSB first data has been
transmitted), the device will clock out zeros indefinitely.
If necessary, it is possible to bring CS
low and clock in
leading zeros on the D
IN
line before the start bit. This is
often done when dealing with microcontroller-based
SPI ports that must send 8 bits at a time. Refer to
Section 6.3 “Using the MCP3302/04 with
Microcontroller (MCU) SPI Ports” for more details on
using the MCP3302/04 devices with hardware SPI
ports.
IN+ > IN-
IN+ < IN-
0 + 0000 0000 0001 (+1)
0 + 0000 0000 0010 (+2)
0 + 0000 0000 0011 (+3)
1 + 1111 1111 1101 (-3)
1 + 1111 1111 1110 (-2)
1 + 1111 1111 1111 (-1)
0 + 1111 1111 1110 (+4094)
0 + 1111 1111 1111 (+4095)
1 + 0000 0000 0000 (-4096)
1 + 0000 0000 0001 (-4095)
Output
Code
0 + 0000 0000 0000 (0)
V
REF
-V
REF
Positive Full
Scale Output = V
REF
-1 LSB
Negative Full
Scale Output = -V
REF
Analog Input
IN+ - IN-
Voltage