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

Internal ADC sampling speed

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



Joined: 22 Feb 2004
Posts: 16
Location: vienna, austria.

View user's profile Send private message Visit poster's website ICQ Number

Internal ADC sampling speed
PostPosted: Sun Feb 22, 2004 12:19 pm     Reply with quote

i've tryed to use a external adc, but i'm now considering using the built-in adc of my PIC18F452. The datasheet states :
Quote:

TACQ = TAMP + TC + TCOFF
Temperature coefficient is only required for temperatures > 25°C.
TACQ = 2 µs + TC + [(Temp – 25°C)(0.05 µs/°C)]
TC = -CHOLD (RIC + RSS + RS) ln(1/2048)
-120 pF (1 kΩ + 7 kΩ + 2.5 kΩ) ln(0.0004883)
-120 pF (10.5 kΩ) ln(0.0004883)
-1.26 µs (-7.6246)
9.61 µs
TACQ = 2 µs + 9.61 µs + [(50°C – 25°C)(0.05 µs/°C)]
11.61 µs + 1.25 µs
12.86 µs


then on the next pages is states that is requiers at least 12 T_ad times to get a reading into adc_l and adc_h registers.
i configured the oscilator to OSC_2, that means 5MHz(operating with 20MHz crystal) -> 0,2us Tad ?! (would that mean that it taks only 6us to get the reading?)
but the conversion seems to be right anyway.

but how do i calculate what it _realy_ taks(do i have to sum 12.86us and 12*T_ad ?) to read a number and asign it to a variable? what is the highest rachable sample reate with 2-3 channels beeing used?

i used timer1 to measure how much ticks of t1 it takes to get one reading on channel 0, the result was that when t1 is set to a resolution of 1.6us(T1_INTERNAL) 17 ticks, that means ~ 27uS.
Felix Althaus



Joined: 09 Sep 2003
Posts: 67
Location: Winterthur, Switzerland

View user's profile Send private message

PostPosted: Sun Feb 22, 2004 12:35 pm     Reply with quote

Hi

Tacq and Tad are different things!

Tacq is the acquisitioning time wich is needed that the internal hold-condensator surely can be charged to the input voltage at the PIC pin.
The minimum of this time can be calculated form the formula you show. But it can be longer.

Tad is the time it takes for the PIC to sample one bit. The whole 10bits take 12Tad.
For the PIC16Xxxx adc's the Tad must be somwhere between 2us and 6us. I don't know the values for the 18Fxxx but they should be in the datahseet. So you MUST select the conversion clock divider that the resulting Tad is within this range. There should be a table in the datasheet that shows when to select wich divider.

When you change the ad channel, you have to wait Tacq before you start the conversion.


Felix
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

PostPosted: Sun Feb 22, 2004 1:01 pm     Reply with quote

A good way to get around all this is to use the built in functions. If you have a capasitor across your analog inputs they are stable. With stable inputs you can simply take a sample after switching channles and throw it out then take your sample and switch to the next channle. 12Tad is usualy going to be enough time for Tacq to occure. For me this is better than using a delay_uS because it waste less time in the event an interupt occurs during the Tacq.
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