the pin assignments for the
PIC32MM0064GLP028 peripherals that we have
previously activated are displayed. The most
recent pin assignment is AN0, which happens to
be the pin we selected for our ADC analog
input. The name of pin RA0 (AN0) is user
selectable and is named within the pin module
window shown in Screenshot 4.
Our SYSTEM_Initialize function list is growing
with the addition of the ADC peripheral to our
In addition, two new files — adc1.c and
adc1.h — have been automatically added to our
■ SCREENSHOT 3. Setting up an ADC is just a couple of clicks of
finger work. Once the ADC parameters are fed into the MPLAB Code
Configurator GUI, an analog input pin can be selected from the Code
Configurator pin module.
MPLAB X PIC32MM0064GLP028 project. A
complement of ADC driver functions was also
void ADC1_Initialize (void);
bool ADC1_IsConversionComplete( void );
void ADC1_ChannelSelect( ADC1_CHANNEL
As you would expect, the MPLAB Code
Configurator kindly provided some example
code. Here’s a generic ADC sample sequence
for(int i=0;i <1000;i++)
■ SCREENSHOT 4. The Pin Manager display is always accessible.
Once you select a pin in the Pin Manager or via a peripheral
assignment, you can transition to the pin module window to
configure the selected pin’s behavior and human-readable name.
conversion = ADC1_ConversionResultGet();
AD1CON1bits.SAMP = 1;
AD1CON1bits.SAMP = 0;
Most of the ADC driver functions are short and sweet.
Added sweetness is that you didn’t have to write one
single line of code to implement them:
bool ADC1_IsConversionComplete( void )
September 2016 53