ATmega1284p

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

What is the minimum sampling time for AVR microcontroller ADC? And What is the minimum timing of AVR microcontroller timer?

This topic has a solution.
Last Edited: Thu. Apr 19, 2018 - 09:36 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you want all 10 bits the fastest you can run the ADC is 200kHz and because it takes 13 clocks to make a conversion this makes the fastest sample rate 15.3kHz or 66us.

 

If your design is all about ADC then (assuming you can cope with 3.3V) the Xmega range is a far better design for analog as it has a much higher sample rate.

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

ADC sampling frequency can not reach 1mHz? Because I need ADC acquisition rate exceeds 15.3KHz, I used to collect ultrasonic echo signals.

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

Then "mega AVR" is not the chip range for you (unless you want to add an external fast ADC?)

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

Isn't it possible to sample at 200KHz? You can't guarantee the accuracy of the ADC, as long as you can do it.

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

The megaAVR takes 13 "ADC clocks" to make a conversion so to sample at 200kHz you would need to run the ADC at 13 * 200kHz which is 2.6MHz. Now with the right F_CPU you can perhaps set the ADPS bits to run it at that speed but if you did you won't be able to get 10 bits of accuracy. The faster you run it above 200kHz the more noise you will have in the lower bits. I think it's been confirmed that you can get 8bits at 1MHz (and 1MHz / 13 = 76.9ksps) but I'm guessing you are down to 6 or 7 bits at 2.6MHz.

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

Liu Chenghu wrote:
Isn't it possible to sample at 200KHz?
Not with megaAVR; mega4809 is 115Ksps for 10b and 150Ksps for 8b.

As mentioned, XMEGA AU has the fastest ADC, XMEGA E has 16b by oversample and decimate, and all have DMA except for XMEGA D.

 

https://www.microchip.com/wwwproducts/en/ATMEGA4809

http://www.microchip.com/ProductSearch/product/search/All%20Products/XMEGA

 

"Dare to be naïve." - Buckminster Fuller

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

Liu Chenghu wrote:
Isn't it possible to sample at 200KHz? You can't guarantee the accuracy of the ADC, as long as you can do it.

What trick questions you ask.

 

As the other respondents hinted at, all of the answers to your questions are in the datasheet.

 

Short answer is that an ADC conversion takes 13 ADC clock cycles.  If the ADC clock prescaler is /1, then that would be the same as 13 AVR clock cycles.  So >>you<< need to do the math.  If your AVR is running at 13MHz (not mHz as you earlier mentioned) then there would be a new conversion result every 1 microsecond.

 

Now, will the result bear any useful value given such overclocking of the peripheral subsystem?  I wouldn't think so, especially with the brief sample-and-hold period.

 

All moot IMO including "fast" external ADC -- how are you going to gather/store/process the information on an AVR8 at those speeds?!?

 

As mentioned there are many other types of microcontrollers that support higher sample rates. 

 

Now are we on to

Liu Chenghu wrote:
minimum timing of AVR microcontroller timer?
   Sheesh -- what does the datasheet tell you?

 

I did an application for an "industrial quality" ultrasonic line of transducers, with no ADC readings -- waveform was sampled and analyzed with midpoint "trips" with e.g. analog comparator.

 

 

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.

Last Edited: Thu. Apr 19, 2018 - 02:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ultrasonic level gauge analog comparator how to calculate the calculation time? Do you have this code?Can you show me this program?

What do you say about this sentence?

“I did an application for an "industrial quality" ultrasonic line of transducers, with no ADC readings -- waveform was sampled and analyzed with midpoint "trips" with e.g. analog comparator.”

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

I used this one-chip computer to do the measurement of the ultrasonic liquid level gauge, so it is not easy to change the one-chip computer, the main problem now is that I do not know how to collect the echo time.

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

OK,thank you!There is another question. What is the minimum timer time for this microcontroller?

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

Liu Chenghu wrote:
What is the minimum timer time for this microcontroller?
theusch wrote:
Now are we on to Liu Chenghu wrote: minimum timing of AVR microcontroller timer? Sheesh -- what does the datasheet tell you?
Wouldn't it be one AVR clock cycle?

 

Liu Chenghu wrote:
I used this one-chip computer to do the measurement of the ultrasonic liquid level gauge, so it is not easy to change the one-chip computer, the main problem now is that I do not know how to collect the echo time.

Echo time? 

What does that have to do with ADC conversion rate?

 

What chip?  Datasheet?  Is it anything close to the common HCS04?

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

Have you used an AVR at all?  Have you thoroughly examined the datasheet?  Spend a day, go through it.  Highlight all the information you find useful.  You should try working with the AVR, making some of the many tutorials & experiments before jumping into something difficult.  From the types of questions being asked, you will probably not have an optimal outcome if you don't go step-by-step.  There are many experiments you should try with the timers, ADC, UART, etc, so that you can FIRST learn & figure out what is best for your application. Maybe then what seems difficult now will then seem easy.

When in the dark remember-the future looks brighter than ever.