Go Down

Topic: how do I minimize ADC clock freq via a register? (Read 710 times) previous topic - next topic

memotick

I see from the data sheet of the micro controller that ADPS2-0 affect this, but I am not sure how in code to do this.

I'll continue to scour the forums but your help is appreciated

Thanks

a.d

The ADPSn bits are part of the ADCSRA register. You can set them using code like the following -

Code: [Select]
// ADC clock prescaler 8
ADCSRA |= (1 << ADPS1) | (1 << ADPS0);


That's untested but it should work. The exact combination of bits that you turn on affects the pre scaler, but you know that already from reading the data sheet :)

Look up bit wise operations/bitmath for more information about what is going on, or search for something like "AVR set bit"

memotick


The ADPSn bits are part of the ADCSRA register. You can set them using code like the following -

Code: [Select]
// ADC clock prescaler 8
ADCSRA |= (1 << ADPS1) | (1 << ADPS0);


That's untested but it should work. The exact combination of bits that you turn on affects the pre scaler, but you know that already from reading the data sheet :)

Look up bit wise operations/bitmath for more information about what is going on, or search for something like "AVR set bit"



Thanks!

memotick

Other than the prescaler for the ADC, is there another register I can write to so that I can slow the ADC clock even more? 

Thanks

CrossRoads

Why do you want to  slow it? That will make the conversion time longer, and may affect the accuracy of the sample & hold circuit that is charged up prior to making the conversion.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

memotick


Why do you want to  slow it? That will make the conversion time longer, and may affect the accuracy of the sample & hold circuit that is charged up prior to making the conversion.


I need to perform DSP on an audio signal and want the bins to have a small frequency span for better granularity.  This is for a spectrum analyzer display.

Go Up