Contents
What can an ATmega8 ADC do for You?
The ATMEGA8 ADC can do more. For example the sampling frequency can be adjusted using the ADPS [0:2] bits in the ADCSRA register. The ADC can be configured to trigger interrupts and it can operate in a noise cancellation mode. All this is described in detail in the ADC section of the datasheet.
How much memory does an ATmega8 volt meter use?
In general, operations with fractional numbers consume a lot of microcontroller memory (our voltmeter firmware weighs slightly more than 4 kilobytes, this is half the memory of ATmega8 programs!), They are recommended to be used only when absolutely necessary.
How is the ADC used in the AVR project?
The ADC is embedded in many microcontrollers of the AVR family and simplifies the use of the microcontroller in any regulation schemes where it is necessary to digitize a certain analog signal. Consider the principle of operation of the ADC .
Where is the result of an ADC conversion?
A conversion is started by setting ADSC bit to 1 in the ADCSRA register. If the conversion is done, the ADC sets this bit back to 0. The result is then available in the registers ADCL and ADCH, which can be combined to a single 10-bit value (of course stored in a 16-bit integer).
What’s the maximum clock frequency for an ADC?
By default, the successive approximation circuitry requires an input clock frequency between 50 kHz and 200 kHz to get maximum resolution. If a lower resolution than 10 bits is needed, the input clock frequency to the ADC can be higher than 200 kHz to get a higher sample rate.
How to set admux to channel in ATmega?
For example, if you have a 10Mohm CDS photocell, and 6pF of PCB trace capacitance plus 14pF of ADC capacitance, you will have to wait 4*10Mohm*20pF = 800us. One way to do that is to set ADMUX to your channel, enable the ADC, wait 800us, and then tell the ADC to sample.
Why is the DIDR Register important in ATmega?
Perhaps the most overlooked ADC register, the DIDR (Data Input Disable Register) disconnects the digital inputs from which ever ADC channels you are using. This is important for 2 reasons. First off, an analog input will be floating all over the place, and causing the digital input to constantly toggle high and low.