English
Language : 

MCP25020-E Datasheet, PDF (41/66 Pages) Microchip Technology – CAN I/O Expander Family
7.0 ANALOG-TO-DIGITAL
CONVERTER (A/D) MODULE
7.1 Description
The Analog-to-Digital (A/D) module is a four-channel,
10-bit successive approximation type of A/D. The A/D
allows conversion of an analog input signal to a
corresponding 10-bit number. The four channels are
multiplexed on the GP[3:0] pins. The converter is
turned off/on via the ADCON0 register and each
channel is individually enabled via the ADCON1 control
register. The VREF+ and VREF- sources are user-
selectable as internal or external. Each channel can be
set to one of two conversion modes:
1. Auto-conversion
2. Convert-on-request.
7.2 A/D Module Registers
The A/D module itself has several registers. The
registers are:
• A/D Control Register 0 (ADCON0)
• A/D Control Register 1 (ADCON1)
• Transmit-on-Change Register (IOINTEN)
• Compare and Polarity Register (ADCMPnL)
• A/D Result Registers (ADRESnL, ADRESnH)
The ADCON0 register controls the operation of the
A/D module, including auto-conversion rate and enable
bit. The ADCON1 register enables the A/D function on
port pins GP3:GP0, A/D conversion rate and selects
the voltage reference source. The IOINTEN register’s
four least significant bits enable/disable the transmit-
on-change function. The ADCMPnL.ADPOL bit sets
the polarity (above or below threshold) for the transmit-
on-change function.
The result of an A/D conversion is made available to
the user within the data field of the Read A/D Registers
output message via the CAN bus. This message can
be directly requested by another CAN node or be
automatically transmitted (TXIDO), as has been
described previously.
Additionally, the individual channel results may be read
using the “Read Register” command as described in
Section 4.3.1 “Information Request Messages” and
as shown in Table 3-2 by addressing the appropriate
A/D result register (ADRESnL and ADRESnH).
Note:
The GPDDR register controls the direction
of the GPIO pins, even when they are
being used as analog inputs. The user
must ensure that the bits in the GPDDR
register are maintained set (input) when
using them as analog inputs.
MCP2502X/5X
7.3 A/D Conversion Modes
There are two modes of conversion that can be
individually selected for each analog channel that has
been enabled. These are auto-conversion and
conversion-on-request.
7.3.1 AUTO-CONVERSION MODE
If the Auto-conversion mode is selected (STCON), an
A/D conversion is performed sequentially for each
channel that has been set to Analog Input mode and
has been configured for Auto-conversion mode.
Conversion starts with AN0 and is immediately
followed by AN1, etc. Once the conversion has
completed, the value is stored in the analog channel
registers for the respective channel.
The rate of the auto-conversion is determined by a
timer and prescaler. The formula for determining
conversion rates is:
(TOSC)(1024)(Prescaler rate)
Typical conversion rates with a 20 MHz oscillator input
are shown in Table 7-1.
TABLE 7-1:
AUTO-CONVERSION RATES
FOR GIVEN PRESCALE
RATES AT 20 MHZ
TOPS[2:0]
Prescale
Rate
Auto-Conversion
Rate
000
1:1
001
1:8
010
1:32
011
1:128
100
1:512
101
1:1024
110
1:2048
111
1:4096
51 µs
410 µs
2 ms
7 ms
26 ms
52 ms
105 ms
210 ms
The timer is turned on if one of the GPnTXC bits are set
in the IOINTEN register and configured as analog
input.
The prescaler counter is cleared when the device is
reset (RST reset or Power-on reset).
© 2007 Microchip Technology Inc.
DS21664D-page 41