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

13.2.6Unconnected Pins

If some pins are unused, it is recommended to ensure that these pins have a defined level. Even though most of the digital inputs are disabled in the deep sleep modes as described above, floating inputs should be avoided to reduce current consumption in all other modes where the digital inputs are enabled (Reset, Active mode and Idle mode).

The simplest method to ensure a defined level of an unused pin, is to enable the internal pull-up. In this case, the pull-up will be disabled during reset. If low power consumption during reset is important, it is recommended to use an external pull-up or pull-down. Connecting unused pins directly to VCC or GND is not recommended, since this may cause excessive currents if the pin is accidentally configured as an output.

13.3Alternate Port Functions

Most port pins have alternate functions in addition to being general digital I/Os. Figure 13-5 on page 73 shows how the port pin control signals from the simplified Figure 13-2 on page 68 can be overridden by alternate functions. The overriding signals may not be present in all port pins, but the figure serves as a generic description applicable to all port pins in the AVR microcontroller family.

ATmega640/V-1280/V-1281/V-2560/V-2561/V [DATASHEET]

72

2549Q–AVR–02/2014

Figure 13-5. Alternate Port Functions(1)

 

 

 

 

 

 

 

 

PUOExn

 

 

 

 

 

 

1

PUOVxn

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

PUD

 

 

 

 

 

 

 

 

 

DDOExn

 

 

 

 

 

 

1

DDOVxn

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

Q

D

 

 

 

 

 

 

DDxn

 

 

 

 

 

 

Q CLR

 

 

 

 

PVOExn

 

 

RESET

WDx

 

 

 

 

 

 

 

PVOVxn

 

 

 

 

RDx

 

 

 

 

 

 

 

BUS

Pxn

 

 

 

 

1

 

1

 

 

 

 

 

 

0

 

 

Q

D

0

 

DATA

 

 

 

PORTxn

 

PTOExn

 

 

 

 

 

 

DIEOExn

 

 

 

 

 

 

 

Q CLR

 

 

 

 

 

 

 

 

 

 

 

 

DIEOVxn

 

RESET

 

 

WPx

1

 

 

WRx

 

 

 

 

 

 

 

0

SLEEP

 

 

 

 

RRx

 

 

 

 

 

 

 

 

SYNCHRONIZER

 

 

RPx

 

 

 

 

 

 

 

 

 

D SET Q

D

Q

 

 

 

 

 

 

PINxn

 

 

 

 

 

L CLR Q

 

CLR Q

 

 

 

 

 

 

 

 

 

 

clk I/O

 

 

 

 

 

 

 

DIxn

 

 

 

 

 

 

 

AIOxn

 

PUOExn:

Pxn PULL-UP OVERRIDE ENABLE

PUOVxn:

Pxn PULL-UP OVERRIDE VALUE

DDOExn:

Pxn DATA DIRECTION OVERRIDE ENABLE

DDOVxn:

Pxn DATA DIRECTION OVERRIDE VALUE

PVOExn:

Pxn PORT VALUE OVERRIDE ENABLE

PVOVxn:

Pxn PORT VALUE OVERRIDE VALUE

DIEOExn:

Pxn DIGITAL INPUT-ENABLE OVERRIDE ENABLE

DIEOVxn:

Pxn DIGITAL INPUT-ENABLE OVERRIDE VALUE

SLEEP:

SLEEP CONTROL

PTOExn:

Pxn, PORT TOGGLE OVERRIDE ENABLE

PUD:

PULLUP DISABLE

WDx:

WRITE DDRx

RDx:

READ DDRx

RRx:

READ PORTx REGISTER

WRx:

WRITE PORTx

RPx:

READ PORTx PIN

WPx:

WRITE PINx

clk :

I/O CLOCK

I/O

DIGITAL INPUT PIN n ON PORTx

DIxn:

AIOxn:

ANALOG INPUT/OUTPUT PIN n ON PORTx

Note: 1. WRx, WPx, WDx, RRx, RPx, and RDx are common to all pins within the same port. clkI/O, SLEEP, and PUD are common to all ports. All other signals are unique for each pin.

ATmega640/V-1280/V-1281/V-2560/V-2561/V [DATASHEET]

73

2549Q–AVR–02/2014

Table 13-2 summarizes the function of the overriding signals. The pin and port indexes from Figure 13-5 on page 73 are not shown in the succeeding tables. The overriding signals are generated internally in the modules having the alternate function.

Table 13-2. Generic Description of Overriding Signals for Alternate Functions

Signal Name

Full Name

Description

 

 

 

 

Pull-up Override

If this signal is set, the pull-up enable is controlled by the PUOV signal. If this

PUOE

signal is cleared, the pull-up is enabled when {DDxn, PORTxn, PUD} =

Enable

 

0b010.

 

 

 

 

 

PUOV

Pull-up Override Value

If PUOE is set, the pull-up is enabled/disabled when PUOV is set/cleared,

regardless of the setting of the DDxn, PORTxn, and PUD Register bits.

 

 

 

 

 

 

Data Direction Override

If this signal is set, the Output Driver Enable is controlled by the DDOV

