CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

ADC and INTERRUPT PIC 16F877A

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sandrini



Joined: 11 Oct 2007
Posts: 12

View user's profile Send private message

ADC and INTERRUPT PIC 16F877A
PostPosted: Wed Mar 18, 2009 8:35 am     Reply with quote

I have a problem when I use the ADC and Timer0, Timer1 or Timer2 interrupt...
When I disable the interrupt, ADC return 1022 and when I enable the interrupt, the ADC return 973...
ADC return 614 when the interrupts is disable and return 47 when the interrupt is enable...
Somebody know what happening?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 18, 2009 11:09 am     Reply with quote

It's possible that you are getting an interrupt in the middle of the
reading of a 16-bit value from the ADC, or during the transfer of
the result to a 16-bit variable. To test this idea, add the lines
shown in bold below:
Quote:

int16 result;

disable_interrupts(GLOBAL);
result = read_adc();
enable_interrupts(GLOBAL);
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group