17.3.3 Alternate Functions of Port D
The Port D pins with alternate functions are shown in the table below:
Port Pin | Alternate Function |
---|---|
PD7 |
AIN1 (Analog Comparator Negative Input)
|
PD6 |
AIN0 (Analog Comparator Positive Input)
|
PD5 |
T1 (Timer/Counter 1 External Counter Input)
|
PD4 |
XCK0 (USART0 External Clock Input/Output)
|
PD3 |
INT1 (External Interrupt 1 Input)
|
PD2 |
INT0 (External Interrupt 0 Input)
|
PD1 |
TXD0 (USART0 Output Pin)
|
PD0 |
RXD1 (USART1 Input Pin)
|
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.
Signal Name | PD7/AIN1 /PCINT23 | PD6/AIN0/ OC0A/PCINT22 | PD5/T1/OC0B/ PCINT21 | PD4/XCK0/ T0/PCINT20 |
---|---|---|---|---|
PUOE | 0 | 0 | 0 | 0 |
PUO | 0 | 0 | 0 | 0 |
DDOE | 0 | 0 | 0 | 0 |
DDOV | 0 | 0 | 0 | 0 |
PVOE | 0 | OC0A ENABLE | OC0B ENABLE | UMSEL |
PVOV | 0 | OC0A | OC0B | XCK0 OUTPUT |
DIEOE | PCINT23 • PCIE2 | PCINT22 • PCIE2 | PCINT21 • PCIE2 | PCINT20 • PCIE2 |
DIEOV | 1 | 1 | 1 | 1 |
DI | PCINT23 INPUT | PCINT22 INPUT | PCINT21 INPUT /T1 INPUT | PCINT20 INPUT /XCK0 INPUT /T0 INPUT |
AIO | AIN1 INPUT | AIN0 INPUT | – | – |
Signal Name | PD3/OC2B/INT1/ PCINT19 | PD2/OC3B/OC4B/INT0/ PCINT18 | PD1/TXD0/OC4A/ PCINT17 | PD0/OC3A/RXD0/ PCINT16 |
---|---|---|---|---|
PUOE | 0 | 0 | TXEN0 | RXEN0 |
PUO | 0 | 0 | 0 | PORTD0 • PUD |
DDOE | 0 | 0 | TXEN0 | RXEN0 |
DDOV | 0 | 0 | 1 | 0 |
PVOE | OC2B ENABLE | OC3B/OC4B ENABLE | TXEN0 / OC4A ENABLE | OC3A ENABLE |
PVOV | OC2B | OC3B/OC4B | TXD0 / OC4A | OC3A |
DIEOE | INT1 ENABLE + PCINT19 • PCIE2 | INT0 ENABLE + PCINT18 • PCIE2 | PCINT17 • PCIE2 | PCINT16 • PCIE2 |
DIEOV | 1 | 1 | 1 | 1 |
DI | PCINT19 INPUT /INT1 INPUT | PCINT18 INPUT /INT0 INPUT | PCINT17 INPUT | PCINT16 INPUT /RXD0 |
AIO | – | – | – | – |