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

ATmega128

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 – ADFR: ADC Free Running Select

When this bit is written to one, the ADC operates in Free Running mode. In this mode, the ADC samples and updates the data registers continuously. Writing zero to this bit will terminate Free Running mode.

• 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 XTAL frequency and the input clock to the ADC.

Table 99. 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

 

 

 

 

1

0

1

32

 

 

 

 

1

1

0

64

 

 

 

 

1

1

1

128

 

 

 

 

The ADC Data Register –

ADCL and ADCH

ADLAR = 0:

Bit

15

14

13

12

11

10

9

8

 

 

ADC9

ADC8

ADCH

 

 

 

 

 

 

 

 

 

 

 

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

 

247

2467K–AVR–04/04

ADLAR = 1:

Bit

15

14

13

12

11

10

9

8

 

 

ADC9

ADC8

ADC7

ADC6

ADC5

ADC4

ADC3

ADC2

ADCH

 

 

 

 

 

 

 

 

 

 

 

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

 

When an ADC conversion is complete, the result is found in these two registers. If differential channels are used, the result is presented in two’s complement form.

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 in ADMUX, and the MUXn bits in ADMUX affect the way the result is read from the registers. If ADLAR is set, the result is left adjusted. If ADLAR is cleared (default), the result is right adjusted.

• ADC9:0: ADC Conversion Result

These bits represent the result from the conversion, as detailed in “ADC Conversion

Result” on page 243.

248 ATmega128

2467K–AVR–04/04

ATmega128

JTAG Interface and

On-chip Debug

System

Features

Overview

JTAG (IEEE std. 1149.1 Compliant) Interface

Boundary-scan Capabilities According to the IEEE std. 1149.1 (JTAG) Standard

Debugger Access to:

All Internal Peripheral Units

Internal and External RAM

The Internal Register File

Program Counter

EEPROM and Flash Memories

Extensive On-chip Debug Support for Break Conditions, Including

AVR Break Instruction

Break on Change of Program Memory Flow

Single Step Break

Program Memory Breakpoints on Single Address or Address Range

Data Memory Breakpoints on Single Address or Address Range

Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface

On-chip Debugging Supported by AVR Studio

The AVR IEEE std. 1149.1 compliant JTAG interface can be used for

Testing PCBs by using the JTAG Boundary-scan capability

Programming the non-volatile memories, Fuses and Lock bits

On-chip debugging

A brief description is given in the following sections. Detailed descriptions for Programming via the JTAG interface, and using the Boundary-scan Chain can be found in the sections “Programming Via the JTAG Interface” on page 309 and “IEEE 1149.1 (JTAG) Boundary-scan” on page 255, respectively. The On-chip Debug support is considered being private JTAG instructions, and distributed within ATMEL and to selected third party vendors only.

Figure 120 shows a block diagram of the JTAG interface and the On-chip Debug system. The TAP Controller is a state machine controlled by the TCK and TMS signals. The TAP Controller selects either the JTAG Instruction Register or one of several Data Registers as the scan chain (Shift Register) between the TDI – input and TDO – output. The Instruction Register holds JTAG instructions controlling the behavior of a Data Register.

The ID-Register, Bypass Register, and the Boundary-scan Chain are the data registers used for board-level testing. The JTAG Programming Interface (actually consisting of several physical and virtual Data Registers) is used for serial programming via the JTAG interface. The Internal Scan Chain and Break Point Scan Chain are used for On-chip debugging only.

Test Access Port – TAP The JTAG interface is accessed through four of the AVR’s pins. In JTAG terminology, these pins constitute the Test Access Port –– TAP. These pins are:

TMS: Test mode select. This pin is used for navigating through the TAP-controller state machine.

TCK: Test clock. JTAG operation is synchronous to TCK.

TDI: Test Data In. Serial input data to be shifted in to the Instruction Register or Data Register (Scan Chains).

TDO: Test Data Out. Serial output data from Instruction Register or Data Register.

249

2467K–AVR–04/04

The IEEE std. 1149.1 also specifies an optional TAP signal; TRST – Test ReSeT – which is not provided.

When the JTAGEN fuse is unprogrammed, these four TAP pins are normal port pins and the TAP controller is in reset. When programmed and the JTD bit in MCUCSR is cleared, the TAP input signals are internally pulled high and the JTAG is enabled for Boundary-scan and programming. In this case, the TAP output pin (TDO) is left floating in states where the JTAG TAP controller is not shifting data, and must therefore be connected to a pull-up resistor or other hardware having pull-ups (for instance the TDI-input of the next device in the scan chain). The device is shipped with this fuse programmed.

For the On-chip Debug system, in addition to the JTAG interface pins, the RESET pin is monitored by the debugger to be able to detect External Reset sources. The debugger can also pull the RESET pin low to reset the whole system, assuming only open collectors on the Reset line are used in the application.

Figure 120. Block Diagram

I/O PORT 0

DEVICE BOUNDARY

 

 

 

 

 

BOUNDARY SCAN CHAIN

 

 

TDI

 

 

JTAG PROGRAMMING

 

 

 

 

TDO

TAP

 

 

 

 

 

 

INTERFACE

 

 

 

 

TCK

 

 

 

 

 

CONTROLLER

 

 

 

 

 

 

TMS

 

 

 

 

 

 

 

 

 

 

 

 

 

INTERNAL

AVR CPU

 

 

 

 

 

FLASH

Address

 

 

 

 

 

 

SCAN

PC

 

 

 

 

INSTRUCTION

MEMORY

Data

 

 

 

 

CHAIN

Instruction

 

 

 

 

REGISTER

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ID

 

 

 

 

 

 

 

 

REGISTER

BREAKPOINT

 

 

 

 

 

M

 

UNIT

 

FLOW CONTROL

 

 

 

 

BYPASS

 

 

 

ANALOG PERIPHERIAL UNITS

Analog inputs

 

U

 

 

UNIT

 

 

REGISTER

 

 

DIGITAL

 

X

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PERIPHERAL

 

 

 

 

 

 

UNITS

 

 

BREAKPOINT

 

 

 

 

 

 

SCAN CHAIN

 

 

 

 

 

 

 

 

 

 

 

 

JTAG / AVR CORE

 

 

 

 

ADDRESS

 

 

 

COMMUNICATION

 

 

 

 

OCD STATUS

 

INTERFACE

 

lines

 

 

DECODER

 

 

 

 

 

 

 

 

 

 

AND CONTROL

 

 

 

 

 

 

 

 

 

 

 

Control & Clock

 

 

 

 

 

I/O PORT n

 

 

 

250 ATmega128

2467K–AVR–04/04

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