Is there any way to change ADC conversion time in the PIC16F886?

Viewed 53
#include <xc.h>
#pragma config FOSC = HS
void main() 
{  
    OSCCONbits.IRCF = 0b111;
    OSCTUNE = 0b01111;
    OSCCONbits.SCS = 0;
    OSCCONbits.OSTS = 1;
    OSCCONbits.HTS = 1;
    OSCCONbits.LTS = 1;
    TRISBbits.TRISA2 = 0;
    ANSELbits.ANS2 = 1;
    ADCON0 = 0x89;
    ADCON1 = 0x00;
    while(1)
    {
        ADCON0bits.GO = 1;
        while(ADCON0bits.GO == 1)
        {
            PORTBbits.RB6 = ~(PORTBbits.RB6);
        }
    }
}

I am struggling to change the adc conversion. When i am checking in the oscilloscope. i am getting the conversion time as 10 micro seconds. but it needs to take like 200 nsec.

MPLAB version 5.40

Pickit 3 programmer

XC8 compiler

1 Answers

The time to complete one bit conversion is defined as Tad. One full 10 bit conversion requires 11 Tad periods. The minimum Tad time is 1.6 us at 20 Mhz, check datasheet TABLE 17-11. If you are using 16 Mhz oscillator than the minimum Tad time is 2 us. So for full 10 bit conversion your ADC need 22 us. But ADC need also some time to charge holding capacitor, check datasheet section 9.2, which is about 2 us or more. As you can calculate the minimum ADC conversion time for PIC16F88x is about 25us at 16 Mhz microcontroller oscillator.

enter image description here

Related