ADC of PIC Microcontroller
ADC of PIC Microcontroller
PIC18F4520 microcontroller has 8 ADC inputs and it will convert analog inputs to a
corresponding 10 bit digital number.
For this project there are three Analog signals to be converted to be digital before processing
namely,
3. The temperature.
For précised conversion we use, ADC Lower Reference as –Vref and Higher Reference as
+Vref
Vref- = -2.5V
Vref+ = +2.5V
n = 10 bits
So ADC resolution is 0.00487V, which is the minimum required voltage to change a bit.
Digital Output
Analog Input
Binary Hex Decimal
0 0b0000000000 0x000 0
0.004887V 0b0000000001 0x001 1
0.009774V 0b0000000010 0x002 2
0.014661V 0b0000000011 0x003 3
4.999401V 0b1111111111 0x3FF 1023
Block Diagram
Bit 7 ~ 6 : ADCS1 & ADCS0, A/D Conversion clock selection bits. These bits are
used in combination with ADCS2 of ADCON1 register
Bit 5 ~ 3 : CH2, CH1 & CH0 are analog channel selection bits which will select a
particular channel out of 8.
Bit 2 : Go_nDone is the A/D conversion status bit. Setting this bit initiates the A/D
conversion and it will be automatically cleared when the conversion completes.
Bit 0 : ADON, A/D Module On bit. Setting this bit will turn on the ADC module.
Bit 6 : ADCS2, A/D Conversion clock selection bit. This bit is used in combination
with ADCS0 and ADCS1 of ADCON0 register.
Bit 3 ~ 0 : PCFG3 ~ PCFG0, A/D Port Configuration Bits. Status of these bits
determine whether the pin is Analog or Digital as per the table below.
Holding capacitor (CHOLD) must be charged to the input voltage to meet the accuracy specified
by the datasheet. So we must provide a delay greater than the minimum required
acquisition time to charge the capacitor. 19.72μs is the minimum time specified in the
datasheet. Please refer the datasheet for more details.
A/D conversion clock must be selected to ensure minimum TAD. TAD is the conversion time
per bit, which is 1.6μs. Please refer the datasheet for more details.