17.3.3 Alternate Functions of Port D

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

Table 17-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

XCK0 (USART0 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)

OC3B (Timer/Counter3 Output Compare Match B Output)

OC4B (Timer/Counter4 Output Compare Match B Output)

PCINT18 (Pin Change Interrupt 18)

PD1

TXD0 (USART0 Output Pin)

OC4A (Timer/Counter4 Output Compare Match A Output)

PCINT17 (Pin Change Interrupt 17)

PD0

RXD1 (USART1 Input Pin)

OC3A (Timer/Counter3 Output Compare Match A Output)

PCINT16 (Pin Change Interrupt 16)

The alternate pin configuration is as follows:

  • AIN1/OC2B/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.
  • XCK0/T0/PCINT20 – Port D, Bit 4
    • XCK0: USART0 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 PD3 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/OC3B/PCINT18 – Port D, Bit 2
    • INT0: External Interrupt source 0. The PD2 pin can serve as an external interrupt source.
    • OC3B: Output Compare Match output: The PD2 pin can serve as an external output for the Timer/Counter3 Compare Match B. The PD2 pin has to be configured as an output (DDD2 set (one)) to serve this function. The OC3B pin is also the output pin for the PWM mode timer function.
    • OC4B: Output Compare Match output: The PD2 pin can serve as an external output for the Timer/Counter4 Compare Match B. The PD2 pin has to be configured as an output (DDD2 set (one)) to serve this function. The OC4B pin is also the output pin for the PWM mode timer function.
    • PCINT18: Pin Change Interrupt source 18. The PD2 pin can serve as an external interrupt source.
  • TXD0/PCINT17 – Port D, Bit 1
    • TXD0: Transmit Data (Data output pin for the USART0). When the USART0 Transmitter is enabled, this pin is configured as an output regardless of the value of DDD1.
    • OC4A: Output Compare Match output: The PD1 pin can serve as an external output for the Timer/Counter4 Compare Match A. The PD1 pin has to be configured as an output (DDD1 set (one)) to serve this function. The OC4A pin is also the output pin for the PWM mode timer function.
    • PCINT17: Pin Change Interrupt source 17. The PD1 pin can serve as an external interrupt source.
  • RXD0/OC3A/PCINT16 – Port D, Bit 0
    • RXD0: Receive Data (Data input pin for the USART0). When the USART0 Receiver is enabled this pin is configured as an input regardless of the value of DDD0. When the USART0 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.
    • OC3A: Output Compare Match output: The PD0 pin can serve as an external output for the Timer/Counter3 Compare Match A. The PD0 pin has to be configured as an output (DDD0 set (one)) to serve this function. The OC3A pin is also the output pin for the PWM mode timer function.

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

Table 17-10. Overriding Signals for Alternate Functions PD7...PD4
Signal
NamePD7/AIN1
/PCINT23PD6/AIN0/
OC0A/PCINT22PD5/T1/OC0B/
PCINT21PD4/XCK0/
T0/PCINT20
PUOE0000
PUO0000
DDOE0000
DDOV0000
PVOE0OC0A ENABLEOC0B ENABLEUMSEL
PVOV0OC0AOC0BXCK0 OUTPUT
DIEOEPCINT23 • PCIE2PCINT22 • PCIE2PCINT21 • PCIE2PCINT20 • PCIE2
DIEOV1111
DIPCINT23 INPUTPCINT22 INPUTPCINT21 INPUT
/T1 INPUTPCINT20 INPUT
/XCK0 INPUT
/T0 INPUT
AIOAIN1 INPUTAIN0 INPUT
Table 17-11. Overriding Signals for Alternate Functions in PD3...PD0
Signal
NamePD3/OC2B/INT1/
PCINT19PD2/OC3B/OC4B/INT0/
PCINT18PD1/TXD0/OC4A/
PCINT17PD0/OC3A/RXD0/
PCINT16
PUOE00TXEN0RXEN0
PUO000PORTD0 • PUD
DDOE00TXEN0RXEN0
DDOV0010
PVOEOC2B ENABLEOC3B/OC4B ENABLETXEN0 / OC4A ENABLEOC3A ENABLE
PVOVOC2BOC3B/OC4BTXD0 / OC4AOC3A
DIEOEINT1 ENABLE + PCINT19 • PCIE2INT0 ENABLE + PCINT18 • PCIE2PCINT17 • PCIE2PCINT16 • PCIE2
DIEOV1111
DIPCINT19 INPUT
/INT1 INPUTPCINT18 INPUT
/INT0 INPUTPCINT17 INPUTPCINT16 INPUT
/RXD0
AIO