8 register description, 1 adcsra – adc control and status register a, Atmega4hvd/8hvd – Rainbow Electronics ATmega8HVD User Manual
Page 97

97
8052B–AVR–09/08
ATmega4HVD/8HVD
17.8
Register Description
17.8.1
ADCSRA – ADC Control and Status Register A
• Bit 7 – ADEN: ADC Enable
Writing this bit to one enables the ADC. By writing it to zero, the ADC is turned off. Turning the
ADC off while a conversion is in progress, will terminate this conversion.
• Bit 6 – ADSC: ADC Start Conversion
Write this bit to one to start each conversion. The first conversion after ADSC has been written
after the ADC has been enabled, or if ADSC is written at the same time as the ADC is
enabled, will take 27 ADC clock cycles. The conversion time will then be 13 ADC cycles if
ADTEMP is set to zero, or 27 ADC cycles if ADTEMP is set to one. This first conversion per-
forms initialization of the ADC.
ADSC will read as one as long as a conversion is in progress. When the conversion is com-
plete, it returns to zero. Writing zero to this bit has no effect.
• Bit 5 – RES: Reserved bits
These bits are reserved, and will always read as zero.
• Bit 4 – ADIF: ADC Interrupt Flag
This bit is set when an ADC conversion completes and the data registers are updated. The
ADC Conversion Complete Interrupt is executed if the ADIE bit and the I-bit in SREG are set.
ADIF is cleared by hardware when executing the corresponding interrupt handling vector.
Alternatively, ADIF is cleared by writing a logical one to the flag. Beware that if doing a Read-
Modify-Write on ADCSRA, a pending interrupt can be disabled. This also applies if the SBI
and CBI instructions are used.
• Bit 3 – ADIE: ADC Interrupt Enable
When this bit is written to one and the I-bit in SREG is set, the ADC Conversion Complete
Interrupt is activated.
• Bit 2 – RES: Reserved bit
This bit isreserved, and will always read as zero.
• Bit 1:0 – ADMUX1:0: ADC Channel Selection Bits
These bits selects the analog input that should be connected to the ADC according to
. If these bits are changed during a conversion, the change will not be effective until the
conversion is complete.
Bit
7
6
5
4
3
2
1
0
ADEN
ADSC
-
ADIF
ADIE
-
ADMUX1
ADMUX0
ADCSRA
Read/Write
R/W
R/W
R
R/W
R/W
R
R/W
R/W
Initial Value
0
0
0
0
0
0
0
0