19.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 |
XCK (USART External Clock Input/Output)
|
PD3 |
INT1 (External Interrupt 1 Input)
|
PD2 |
INT0 (External Interrupt 0 Input)
|
PD1 |
TXD (USART0 Output Pin)
|
PD0 |
RXD (USART Input Pin)
|
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.
Signal Name | PD7/AIN1 /PCINT23 | PD6/AIN0/ OC0A/PCINT22 | PD5/T1/OC0B/ PCINT21 | PD4/XCK/ 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 | XCK 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 / XCK INPUT / T0 INPUT |
AIO | AIN1 INPUT | AIN0 INPUT | – | – |
Signal Name | PD3/OC2B/INT1/ PCINT19 | PD2/OC3B/OC4B/INT0/ PCINT18 | PD1/TXD/ PCINT17 | PD0/RXD/ PCINT16 |
---|---|---|---|---|
PUOE | 0 | 0 | TXEN | RXEN |
PUO | 0 | 0 | 0 | PORTD • PUD |
DDOE | 0 | 0 | TXEN | RXEN |
DDOV | 0 | 0 | 1 | 0 |
PVOE | OC2B ENABLE | OC3B/OC4B ENABLE | TXEN | |
PVOV | OC2B | OC3B/OC4B | TXD | |
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 / RXD |
AIO | – | – | – | – |