Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
AVR / datasheets / attiny_261_461_861.pdf
Скачиваний:
54
Добавлен:
20.03.2015
Размер:
2.26 Mб
Скачать

where ADCn are the ADC data registers, k is a fixed coefficient and TOS is the temperature sensor offset value determined and stored into EEPROM.

19.10 Register Descriptin

19.10.1ADMUX – ADC Multiplexer Selection Register

Bit

7

6

5

4

3

2

1

0

 

0x07 (0x27)

REFS1

REFS0

ADLAR

MUX4

MUX3

MUX2

MUX1

MUX0

ADMUX

 

 

 

 

 

 

 

 

 

 

Read/Write

R/W

R/W

R/W

R/W

R/W

R/W

R/W

R/W

 

Initial Value

0

0

0

0

0

0

0

0

 

• Bit 7:6 – REFS1:REFS0: Voltage Reference Selection Bits

These bits and the REFS2 bit from the ADC Control and Status Register B (ADCSRB) select the voltage reference for the ADC, as shown in Table 19-3. If these bits are changed during a conversion, the change will not go in effect until this conversion is complete (ADIF in ADCSR is set). Whenever these bits are changed, the next conversion will take 25 ADC clock cycles. If active channels are used, using AVCC or an external AREF higher than (AVCC - 1V) is not recommended, as this will affect ADC accuracy. The internal voltage reference options may not be used if an external voltage is being applied to the AREF pin.

Table 19-3.

Voltage Reference Selections for ADC

REFS2

 

REFS1

REFS0

Voltage Reference (VREF) Selection

X

 

0

0

VCC used as Voltage Reference, disconnected from AREF.

X

 

0

1

External Voltage Reference at AREF pin, Internal Voltage

 

Reference turned off.

 

 

 

 

 

 

 

 

 

0

 

1

0

Internal 1.1V Voltage Reference.

 

 

 

 

 

0

 

1

1

Reserved.

 

 

 

 

 

1

 

1

0

Internal 2.56V Voltage Reference without external bypass

 

capacitor, disconnected from AREF.

 

 

 

 

 

 

 

 

 

1

 

1

1

Internal 2.56V Voltage Reference with external bypass capacitor

 

at AREF pin.

 

 

 

 

 

 

 

 

 

Bit 5 – ADLAR: ADC Left Adjust Result

The ADLAR bit affects the presentation of the ADC conversion result in the ADC Data Register. Write one to ADLAR to left adjust the result. Otherwise, the result is right adjusted. Changing the ADLAR bit will affect the ADC Data Register immediately, regardless of any ongoing conversions. For a comple te description of this bit, see ”ADCL and ADCH – The ADC Data Register” on page 158.

• Bits 4:0 – MUX4:0: Analog Channel and Gain Selection Bits

These bits and the MUX5 bit from the ADC Control and Status Register B (ADCSRB) select which combination of analog inputs are connected to the ADC. In case of differential input, gain selection is also made with these bits. Selecting the same pin as both inputs to the differential gain stage enables offset measurements. Selecting the single-ended channel ADC11 enables the temperature sensor. Refer to Table 19-4 for details. If these bits are changed during a conversion, the change will not go into effect until this conversion is complete (ADIF in ADCSRA is set).

154 ATtiny261/461/861

2588B–AVR–11/06

ATtiny261/461/861

Table 19-4.

Input Channel Selections

 

 

 

 

Single Ended

Positive

Negative

 

MUX5..0

 

Input

Differential Input

Differential Input

Gain

 

 

 

 

 

 

000000

 

ADC0 (PA0)

 

 

 

 

 

 

 

 

 

000001

 

ADC1 (PA1)

 

 

 

 

 

 

 

 

 

000010

 

ADC2 (PA2)

 

 

 

 

 

 

 

 

 

000011

 

ADC3 (PA4)

 

 

 

 

 

 

 

 

 

000100

 

ADC4 (PA5)

 

 

 

 

 

 

 

 

 

000101

 

ADC5 (PA6)

NA

NA

NA

 

 

 

 

 

 

000110

 

ADC6 (PA7)

 

 

 

 

 

 

 

 

 

000111

 

ADC7 (PB4)

 

 

 

 

 

 

 

 

 

001000

 

ADC8 (PB5)

 

 

 

 

 

 

 

 

 

