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 sampling rate for filter design

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







ADC sampling rate for filter design
PostPosted: Tue Mar 22, 2005 2:41 pm     Reply with quote

Hello UG:

I am using an 18F452 device in 4x PLL mode with an external 10 MHz clock source. I use ADC in a loop to grab many samples of the same channel continuously with no other interruption until all my data is collected. Instead of doing an average (or median or moving average) to reduce noise, I was thinking of using an IIR filter. When using software to design the filter, the user must specify the desired frequency response of the filter, as well as the sampling rate. I know my desired frequency response, but I am not sure of the correct sampling rate to use. Can I set a pin high, grab ADC data, then set the pin low and use a scope to measure the time between the pin high states to infer the sampling rate? Is this the best way, or can it be computed in advance knowing the clock rate? Any advice or pitfalls to be had from others having tried this before? I am aware of IIR stability issues, but the relatively short length of the IIR is very attractive. Right now, I must average like heck to reduce random sensor noise and the latency is a bother. I will try any tricks....

Thanks very much,
Vlad
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Tue Mar 22, 2005 7:09 pm     Reply with quote

I believe the PIC18F has a maximum sampling rate around 30ksps. This assumes you go into a tight loop and start a new sample as soon as the last is complete. Doesn't leave you much time for doing anything else.

And this assumes you are driving the ADC input with a low impedance output such as an op-amp. The data sheet shows you how to calculate the acquisition time for the specific PIC, clock speed and drive impedance.

There are some PIC18Fs that have a sampling time of around 10us which would be nearly 100ksps if you did nothing else except service the ADC.

Make sure your analog circuit doesn't have any more bandwidth than 1/2 your sampling frequency so you don't have serious problems with aliased components in your data.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
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