Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
ATtiny104_Datasheet.pdf
Скачиваний:
0
Добавлен:
12.02.2026
Размер:
3.8 Mб
Скачать

19.15.3. ADC Control and Status Register B

Name:  ADCSRB Offset:  0x1C Reset:  0x00 Property: -

 

Bit

7

6

5

4

3

2

1

0

 

ADLAR

 

 

 

 

ADTS2

ADTS1

ADTS0

Access

R/W

 

 

 

 

R/W

R/W

R/W

Reset

0

 

 

 

 

0

0

0

Bit 7 – ADLAR: Left Adjustment for ADC Result Readout

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.

ADLAR = 0

Bit

15

14

13

12

11

10

9

8

 

0x1A

ADC9

ADC8

ADCH

0x19

ADC7

ADC6

ADC5

ADC4

ADC3

ADC2

ADC1

ADC0

ADCL

 

7

6

5

4

3

2

1

0

 

Read/Write

R

R

R

R

R

R

R

R

 

 

R

R

R

R

R

R

R

R

 

Initial Value

0

0

0

0

0

0

0

0

 

 

0

0

0

0

0

0

0

0

 

ADLAR = 1

Bit

15

14

13

12

11

10

9

8

 

0x1A

ADC9

ADC8

ADC7

ADC6

ADC5

ADC4

ADC3

ADC2

ADCH

0x19

ADC1

ADC0

ADCL

 

7

6

5

4

3

2

1

0

 

Read/Write

R

R

R

R

R

R

R

R

 

 

R

R

R

R

R

R

R

R

 

Initial Value

0

0

0

0

0

0

0

0

 

 

0

0

0

0

0

0

0

0

 

Bits 2:0 – ADTSn: ADC Auto Trigger Source [n = 2:0]

If ADATE in ADCSRA is written to one, the value of these bits selects which source will trigger an ADC conversion. If ADATE is cleared, the ADTS[2:0] settings will have no effect. A conversion will be triggered by the rising edge of the selected Interrupt Flag. Note that switching from a trigger source that is cleared to a trigger source that is set, will generate a positive edge on the trigger signal. If ADEN in ADCSRA is set, this will start a conversion. Switching to Free Running mode (ADTS[2:0]=0) will not cause a trigger event, even if the ADC Interrupt Flag is set.

Table 19-5. ADC Auto Trigger Source Selection

ADTS[2:0]

Trigger Source

 

 

000

Free Running mode

 

 

001

Analog Comparator

 

 

010

External Interrupt Request 0

 

 

Atmel ATtiny102 / ATtiny104 [DATASHEET] 180

Atmel-42505D-ATtiny102-ATtiny104_Datasheet_Complete-10/2016

 

 

 

 

 

 

 

 

 

 

 

 

 

ADTS[2:0]

Trigger Source

 

 

011

Timer/Counter 0 Compare Match A

 

 

 

 

 

100Timer/Counter 0 Overflow

101Timer/Counter 0 Compare Match B

110Pin Change Interrupt 0 Request

111Timer/Counter 0 Capture Event

Atmel ATtiny102 / ATtiny104 [DATASHEET] 181

Atmel-42505D-ATtiny102-ATtiny104_Datasheet_Complete-10/2016

19.15.4.ADC Data Register Low and High Byte (ADLAR=0)

The ADCL and ADCH register pair represents the 16-bit value, ADC Data Register. The low byte [7:0] (suffix L) is accessible at the original offset. The high byte [15:8] (suffix H) can be accessed at offset + 0x01. For more details on reading and writing 16-bit registers, refer to Accessing 16-bit Registers.

When an ADC conversion is complete, the result is found in these two registers.

When ADCL is read, the ADC Data Register is not updated until ADCH is read. Consequently, if the result is left adjusted and no more than 8-bit precision is required, it is sufficient to read ADCH. Otherwise, ADCL must be read first, then ADCH.

The ADLAR bit and the MUXn bits in ADMUX affect the way the result is read from the registers. If ADLAR is set (ADLAR=1), the result is left adjusted. If ADLAR is cleared (ADLAR=0 which is the default value), the result is right adjusted.

Name:  ADCL and ADCH

Offset:  0x19

Reset:  0x00 Property: ADLAR = 0

 

Bit

15

14

13

12

11

10

9

8

 

 

 

 

 

 

 

ADC9

ADC8

Access

 

 

 

 

 

 

R

R

Reset

 

 

 

 

 

 

0

0

Bit

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

ADC7

ADC6

ADC5

ADC4

ADC3

ADC2

ADC1

ADC0

 

 

 

 

 

 

 

 

 

Access

R

R

R

R

R

R

R

R

Reset

0

0

0

0

0

0

0

0

Bits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 – ADCn: ADC Conversion Result

These bits represent the result from the conversion. Refer to ADC Conversion Result for details.

Atmel ATtiny102 / ATtiny104 [DATASHEET] 182

Atmel-42505D-ATtiny102-ATtiny104_Datasheet_Complete-10/2016

19.15.5.ADC Data Register Low and High Byte (ADLAR=1)

The ADCL and ADCH register pair represents the 16-bit value, ADC Data Register. The low byte [7:0] (suffix L) is accessible at the original offset. The high byte [15:8] (suffix H) can be accessed at offset + 0x01. For more details on reading and writing 16-bit registers, refer to Accessing 16-bit Registers.

When an ADC conversion is complete, the result is found in these two registers.

When ADCL is read, the ADC Data Register is not updated until ADCH is read. Consequently, if the result is left adjusted and no more than 8-bit precision is required, it is sufficient to read ADCH. Otherwise, ADCL must be read first, then ADCH.

The ADLAR bit and the MUXn bits in ADMUX affect the way the result is read from the registers. If ADLAR is set (ADLAR=1), the result is left adjusted. If ADLAR is cleared (ADLAR=0 which is the default value), the result is right adjusted.

Name:  ADCL and ADCH

Offset:  0x19

Reset:  0x00 Property: ADLAR = 1

 

Bit

15

14

13

12

11

10

9

8

 

ADC9

ADC8

ADC7

ADC6

ADC5

ADC4

ADC3

ADC2

Access

 

 

 

 

 

 

 

 

R

R

R

R

R

R

R

R

Reset

0

0

0

0

0

0

0

0

Bit

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

ADC1

ADC0

 

 

 

 

 

 

Access

R

R

 

 

 

 

 

 

Reset

0

0

 

 

 

 

 

 

Bits 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 – ADCn: ADC Conversion Result

These bits represent the result from the conversion. Refer to ADC Conversion Result for details.

Atmel ATtiny102 / ATtiny104 [DATASHEET] 183

Atmel-42505D-ATtiny102-ATtiny104_Datasheet_Complete-10/2016