001001

 

ADC9 (PB6)

 

 

 

 

 

 

 

 

 

001010

 

ADC10 (PB7)

 

 

 

 

 

 

 

 

 

001011

 

 

ADC0 (PA0)

ADC1 (PA1)

20x

 

 

 

 

 

 

001100

 

 

ADC0 (PA0)

ADC1 (PA1)

1x

 

 

NA

 

 

 

001101

 

ADC1 (PA1)

ADC1 (PA1)

20x

 

 

 

 

 

 

001110

 

 

ADC2 (PA2)

ADC1 (PA1)

20x

 

 

 

 

 

 

001111

 

 

ADC2 (PA2)

ADC1 (PA1)

1x

 

 

 

 

 

 

010000

 

 

ADC2 (PA2)

ADC3 (PA4)

1x

 

 

 

 

 

 

010001

 

N/A

ADC3 (PA4)

ADC3 (PA4)

20x

 

 

 

 

 

010010

 

ADC4 (PA5)

ADC3 (PA4)

20x

 

 

 

 

 

 

 

 

010011

 

 

ADC4 (PA5)

ADC3 (PA4)

1x

 

 

 

 

 

 

010100

 

 

ADC4 (PA5)

ADC5 (PA6)

20x

 

 

 

 

 

 

010101

 

 

ADC4 (PA5)

ADC5 (PA6)

1x

 

 

NA

 

 

 

010110

 

ADC5 (PA6)

ADC5 (PA6)

20x

 

 

 

 

 

 

010111

 

 

ADC6 (PA7)

ADC5 (PA6)

20x

 

 

 

 

 

 

011000

 

 

ADC6 (PA7)

ADC5 (PA6)

1x

 

 

 

 

 

 

011001

 

 

ADC8 (PB5)

ADC9 (PB6)

20x

 

 

 

 

 

 

011010

 

 

ADC8 (PB5)

ADC9 (PB6)

1x

 

 

 

 

 

 

011011

 

NA

ADC9 (PB6)

ADC9 (PB6)

20x

 

 

 

 

 

 

011100

 

 

ADC10 (PB7)

ADC9 (PB6)

20x

 

 

 

 

 

 

011101

 

 

ADC10 (PB7)

ADC9 (PB6)

1x

 

 

 

 

 

 

011110

 

1.1V

N/A

N/A

N/A

 

 

 

011111

 

0V

 

 

 

 

 

 

 

 

 

 

155

2588B–AVR–11/06

Table 19-4.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Input Channel Selections (Continued)

 

 

 

 

 

 

 

 

 

 

 

Single Ended

 

Positive

Negative

 

MUX5..0

 

Input

 

Differential Input

Differential Input

Gain

 

 

 

 

 

 

 

100000

 

 

 

ADC0(PA0)

ADC1(PA1)

20x/32x

 

 

 

 

 

 

 

100001

 

 

 

ADC0(PA0)

ADC1(PA1)

1x/8x

 

 

N/A

 

 

 

 

100010

 

 

