Required time for ADC Conversion.

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

F_CPU is 8Mhz and ADC Division factor is 2.

 

How many times spend for finished a ADC Conversion and Jump to ADC_vect Subroutine?

শূন্য  - The ZeRo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Which AVR?

First place to look would be the datasheet!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

eRony wrote:
How many times spend for finished a ADC Conversion and Jump to ADC_vect Subroutine?

What AVR model are you working with?

 

What does the datasheet say?  How long does the first conversion take?  How long do subsequent conversions take?

 

What does the datasheet say about interrupt handling, and the sequence of events?  How long does each of those stages take?

 

Do you really mean "Jump", or do you mean to the first action in your ISR?  Surely that depends on your AVR model, as well as your language and toolchain and version and how good you are at writing skinny ISRs?

 

What is the purpose of your question?  Do you have some time constraints?  What are they?

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

eRony wrote:

F_CPU is 8Mhz and ADC Division factor is 2.

 

How many times spend for finished a ADC Conversion and Jump to ADC_vect Subroutine?

 

I think your overclocking your ADC!   RTFM to see what the adc clock rate can be, most normal conversions take about 100us for full 10 bit results.

 

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Your" should be "you're". Acronyms should be spelled out on first use. Can you clarify the RTFM acronym? A/D conversions take 13 cycles. The a/d clk should be about 200KHz. 8MHz over 2 is 4MHz. Somewhat more than 200KHz. 13 clks of 250ns per clk gives a conversion time of 3.25usecs, or 307K samples per sec. Usual max samples per sec is in the lo 5 digits. Try it. Report the results.

 

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using ATmega8.

শূন্য  - The ZeRo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Yes i mean ISR.

শূন্য  - The ZeRo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

eRony wrote:

I'm using ATmega8.

If you get your prescalers right you can run the mega8 ADC as up to 200kHz and still retain 10 bit support. At 200kHz it takes 13 ADC clocks to make a conversion. So you can sample at 200kHz/13 = 15.3kHz which means a conversion takes 65us. You can run the ADC at more than 200kHz (up to about 1MHz) but will trade some accuracy if you attempt this.

 

But 8MHz is NOT a good speed to use. The ADC prescaler is a binary division so:

 

8MHz / 2 = 4MHz

8MHz / 4 = 2MHz

8MHz / 8 = 1MHz

8MHz / 16 = 500kHz

8MHz / 32 = 250kHz

8MHz / 64 = 125kHz

8MHz / 128 = 62.5kHz

 

Only the last two get you under the 200kHz barrier so your best option there is /64 to give you 125kHz but 125kHz/13 = 9.6kHz which is nowhere near the theoretical 15.3kHz that could be achieved because 125kHz is so much short of 200kHz.

 

If you dropped the AVR speed to 6.4MHz then the figures would be:

 

6.4MHz / 2 = 3.2MHz

6.4MHz / 4 = 1.6MHz

6.4MHz / 8 = 800kHz

6.4MHz / 16 = 400kHz

6.4MHz / 32 = 200kHz

6.4MHz / 64 = 100kHz

6.4MHz / 128 = 50kHz

 

So in this case you could use the /32 prescaler and hit 200kHz exactly for a 15.3kHz sample rate.

 

So faster is not always better!