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
Posted: Wed Mar 18, 2009 11:09 am
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);
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