EasyManua.ls Logo

Microchip Technology dsPIC30F - Selecting Analog Inputs for Sampling

Microchip Technology dsPIC30F
738 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
dsPIC30F Family Reference Manual
DS70064C-page 17-14 © 2004 Microchip Technology Inc.
17.8 Selecting Analog Inputs for Sampling
All Sample-and-Hold Amplifiers have analog multiplexers (see Figure 17-1) on both their
non-inverting and inverting inputs to select which analog input(s) are sampled. Once the
sample/convert sequence is specified, the ADCHS bits determine which analog inputs are
selected for each sample.
Additionally, the selected inputs may vary on an alternating sample basis or may vary on a
repeated sequence of samples.
17.8.1 Configuring Analog Port Pins
The ADPCFG register specifies the input condition of device pins used as analog inputs.
A pin is configured as analog input when the corresponding PCFGn bit (ADPCFG<n>) is clear.
The ADPCFG register is clear at Reset, causing the A/D input pins to be configured for analog
input by default at Reset.
When configured for analog input, the associated port I/O digital input buffer is disabled so it does
not consume current.
The ADPCFG register and the TRISB register control the operation of the A/D port pins.
The port pins that are desired as analog inputs must have their corresponding TRIS bit set, spec-
ifying port input. If the I/O pin associated with an A/D input is configured as an output, TRIS bit
is cleared and the ports digital output level (V
OH or VOL) will be converted. After a device Reset,
all TRIS bits are set.
A pin is configured as digital I/O when the corresponding PCFGn bit (ADPCFG<n>) is set. In this
configuration, the input to the analog multiplexer is connected to AV
SS.
17.8.2 Channel 0 Input Selection
Channel 0 is the most flexible of the 4 S/H channels in terms of selecting analog inputs.
The user may select any of the up to 16 analog inputs as the input to the positive input of the
channel. The CH0SA<3:0> bits (ADCHS<3:0>) normally select the analog input for the positive
input of channel 0.
The user may select either V
REF- or AN1 as the negative input of the channel. The CH0NA bit
(ADCHS<4>) normally selects the analog input for the negative input of channel 0.
Note: Different devices will have different numbers of analog inputs. Verify the analog
input availability against the device data sheet.
Note 1: When reading the A/D Port register, any pin configured as an analog input reads as
a ‘0’.
2: Analog levels on any pin that is defined as a digital input (including the AN15:AN0
pins) may cause the input buffer to consume current that is out of the device’s
specification.

Table of Contents

Other manuals for Microchip Technology dsPIC30F