
Page 84
DS007-0.4-NOV02
AdvancedInformation
C8051F060/1/2/3
7.1.
Analog Multiplexer
The analog multiplexer (AMUX2) selects the inputs to the ADC, allowing any of the pins on Port 1 to be measured in
single-ended mode, or as a differential pair. Additionally, the on-chip temperature sensor may be selected as a single-
ended input. The ADC2 input channels are configured and selected in the AMX2CF and AMX2SL registers as
described in Figure 7.5 and Figure 7.6, respectively. In Single-ended Mode, the selected pin is measured with respect
to AGND. In Differential Mode, the selected differential pair is measured with respect to one another. The polarity of
the differential measurement depends on the setting of the AMX2AD3-0 bits in the AMX2SL register. For example,
if pins AIN2.0 and AIN2.1 are configured for differential measurement (AIN01IC = 1), and AMX2AD3-0 = 0000b,
the ADC will measure the voltage (AIN2.0 - AIN2.1). If AMX2AD3-0 is changed to 0001b, the ADC will measure
the same voltage, with opposite polarity (AIN2.1 - AIN2.0).
The conversion code format differs between Single-ended and Differential modes. The registers ADC2H and ADC2L
contain the high and low bytes of the output conversion code from the ADC at the completion of each conversion.
Data can be right-justified or left-justified, depending on the setting of the AD2LJST bit (ADC2CN.0). When in Sin-
gle-ended Mode, conversion codes are represented as 10-bit unsigned integers. Inputs are measured from ‘0’ to
VREF * 1023/1024. Example codes are shown below for both right-justified and left-justified data. Unused bits in the
ADC2H and ADC2L registers are set to ‘0’.
When in Differential Mode, conversion codes are represented as 10-bit signed 2’s complement numbers. Inputs are
measured from -VREF to VREF * 511/512. Example codes are shown below for both right-justified and left-justified
data. For right-justified data, the unused MSBs of ADC2H are a sign-extension of the data word. For left-justified
data, the unused LSBs in the ADC2L register are set to ‘0’.
Important Note About ADC2 Input Configuration:
Port 1 pins selected as ADC2 inputs should be configured as
analog inputs. To configure a Port 1 pin for analog input, set to ‘1’ the corresponding bit in register P1MDIN. Port 1
pins used as ADC2 inputs will be skipped by the crossbar for peripheral assignments. See
Section “17. PORT
INPUT/OUTPUT” on page 191
for more Port I/O configuration details.
The Temperature Sensor transfer function is shown in Figure 7.2 on Page 85. The output voltage (V
TEMP
) is a single-
ended input to ADC2 when the Temperature Sensor is selected by bits AMX2AD3-0 in register AMX2SL.
Input Voltage
Right-Justified ADC2H:ADC2L
(AD2LJST = 0)
0x03FF
0x0200
0x0100
0x0000
Left-Justified ADC2H:ADC2L
(AD2LJST = 1)
0xFFC0
0x8000
0x4000
0x0000
VREF * 1023/1024
VREF * 512/1024
VREF * 256/1024
0
Input Voltage
Right-Justified ADC2H:ADC2L
(AD2LJST = 0)
0x01FF
0x0100
0x0000
0xFF00
0xFE00
Left-Justified ADC2H:ADC2L
(AD2LJST = 1)
0x7FC0
0x4000
0x0000
0xC000
0x8000
VREF * 511/512
VREF * 256/512
0
-VREF * 256/512
- VREF