Interfacing with the MCP3202 Dual A/D

copyright, Peter H Anderson, Baltimore, MD, Oct, '04

This is an addendum to my discussion of the Microchip MCP3208 which provides eight 12-bit A/D converters.

In some cases, one simply does not need eight 12-bit A/Ds and the Microchip MCP3202 Dual A/D at nominally $2.50 might be a more appropriate selection.

The A/D may be configured for either single ended Ch0 or C1 or differential Ch0 relative to Ch1 or Ch1 to Ch0.

The operation differs somewhat from the MCP3208 in that the exchange consists of three bytes.

An implementation of ADMeas appears below. Note that the supporting SPI routines are the same as in my discussion of the MCP3208.

   SCK = 0
   CS = 0
   X = %00000001	' start bit
   GoSub SPI_IO
   X = %10100000    ' Single ended, channel 0.  For other modes, see text
   ' ignore any input from the MCP3202
   GoSub SPI_IO
   ADVal = X * 256
   GoSub SPI_IO
   ADVal = ADVal + X
   ADVal = ADVal & $0fff	' result returned in ADVal
   CS = 1

Note that the MCP3202 is available in a DIP package with a specified accuracy of either one or two least significant bits.