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 CCS Technical Support

ADC conversion and delay

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



Joined: 10 Oct 2008
Posts: 46
Location: GREECE

View user's profile Send private message

ADC conversion and delay
PostPosted: Thu Oct 30, 2008 11:41 am     Reply with quote

Hello everybody...

I have a wonder about conversions and delays between setup and read
from adc.

manual says:
Code:
set_adc_channel(0); //the next read_adc call will read channel 0
delay_us(10);    //a small delay is required after setting   
                 //the channel and before read
value=read_adc();

(C Compiler Reference Manual Version 4 August 2007) page 48

That happens for all PIC family ?
Can anybody tell me if it is necessary ?

datasheet 16f877A says for one conversion needs 19.72μs
plus 10μs (delay) equals 29.72μs
ECACE



Joined: 24 Jul 2006
Posts: 94

View user's profile Send private message

PostPosted: Thu Oct 30, 2008 12:33 pm     Reply with quote

When you switch from one channel to another you need an amplifier settling time. This is the 10uS.
The A/D sample time is different. This is defined in setup_adc, whether you are using the internal timer, or a set number of clock ticks.
_________________
A HW Engineer 'trying' to do SW !!! Run!!!
pvol



Joined: 10 Oct 2008
Posts: 46
Location: GREECE

View user's profile Send private message

PostPosted: Thu Oct 30, 2008 2:29 pm     Reply with quote

thanks a lot for the answer..

if i have 16f877A with 4MHz XT
how much time do i need from one channel to another?
Ttelmah
Guest







PostPosted: Thu Oct 30, 2008 3:16 pm     Reply with quote

It is not actually 'amplifier settling time', but capacitor charge time.
The internal ADC on the PIC, reads the voltage from a small internal capacitor. The multiplexor, and inputs on the PIC, have a resistance, normally of a few Kohm. I takes time for the internal capactor to charge through this resistance. The time you need, depends on how accurate you need the results to be, and the impedance of the source you are using to feed the input. Also the largest excursion likely to be seen. The formula for calculating the time is in the chips data sheet. An example is given, based upon charging the capacitor to within half of a 'step' between bits, for a 'worst case'. Time needed for most standard PICs is about 11uSec.

Best Wishes
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