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

ATtiny24/44/84

18.10 Register Description

18.10.1ADMUX – ADC Multiplexer Selection Register

Bit

7

6

5

4

3

2

1

0

 

0x07 (0x27)

REFS1

REFS0

MUX5

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: Reference Selection Bits

These bits select the voltage reference for the ADC, as shown in Table 18-3 on page 151. 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).

Special care should be taken when changing differential channels. Once a differentia channel has been selected, the stage may take as much as TBD µs to stabilize to the new value. Thus conversions should not be started within the first TBD µs after selecting a new differential channel. Alternatively, conversion results obtained within this period should be discarded.

The same settling time should be observed for the first differential conversion after changing

ADC reference (by changing the REFS1:0 bits in ADMUX).

If channels where differential gain is used ie. the gainstage, using VCC or an optional external AREF higher than (VCC - 1V) is not recommended, as this will affect ADC accuracy. It is not allowed to connect internal voltage reference to AREF pin, if an external voltage is being applied to it already. Internal voltage reference is connected AREF pin when REFS1:0 is set to value ‘11’.

Table 18-3.

Voltage Reference Selections for ADC

REFS1

REFS0

Voltage Reference Selection

 

 

 

0

0

VCC used as analog reference, disconnected from PA0 (AREF).

0

1

External Voltage Reference at PA0 (AREF) pin, Internal Voltage Reference

turned off.

 

 

 

 

 

1

0

Internal 1.1V Voltage Reference.

 

 

 

1

1

Reserved.

 

 

 

• Bits 5:0 – MUX5:0: Analog Channel and Gain Selection Bits

The value of these bits selects which combination of analog inputs are connected to the ADC. In case of differential input , gain selection is also made with these bits. Selections on Table 18-4 on page 152 show values for single endid channels and where the the differential channels as well as the offset calibration selections are located. Selecting the single-ended channel ADC8 enables the temperature measurement. See Table 18-4 on page 152 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).

151

8006E–AVR–09/06

Table 18-4. Single Endid Input channel Selections.

Single Ended Input

MUX5..0

 

 

ADC0 (PA0)

000000

 

 

ADC1 (PA1)

000001

 

 

ADC2 (PA2)

000010

 

 

ADC3 (PA3)

000011

 

 

ADC4 (PA4)

000100

 

 

ADC5 (PA5)

000101

 

 

ADC6 (PA6)

000110

 

 

ADC7 (PA7)

000111

 

 

Reserved for differential channels(1)

001000 - 011111

0V (AGND)

100000

 

 

1.1V (I Ref)

100001

 

 

ADC8(2)

100010

Reserved for offset calibration(3)

100011 - 100111

Reserved for reversal differential channels(1)

101000 - 111111

Notes: 1. See Table 18-5 on page 153 for details.

2.”Temperature Measurement” on page 150

3.For offset calibration only .See Table 18-5 on page 153 and ”ADC Operation” on page 140

See Table 18-5 on page 153 for details of selections of differential input channel selections as well as selections of offset calibration channels. MUX0 bit works as a gain selection bit for differential channels shown in Table 18-5 on page 153. When MUX0 bit is cleared (‘0’) 1x gain is selected and when it is set (‘1’) 20x gain is selected. For normal differential channel pairs MUX5 bit work as a polarity reversal bit. Togling of the MUX5 bit exhanges the positive and negative channel other way a round.

For offset calibration purpose the offset of the certain differential channels can be measure by selecting the same input for both negative and positive input. This calibration can be done for ADC0, ADC3 and ADC7. ”ADC Operation” on page 140 describes offset calibration in a more detailed level.

152 ATtiny24/44/84

8006E–AVR–09/06

ATtiny24/44/84

Table 18-5. Differential Input channel Selections.

Positive Differential

Negative Differential

 

MUX5..0

 

 

 

Input

Input

Gain 1x

 

Gain 20x

 

 

 

 

 

 

ADC0 (PA0) (1)

N/A

 

100011

ADC0 (PA0)

ADC1 (PA1)

001000

 

001001

 

 

 

 

 

 

ADC3 (PA3)

001010

 

001011

 

 

 

 

 

 

ADC0 (PA0)

101000

 

101001

 

 

 

 

 

ADC1 (PA1)

ADC2 (PA2)

001100

 

001101

 

 

 

 

 

 

ADC3 (PA3)

001110

 

001111

 

 

 

 

 

ADC2 (PA2)

ADC1 (PA1)

101100

 

101101

 

 

 

 

ADC3 (PA3)

010000

 

010001

 

 

 

 

 

 

 

 

ADC0 (PA0)

101010

 

101011

 

 

 

 

 

 

ADC1 (PA1)

101110

 

101111

 

 

 

 

 

 

ADC2 (PA2)

110000

 

110001

 

 

 

 

 

ADC3 (PA3)

ADC3 (PA3)(1)

100100

 

100101

ADC4 (PA4

010010

 

010011

 

 

 

 

 

 

 

 

ADC5 (PA5)

010100

 

010101

 

 

 

 

 

 

ADC6 (PA6)

010110

 

010111

 

 

 

 

 

 

ADC7 (PA7)

011000

 

011001

 

 

 

 

 

ADC4 (PA4

ADC3 (PA3)

110010

 

110011

 

 

 

 

ADC5 (PA5)

011010

 

011011

 

 

 

 

 

 

 

 

ADC3 (PA3)

110100

 

110101

 

 

 

 

 

ADC5 (PA5)

ADC4 (PA4)

111010

 

111011

 

 

 

 

 

 

ADC6 (PA6)

011100

 

011101

 

 

 

 

 

 

ADC3 (PA3)

110110

 

110111

 

 

 

 

 

ADC6 (PA6)

ADC5 (PA5)

111100

 

111101

 

 

 

 

 

 

ADC7 (PA7)

011110

 

011111

 

 

 

 

 

 

ADC3 (PA3)

111000

 

111001

 

 

 

 

 

ADC7 (PA7)

ADC6 (PA6)

111110

 

111111

 

 

 

 

 

 

ADC7 (PA7)(1)

100110

 

100111

1.For offset calibration only .See ”ADC Operation” on page 140

153

8006E–AVR–09/06

18.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 instruction is 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 18-6.

ADC Prescaler Selections

 

 

ADPS2

 

ADPS1

 

ADPS0

Division Factor

 

 

 

 

 

 

0

 

0

 

0

2

 

 

 

 

 

 

0

 

0

 

1

2

 

 

 

 

 

 

0

 

1

 

0

4

 

 

 

 

 

 

0

 

1

 

1

8

 

 

 

 

 

 

1

 

0

 

0

16

 

 

 

 

 

 

154 ATtiny24/44/84

8006E–AVR–09/06

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