Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ADC interrupts , some doubts

Status
Not open for further replies.

vinodstanur

Advanced Member level 3
Joined
Oct 31, 2009
Messages
751
Helped
114
Reputation
234
Reaction score
114
Trophy points
1,333
Location
Kerala (INDIA)
Activity points
7,054
Actually what is ADC interrupts?(pic16f877a)
I had read that if ADIE is enabled, then after AD conversion, ADIF will be set..
Actually, what is the significance of ADC interrupt?
I just started to learn about interrupts ...and alreadygot some idea about timer interrupts and RB0 INT in PIC16F877A...
But now, actually am confused abt ADC interrupts...
1>whats the need of ADC interrupts?
2>Could any one give a good situation where the ADC interrupts are essential..
 

Hi,

When using the pic 16F ADC in a typical hobbyist circuit its quiet normal to set the ADC routine off and then test and wait for the GO/DONE bit to clear to say the ADC conversion has completed and the result placed in the ADRES register/s.
bsf ADCON0,GO ; start conversion
a2d_done:
btfss ADCON0,GO ; this bit will change to zero when the conversion is complete
goto a2d_done

If you are using a faster pic /clock speed and the ADC is a relativley slow conversion, then rather than having the main program loop waiting for the ADC result you can first enable the Ato D interrupt ADIE , then start the ADC conversion, when its complete the Ato D Interrupt Flag will be set so creating the jump to the ISR, where the result can be serviced and the ADIF reset etc.
 
So, after setting ADGO=1 , then the PIC can do the ADC in background and at the same time, it can execute the next instruction after ADGO=1 .
Am I right?
And , what is the approximate time required for ADC in pic16f877a?
 

Hi,

Am I right?

Yes thats the idea, though its not a method I have actually used.

If you see the datasheet ADC section and the ADC Conversion details in the Electrical Specification section it indicates around 20 -40 us, but that of course depends on your ADC settings and clock speed - again its not something I have actually measured - in my own adc programming I just test and wait for the conversion.
 
It's around what wp100 stated, but the accuracy is greater if you use a greater time instead of the fastest, esp at high frequency inputs.

Hope this helps.
Tahmid.
 

Hi... though its an old thread. but I am a newbie and I want to know that is it possible to store results after conversion using FSR and INDF by setting address values to FSR??
i have tried like this in 16f886 in mplab using hitech c universal compiler:
Code:
for(FSR=0XE0;FSR<0XEA;FSR=FSR+1)
{
GO=1;
while(GO==1);
INDF=ADRESL;
delay_ms(2);
}

i dont know weather this is valid or not?
i can post my works too if you need. please help.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top