3 ADC Configuration
3.1 Builder: Add Driver/Peripheral
- Application Builder: Click 'Add Component', ADC (PLIB), (MCC default configuration)
- Filter on 'ADC' then click the icon to add the ADC Plib.
Note: When added to the Builder, components can be
considered to be in their default configuration.
CAUTION: If not in its default configuration, a
component's configuration can be reset as follows:
- Click Register Initialization.
- From Track Changes, click 'Reset to MCC defaults'.
- Confirm that all user changes will be reset.
3.2 ADC Channel Select
Analog Input channels can be selected either from the MCC Melody Graphical User Interface (GUI), or from Pin Grid View you can Select an Analog Input (ANx).
For the GUI option, from the i.e., under under Hardware Settings>Positive Input Channel, select the ANx pin from the development board or your schematic.
When selecting a Positive Input Channel, ANx is also updated in the Pin Grid View.
Tip: When configured in the GUI, the ANx pin is configured
as part of SYSTEM_Initialize() → ADC_Initialize(); This means that one can use:
ADC_ChannelSelect(channel); //Not needed if ANx selected from GUI
ADC_ConversionStart();
CAUTION:
// To reduce change of measurement error, it is recommended to discharge the
// Sample-and-Hold capacitor when switching ADC channels.
ADC_SampleCapacitorDischarge();
// Refer to the ADC Conversion Timing Specifications table in the Electrical Specifications chapter.
// 100 us is very concervative.
__delay_us(100);
ADC_ChannelSelect(ADC_CHANNEL_ANA7);
Tip: Use Curiosity
Nano Schematics, to help to find Curiosity Nano Platform
references.