ADC1(PA1

ADC0(PA0)

20x/32x

 

 

 

 

 

 

 

100011

 

 

 

ADC1(PA1)

ADC0(PA0)

1x/8x

 

 

 

 

 

 

 

100100

 

 

 

ADC1(PA1)

ADC2(PA2)

20x/32x

 

 

 

 

 

 

 

100101

 

 

 

ADC1(PA1)

ADC2(PA2)

1x/8x

 

 

N/A

 

 

 

 

100110

 

 

ADC2(PA2

ADC1(PA1)

20x/32x

 

 

 

 

 

 

 

100111

 

 

 

ADC2(PA2)

ADC1(PA1)

1x/8x

 

 

 

 

 

 

 

101000

 

 

 

ADC2(PA2)

ADC0(PA0)

20x/32x

 

 

 

 

 

 

 

101001

 

 

 

ADC2(PA2)

ADC0(PA0)

1x/8x

 

 

N/A

 

 

 

 

101010

 

 

ADC0(PA0)

ADC2(PA2)

20x/32x

 

 

 

 

 

 

 

101011

 

 

 

ADC0(PA0)

ADC2(PA2)

1x/8x

 

 

 

 

 

 

 

101100

 

 

 

ADC4(PA5)

ADC5(PA6)

20x/32x

 

 

 

 

 

 

 

101101

 

 

 

ADC4(PA5)

ADC5(PA6)

1x/8x

 

 

N/A

 

 

 

 

101110

 

 

ADC5(PA6)

ADC4(PA5)

20x/32x

 

 

 

 

 

 

 

101111

 

 

 

ADC5(PA6)

ADC4(PA5)

1x/8x

 

 

 

 

 

 

 

110000

 

 

 

ADC5(PA6)

ADC6(PA7)

20x/32x

 

 

 

 

 

 

 

110001

 

 

 

ADC5(PA6)

ADC6(PA7)

1x/8x

 

 

N/A

 

 

 

 

110010

 

 

ADC6(PA7)

ADC5(PA6)

20x/32x

 

 

 

 

 

 

 

110011

 

 

 

ADC6(PA7)

ADC5(PA6)

1x/8x

 

 

 

 

 

 

 

110100

 

 

 

ADC6(PA7)

ADC4(PA5)

20x/32x

 

 

 

 

 

 

 

110101

 

 

 

ADC6(PA7)

ADC4(PA5)

1x/8x

 

 

N/A

 

 

 

 

110110

 

 

ADC4(PA5)

ADC6(PA7)

20x/32x

 

 

 

 

 

 

 

110111

 

 

 

ADC4(PA5)

ADC6(PA7)

1x/8x

 

 

 

 

 

 

 

111000

 

 

 

ADC0(PA0)

ADC0(PA0)

20x/32x

 

 

 

 

 

 

 

111001

 

 

 

ADC0(PA0)

ADC0(PA0)

1x/8x

 

 

N/A

 

 

 

 

111010

 

 

ADC1(PA1)

ADC1(PA1)

20x/32x

 

 

 

 

 

 

 

111011

 

 

 

ADC2(PA2)

ADC2(PA2)

20x/32x

 

 

 

 

 

 

 

111100

 

 

 

ADC4(PA5)

ADC4(PA5)

20x/32x

 

 

 

 

 

 

 

111101

 

N/A

 

ADC5(PA6)

ADC5(PA6)

20x/32x

 

 

 

 

 

 

 

 

111110

 

 

ADC6(PA7)

ADC6(PA7)

20x/32x

 

 

 

 

 

 

 

 

 

 

111111

 

ADC11 (1)

 

N/A

N/A

N/A

1.For Temperature Sensor

156 ATtiny261/461/861

2588B–AVR–11/06

ATtiny261/461/861

19.10.2ADCSRA – ADC Control and Status Register A

Bit

7

6

5

4

3

2

1

0

 

0x06 (0x26)

ADEN

ADSC

ADATE

ADIF

ADIE

ADPS2

ADPS1

ADPS0

ADCSRA

 

 

 

 

 

 

 

 

 

 

 

Read/Write

R/W

R/W

R/W

R/W

R/W

R/W

R/W

R/W

Initial Value

0

0

0

0

0

0

0

0

 

• 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

In Single Conversion mode, write this bit to one to start each conversion. In Free Running mode, write this bit to one to start the first 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 25 ADC clock cycles instead of the normal 13. This first conversion performs initialization of the ADC.

ADSC will read as one as long as a conversion is in progress. When the conversion is complete, it returns to zero. Writing zero to this bit has no effect.

• Bit 5 – ADATE: ADC Auto Trigger Enable

When this bit is written to one, Auto Triggering of the ADC is enabled. The ADC will start a conversion on a positive edge of the selected trigger signal. The trigger source is selected by setting the ADC Trigger Select bits, ADTS in ADCSRB.

• 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.

• Bits 2:0 – ADPS2:0: ADC Prescaler Select Bits

These bits determine the division factor between the system clock frequency and the input clock to the ADC.

Table 19-5.

ADC Prescaler Selections

 

 

ADPS2

 

ADPS1

 

ADPS0

Division Factor

 

 

 

 

 

 

0

 

0

 

0

2

 

 

 

 

 

 

0

 

0

 

1

2

 

 

 

 

 

 

0

 

1

 

0

4

 

 

 

 

 

 

0

 

1

 

1

8

 

 

 

 

 

 

157

2588B–AVR–11/06

Соседние файлы в папке datasheets