Therefore, we can select pins functionality either as a digital or ADC pin with this register. But we can use only one function at a time. For example, we can use the same port either as a digital pin or analog pin. First, all GPIO ports of pic microcontroller have multiple functions. ADCON1 – ADC Control Register 1ĪDCON1 register has two functions. Hence, we can use this bit as a flag bit to find either A/D conversion is in progress or completed.
Therefore, it stores 2 higher/lower bits of 10-bit digital number depending on how we justified the result storage rule.
Firstly, each channel accepts analog inputs which charges charge and hold capacitor. How PIC18F ADC Works?ĪDC mainly consists of charge/hold capacitor and successive approximation converter.
#MPLAB XC8 C INSTRUCTION SET SERIES#
However, control and configurations registers are the same for every PIC18F series microcontrollers. But the actual number of channels depends on the microcontroller, you are using. In other words, it can have up to sixteen ADC channels. Each microcontroller can accept up to 16 analog inputs.
#MPLAB XC8 C INSTRUCTION SET CODE#