ADC Clock and Sampling Rates

Thread Starter

ActivePower

Joined Mar 15, 2012
155
Hi,

I am a little confused in the exact relationship between an ADC's clock and it's sampling rate. According to what I understand, an ADC's clock determines the amount of time (in cycles) it takes to start a conversion i.e. just enough time to get the ADC's capacitor charged up and running.
Hence, its clock would define the minimum time between two successive conversions. This is where I get a little lost. Two successive conversions would mean two successive sample acquisitions and isn't the time between consecutive samples is what we know as the sampling time? I am surely missing something here.

To provide some context - the ARM7 LPC2148 processor user manual says the 10-bit ADC clock can provide a clock speed of 4.5 MHz max. advising to choose the divider in such a way so as to keep the clock as close to 4.5 MHz as possible for better conversions.
Somewhere else, it mentions the time taken for a 10-bit conversion as >= 2.4 us. I understand the correlation between these pieces of data (1/4.5 ~= 2.4) but I am unable to arrive at my desired sampling rate (8k samples/sec) using it.
I'd be glad if I could get some help understanding this.
 

t06afre

Joined May 11, 2009
5,934
As I see it. The ADC clock on your board, is the clock that drive conversion itself. Not the interval between conversion. For that purpose you have use another timer on your board. The most common is to let a timer create interrupts equal to the sample interval.
 

ErnieM

Joined Apr 24, 2011
8,377
So you want to take samples at an 8KHz rate, or once every 125 uS. As you describe the ARM (I don't use that brand) it has a conversion time of 2.4 uS or greater, but let's assume it's running at it's best.

That means every 125 uS your code kicks off a conversion, and then it has 122.6 uS to do other useful tasks until the next reading needs to be taken. You can reclaim the conversion time simply by reading the last conversion value, starting a new conversion, then processing that last conversion. Thus you are always doing something useful although you are 1 conversion behind the times.

Some other timer is needed to set the 125 uS conversion rate.
 

MrChips

Joined Oct 2, 2009
30,720
Hi,

I am a little confused in the exact relationship between an ADC's clock and it's sampling rate. According to what I understand, an ADC's clock determines the amount of time (in cycles) it takes to start a conversion i.e. just enough time to get the ADC's capacitor charged up and running.
I don't know where you read this. There is no capacitor in the ADC to be charged up and running, at least not in a typical successive approximation ADC.

Somewhere else, it mentions the time taken for a 10-bit conversion as >= 2.4 us. I understand the correlation between these pieces of data (1/4.5 ~= 2.4) but I am unable to arrive at my desired sampling rate (8k samples/sec) using it.
I'd be glad if I could get some help understanding this.
There is something wrong with your math. Every time I calculate 1/4.5 I get 0.222
In a typical n-bit successive approximation ADC it takes n clock cycles to perform a conversion. Hence a conversion time of 2.4μs seems a reasonable expectation.

As others have stated, if you desire a sampling frequency of 8kHz, you need to space your samples by 125μs.
 

MrChips

Joined Oct 2, 2009
30,720
Hey Ernie, I'm sure WBahn would get you for this if I don't.

μS is microsiemens not microseconds (μs).

Siemens is a unit of electrical conductance and electrical admittance, the reciprocals of resistance and impedance respectively.
 

Thread Starter

ActivePower

Joined Mar 15, 2012
155
@MrChips: I meant the cap in the Sample and Hold circuit of the ADC which needs to keep the input voltage constant for the ADC to start converting. I am sorry for the confusion.
Also I figure I missed the 10 factor. I did read about it yesterday somewhere and I made a mental note of it but I guess I made a nasty typo while writing.

As I get it, I need to set up a timer that triggers an ADC conversion every 125 us while I get the (timer interval + conversion period) as the time left for doing other stuff. Then, I'll need to have another container which would retrieve the value from the conversion register and process it while the conversion value gets updated.

Thanks, it's a lot more clearer now. :)
 

MrChips

Joined Oct 2, 2009
30,720
As I get it, I need to set up a timer that triggers an ADC conversion every 125 us while I get the (timer interval + conversion period) as the time left for doing other stuff. Then, I'll need to have another container which would retrieve the value from the conversion register and process it while the conversion value gets updated.

Thanks, it's a lot more clearer now. :)
Not quite.

Set up a timer that triggers an interrupt every 125μs.
In the timer interrupt service routine:

1) Read ADC register and save in data buffer
2) Start new ADC conversion
3) Clear timer interrupt request flag
4) Set a flag to indicate ADC data available
 

Markd77

Joined Sep 7, 2009
2,806
It's likely that there is also a timer mode that can start ADC conversions at regular intervals. On PIC microcontrollers it's called the special event trigger. You can then use the ADC conversion complete interrupt or just check occasionally to see if it is complete.
The advantage is that the ADC will always be started at regular intervals, even if other interrupts are happening.
 
Top