DDOE

signal. If this signal is cleared, the Output driver is enabled by the DDxn

Enable

 

Register bit.

 

 

 

 

 

DDOV

Data Direction Override

If DDOE is set, the Output Driver is enabled/disabled when DDOV is

Value

set/cleared, regardless of the setting of the DDxn Register bit.

 

 

 

 

 

Port Value Override

If this signal is set and the Output Driver is enabled, the port value is

PVOE

controlled by the PVOV signal. If PVOE is cleared, and the Output Driver is

Enable

 

enabled, the port Value is controlled by the PORTxn Register bit.

 

 

 

 

 

PVOV

Port Value Override

If PVOE is set, the port value is set to PVOV, regardless of the setting of the

Value

PORTxn Register bit.

 

 

 

 

PTOE

Port Toggle Override

If PTOE is set, the PORTxn Register bit is inverted.

Enable

 

 

 

 

 

 

Digital Input Enable

If this bit is set, the Digital Input Enable is controlled by the DIEOV signal. If

DIEOE

this signal is cleared, the Digital Input Enable is determined by MCU state

Override Enable

 

(Normal mode, sleep mode).

 

 

 

 

 

DIEOV

Digital Input Enable

If DIEOE is set, the Digital Input is enabled/disabled when DIEOV is

Override Value

set/cleared, regardless of the MCU state (Normal mode, sleep mode).

 

 

 

 

 

 

This is the Digital Input to alternate functions. In the figure, the signal is

DI

Digital Input

connected to the output of the schmitt trigger but before the synchronizer.

Unless the Digital Input is used as a clock source, the module with the

 

 

 

 

alternate function will use its own synchronizer.

 

 

 

AIO

Analog Input/Output

This is the Analog Input/output to/from alternate functions. The signal is

connected directly to the pad, and can be used bi-directionally.

 

 

 

 

 

The following subsections shortly describe the alternate functions for each port, and relate the overriding signals to the alternate function. Refer to the alternate function description for further details.

ATmega640/V-1280/V-1281/V-2560/V-2561/V [DATASHEET]

74

2549Q–AVR–02/2014

13.3.1Alternate Functions of Port A

The Port A has an alternate function as the address low byte and data lines for the External Memory Interface.

Table 13-3.

Port A Pins Alternate Functions

Port Pin

 

Alternate Function

 

 

 

PA7

 

AD7 (External memory interface address and data bit 7)

 

 

 

PA6

 

AD6 (External memory interface address and data bit 6)

 

 

 

PA5

 

AD5 (External memory interface address and data bit 5)

 

 

 

PA4

 

AD4 (External memory interface address and data bit 4)

 

 

 

PA3

 

AD3 (External memory interface address and data bit 3)

 

 

 

PA2

 

AD2 (External memory interface address and data bit 2)

 

 

 

PA1

 

AD1 (External memory interface address and data bit 1)

 

 

 

PA0

 

AD0 (External memory interface address and data bit 0)

 

 

 

Table 13-4 and Table 13-5 on page 76 relates the alternate functions of Port A to the overriding signals shown in Figure 13-5 on page 73.

Table 13-4.

Overriding Signals for Alternate Functions in PA7:PA4

 

 

 

 

 

 

Signal Name

 

 

 

PA7/AD7

 

 

 

PA6/AD6

 

 

 

PA5/AD5

 

 

 

PA4/AD4

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PUOE

 

 

 

SRE

 

 

 

SRE

 

 

 

SRE

 

 

 

SRE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

~(

 

 

| ADA(1)) •

~(

 

| ADA) • PORTA6

~(

 

| ADA) • PORTA5

~(

 

| ADA) • PORTA4

PUOV

WR

WR

WR

WR

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PORTA7 • PUD

 

 

 

• PUD

 

 

 

• PUD

 

 

 

• PUD

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

DDOE

 

 

 

SRE

 

 

 

SRE

 

 

 

SRE

 

 

 

SRE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

DDOV

 

 

 

 

 

| ADA

 

 

 

 

| ADA

 

 

 

 

| ADA

 

 

 

 

| ADA

 

 

 

WR

 

 

WR

 

 

WR

 

 

WR

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PVOE

 

 

 

SRE

 

 

 

SRE

 

 

 

SRE

 

 

 

SRE

 

 

 

 

 

 

PVOV

 

A7 • ADA | D7 OUTPUT

A6 • ADA | D6 OUTPUT

A5 • ADA | D5 OUTPUT

A4 • ADA | D4 OUTPUT

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

• WR

 

 

 

• WR

 

 

 

• WR

 

 

 

• WR

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

DIEOE

 

0

 

 

 

0

 

0

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

DIEOV

 

0

 

 

 

0

 

0

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

DI

 

 

D7 INPUT

 

 

D6 INPUT

 

 

D5 INPUT

 

 

D4 INPUT

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

AIO

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Note: 1. ADA is short for ADdress Active and represents the time when address is output. See “External Memory Interface” on page 27 for details.

ATmega640/V-1280/V-1281/V-2560/V-2561/V [DATASHEET]

75

2549Q–AVR–02/2014