Chapter 9 – Digital Meets Analog – ADC and DAC
abilize the internal voltage reference. The Butterfly uses a 100 nF capacitor for
ls ADC0 – ADC7 on the Port F pins PF0 – PF7.
ected to an analog multiplexer that can connect any of the pins
isabled by setting/clearing the ADEN bit in the ADCSRA
en not in use.
nd ADCL. In
lue of a single conversion.
tart Conversion bit ADSC to start a conversion. This bit
he conversion is in progress and is cleared by the hardware
n completes.
le auto triggering by setting the ADC Auto Trigger bit, ADATE. The
e is determined by setting the ADTS2:0 ADC Auto Trigger Source
•
•
•
•
•
- Timer Counter Compare Match B
mer/Counter1 Overflow
st
this purpose.
There are 8 analog input channe
These pins are conn
to the analog comparator. The channel is selected by setting the MUX0 – MUX4
bits in the ADMUX register.
The ADC is enabled/d
(ADC Control and Status Register A). Since the ADC consumes power it is
recommended that you turn it off wh
The ADC readings are put in the ADC Data Registers ADCH a
normal operation you read the ADCL first, then the ADCH to ensure that both
registers contain the va
An ADC interrupt can be set to trigger when a conversion is complete.
Starting a Conversion
There are several ways to start a conversion.
Write a 1 to the ADC S
stays high while t
when the conversio
You can enab
trigger sourc
bits in the ADCSRB register. The triggers can be:
Free Running mode
Analog Comparator
External Interrupt Request 0
Timer/Counter0 Compare Match
Timer/Counter0 Overflow
- Ti