Professional Documents
Culture Documents
SYSCLK
AV+
REF
AD1EN
AIN1.0 (P1.0)
AIN1.1 (P1.1) AV+
AIN1.2 (P1.2)
8-Bit
AIN1.3 (P1.3) + SAR
ADC1
AIN1.4 (P1.4)
8-to-1
AMUX X -
8
Start Conversion
010 CNVSTR
011 Timer 2 Overflow
1xx Write to AD0BUSY
(synchronized with
AMX1AD2
AMX1AD1
AMX1AD0
AMP1GN1
AMP1GN0
AD1BUSY
ADC0)
AD1CM2
AD1CM1
AD1CM0
AD1SC4
AD1SC3
AD1SC2
AD1SC1
AD1SC0
AD1INT
AD1CM
AD1TM
AD1EN
Important Note: AIN1 pins also function as Port 1 I/O pins, and must be configured as analog inputs when used as
ADC1 inputs. To configure an AIN1 pin for analog input, set to ‘0’ the corresponding bit in register P1MDIN. Port 1
pins selected as analog inputs are skipped by the Digital I/O Crossbar. See Section “17.1.6. Configuring Port 1 Pins
as Analog Inputs (AIN1.[7:0])” on page 165 for more information on configuring the AIN1 pins.
Rev. 1.4 75
C8051F020/1/2/3
During conversion, the AD1BUSY bit is set to logic 1 and restored to 0 when conversion is complete. The falling
edge of AD1BUSY triggers an interrupt (when enabled) and sets the interrupt flag in ADC1CN. Converted data is
available in the ADC1 data word, ADC1.
When a conversion is initiated by writing a ‘1’ to AD1BUSY, it is recommended to poll AD1INT to determine when
the conversion is complete. The recommended procedure is:
76 Rev. 1.4
C8051F020/1/2/3
1 2 3 4 5 6 7 8 9
SAR1 Clocks
Low Power
AD1TM=1 Track Convert Low Power Mode
or Convert
Low Power
AD1TM=1 Track Convert Low Power Mode
or Convert
1 2 3 4 5 6 7 8 9
SAR1 Clocks
Track or
AD1TM=0 Convert Track
Convert
Rev. 1.4 77
C8051F020/1/2/3
2n
t = ln ------- × R TOTAL C SAMPLE
SA
Where:
SA is the settling accuracy, given as a fraction of an LSB (for example, 0.25 to settle within 1/4 LSB)
t is the required tracking time in seconds
RTOTAL is the sum of the ADC1 MUX resistance and any external source resistance.
n is the ADC resolution in bits (8).
MUX Select
AIN1.x
RMUX = 5k
CSAMPLE = 10pF
78 Rev. 1.4
C8051F020/1/2/3
R/W R/W R/W R/W R/W R/W R/W R/W Reset Value
AD1SC4 AD1SC3 AD1SC2 AD1SC1 AD1SC0 - AMP1GN1 AMP1GN0 11111000
Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address:
0xAB
R/W R/W R/W R/W R/W R/W R/W R/W Reset Value
- - - - - AMX1AD2 AMX1AD1 AMX1AD0 00000000
Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address:
0xAC
Rev. 1.4 79
C8051F020/1/2/3
R/W R/W R/W R/W R/W R/W R/W R/W Reset Value
AD1EN AD1TM AD1INT AD1BUSY AD1CM2 AD1CM1 AD1CM0 - 00000000
Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address:
0xAA
80 Rev. 1.4
C8051F020/1/2/3
R/W R/W R/W R/W R/W R/W R/W R/W Reset Value
00000000
Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address:
0x9C
8-bit ADC Data Word appears in the ADC1 Data Word Register as follows:
Example: ADC1 Data Word Conversion Map, AIN1.0 Input
(AMX1SL = 0x00)
AIN1.0-AGND
ADC1
(Volts)
VREF * (255/256) 0xFF
VREF / 2 0x80
VREF * (127/256) 0x7F
0 0x00
Gain
Code = Vin × --------------- × 256
VREF
Rev. 1.4 81
C8051F020/1/2/3
82 Rev. 1.4
C8051F020/1/2/3
The internal voltage reference circuit consists of a 1.2 V, 15 ppm/°C (typical) bandgap voltage reference generator
and a gain-of-two output buffer amplifier. The internal reference may be routed via the VREF pin to external system
components or to the voltage reference input pins shown in Figure 9.1. Bypass capacitors of 0.1 µF and 4.7 µF are
recommended from the VREF pin to AGND, as shown in Figure 9.1. See Table 9.1 for voltage reference specifica-
tions.
The Reference Control Register, REF0CN (defined in Figure 9.2) enables/disables the internal reference generator
and selects the reference inputs for ADC0 and ADC1. The BIASE bit in REF0CN enables the on-board reference
generator while the REFBE bit enables the gain-of-two buffer amplifier which drives the VREF pin. When disabled,
the supply current drawn by the bandgap and buffer amplifier falls to less than 1 µA (typical) and the output of the
buffer amplifier enters a high impedance state. If the internal bandgap is used as the reference voltage generator,
BIASE and REFBE must both be set to logic 1. If the internal reference is not used, REFBE may be set to logic 0.
Note that the BIASE bit must be set to logic 1 if either DAC or ADC is used, regardless of whether the voltage refer-
ence is derived from the on-chip reference or supplied by an off-chip source. If neither the ADC nor the DAC are
being used, both of these bits can be set to logic 0 to conserve power. Bits AD0VRS and AD1VRS select the ADC0
and ADC1 voltage reference sources, respectively. The electrical specifications for the Voltage Reference circuit are
given in Table 9.1.
REFBE
BIASE
ADC1
AV+
Ref
1
VREF1
VDD 0
External
Voltage R1
Reference
Circuit ADC0
DGND VREF0 Ref
0
DAC0
VREFD
Ref
DAC1 BIASE
Bias to
EN ADCs,
VREF DACs
x2 1.2V
4.7µF 0.1µF Band-Gap
REFBE
Recommended Bypass
Capacitors
Rev. 1.4 91
C8051F020/1/2/3
The temperature sensor connects to the highest order input of the ADC0 input multiplexer (see Section “5.1. Analog
Multiplexer and PGA” on page 43 for C8051F020/1 devices, or Section “6.1. Analog Multiplexer and PGA” on
page 59 for C8051F022/3 devices). The TEMPE bit within REF0CN enables and disables the temperature sensor.
While disabled, the temperature sensor defaults to a high impedance state and any A/D measurements performed on
the sensor while disabled result in undefined data.
R/W R/W R/W R/W R/W R/W R/W R/W Reset Value
- - - AD0VRS AD1VRS TEMPE BIASE REFBE 00000000
Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address:
0xD1
92 Rev. 1.4
C8051F020/1/2/3
If the Port pin has been assigned to a digital peripheral by the Crossbar and that pin functions as an input (for example
RX0, the UART0 receive pin), then the output drivers on that pin are automatically disabled.
1. Disables the digital input path from the pin. This prevents additional power supply current
from being drawn when the voltage at the pin is near VDD / 2. A read of the Port Data bit will
return a logic 0 regardless of the voltage at the Port pin.
2. Disables the weak pull-up device on the pin.
3. Causes the Crossbar to “skip over” the pin when allocating Port pins for digital peripherals.
Note that the output drivers on a pin configured as an Analog Input are not explicitly disabled. Therefore, the
associated P1MDOUT bits of pins configured as Analog Inputs should explicitly be set to logic 0 (Open-Drain output
mode), and the associated Port Data bits should be set to logic 1 (high-impedance). Also note that it is not required to
configure a Port pin as an Analog Input in order to use it as an input to the ADC1 MUX; however, it is strongly rec-
ommended. See Section “7. ADC1 (8-Bit ADC)” on page 75 for more information about ADC1.