19.3.3 Alternate Functions of Port D

The Port D pins with alternate functions are shown in the table below:

Table 19-9. Port D Pins Alternate Functions
Port PinAlternate Function
PD7

AIN1 (Analog Comparator Negative Input)

PCINT23 (Pin Change Interrupt 23)

PD6

AIN0 (Analog Comparator Positive Input)

OC0A (Timer/Counter0 Output Compare Match A Output)

PCINT22 (Pin Change Interrupt 22)

PD5

T1 (Timer/Counter 1 External Counter Input)

OC0B (Timer/Counter0 Output Compare Match B Output)

PCINT21 (Pin Change Interrupt 21)

PD4

XCK (USART External Clock Input/Output)

T0 (Timer/Counter 0 External Counter Input)

PCINT20 (Pin Change Interrupt 20)

PD3

INT1 (External Interrupt 1 Input)

OC2B (Timer/Counter2 Output Compare Match B Output)

PCINT19 (Pin Change Interrupt 19)

PD2

INT0 (External Interrupt 0 Input)

PCINT18 (Pin Change Interrupt 18)

PD1

TXD (USART0 Output Pin)

PCINT17 (Pin Change Interrupt 17)

PD0

RXD (USART Input Pin)

PCINT16 (Pin Change Interrupt 16)

The alternate pin configuration is as follows:

  • AIN1/PCINT23 – Port D, Bit 7
    • AIN1: Analog Comparator1 Negative Input. Configure the port pin as input with the internal pull-up switched off to avoid the digital port function from interfering with the function of the Analog Comparator.
    • PCINT23: Pin Change Interrupt source 23. The PD7 pin can serve as an external interrupt source.
  • AIN0/OC0A/PCINT22 – Port D, Bit 6
    • AIN0: Analog Comparator0 Positive Input. Configure the port pin as input with the internal pull-up switched off to avoid the digital port function from interfering with the function of the Analog Comparator.
    • OC0A: Output Compare Match output. The PD6 pin can serve as an external output for the Timer/Counter0 Compare Match A. The PD6 pin has to be configured as an output (DDD6 set (one)) to serve this function. The OC0A pin is also the output pin for the PWM mode timer function.
    • PCINT22: Pin Change Interrupt source 22. The PD6 pin can serve as an external interrupt source.
  • T1/OC0B/PCINT21 – Port D, Bit 5
    • T1: Timer/Counter1 counter source.
    • OC0B: Output Compare Match output. The PD5 pin can serve as an external output for the Timer/Counter0 Compare Match B. The PD5 pin has to be configured as an output (DDD5 set (one)) to serve this function. The OC0B pin is also the output pin for the PWM mode timer function.
    • PCINT21: Pin Change Interrupt source 21. The PD5 pin can serve as an external interrupt source.
  • XCK/T0/PCINT20 – Port D, Bit 4
    • XCK: USART external clock.
    • T0: Timer/Counter0 counter source.
    • PCINT20: Pin Change Interrupt source 20. The PD4 pin can serve as an external interrupt source.
  • INT1/OC2B/PCINT19 – Port D, Bit 3
    • INT1: External Interrupt source 1. The PD3 pin can serve as an external interrupt source.
    • OC2B: Output Compare Match output. The PD2 pin can serve as an external output for the Timer/Counter2 Compare Match B. The PD3 pin has to be configured as an output (DDD3 set (one)) to serve this function. The OC2B pin is also the output pin for the PWM mode timer function.
    • PCINT19: Pin Change Interrupt source 19. The PD3 pin can serve as an external interrupt source.
  • INT0/PCINT18 – Port D, Bit 2
    • INT0: External Interrupt source 0. The PD2 pin can serve as an external interrupt source.
    • PCINT18: Pin Change Interrupt source 18. The PD2 pin can serve as an external interrupt source.
  • TXD/PCINT17 – Port D, Bit 1
    • TXD: Transmit Data (Data output pin for the USART). When the USART Transmitter is enabled, this pin is configured as an output regardless of the value of DDD1.
    • PCINT17: Pin Change Interrupt source 17. The PD1 pin can serve as an external interrupt source.
  • RXD/PCINT16 – Port D, Bit 0
    • RXD: Receive Data (Data input pin for the USART). When the USART Receiver is enabled this pin is configured as an input regardless of the value of DDD0. When the USART forces this pin to be an input, the pull-up can still be controlled by the PORTD0 bit.
    • PCINT16: Pin Change Interrupt source 16. The PD0 pin can serve as an external interrupt source.

The tables below relate the alternate functions of Port D to the overriding signals shown in Figure 19-5.

Table 19-10. Overriding Signals for Alternate Functions PD7...PD4
Signal
NamePD7/AIN1
/PCINT23PD6/AIN0/
OC0A/PCINT22PD5/T1/OC0B/
PCINT21PD4/XCK/
T0/PCINT20
PUOE0000
PUO0000
DDOE0000
DDOV0000
PVOE0OC0A ENABLEOC0B ENABLEUMSEL
PVOV0OC0AOC0BXCK OUTPUT
DIEOEPCINT23 • PCIE2PCINT22 • PCIE2PCINT21 • PCIE2PCINT20 • PCIE2
DIEOV1111
DIPCINT23 INPUTPCINT22 INPUTPCINT21 INPUT
 / T1 INPUTPCINT20 INPUT
 / XCK INPUT
 / T0 INPUT
AIOAIN1 INPUTAIN0 INPUT
Table 19-11. Overriding Signals for Alternate Functions in PD3...PD0
Signal
NamePD3/OC2B/INT1/
PCINT19PD2/OC3B/OC4B/INT0/
PCINT18PD1/TXD/
PCINT17PD0/RXD/
PCINT16
PUOE00TXENRXEN
PUO000PORTD • PUD
DDOE00TXENRXEN
DDOV0010
PVOEOC2B ENABLEOC3B/OC4B ENABLETXEN
PVOVOC2BOC3B/OC4BTXD
DIEOEINT1 ENABLE + PCINT19 • PCIE2INT0 ENABLE + PCINT18 • PCIE2PCINT17 • PCIE2PCINT16 • PCIE2
DIEOV1111
DIPCINT19 INPUT
 / INT1 INPUTPCINT18 INPUT
 / INT0 INPUTPCINT17 INPUTPCINT16 INPUT
 / RXD
AIO