View previous topic :: View next topic |
Author |
Message |
pvol
Joined: 10 Oct 2008 Posts: 46 Location: GREECE
|
ADC conversion and delay |
Posted: Thu Oct 30, 2008 11:41 am |
|
|
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
|
|
Posted: Thu Oct 30, 2008 12:33 pm |
|
|
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
|
|
Posted: Thu Oct 30, 2008 2:29 pm |
|
|
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
|
|
Posted: Thu Oct 30, 2008 3:16 pm |
|
|
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 |
|
|
|