144
8331B–AVR–03/12
Atmel AVR XMEGA AU
shows the I/O pin functionality and the registers that are available for
controlling a pin.
Figure 13-1.
General I/O pin functionality.
13.3
I/O Pin Use and Configuration
Each port has one data direction (DIR) register and one data output value (OUT) register that
are used for port pin control. The data input value (IN) register is used for reading the port pins.
In addition, each pin has a pin configuration (PINnCTRL) register for additional pin configuration.
Direction of the pin is decided by the DIRn bit in the DIR register. If DIRn is written to one, pin n
is configured as an output pin. If DIRn is written to zero, pin n is configured as an input pin.
When direction is set as output, the OUTn bit in OUT is used to set the value of the pin. If OUTn
is written to one, pin n is driven high. If OUTn is written to zero, pin n is driven low.
The IN register is used for reading pin values. A pin value can always be read regardless of
whether the pin is configured as input or output, except if digital input is disabled.
The I/O pins are tri-stated when a reset condition becomes active, even if no clocks are running.
D
Q
R
D
Q
R
Synchronizer
D
Q
R
D
Q
R
DIRn
OUTn
PINnCTRL
INn
Pxn
D
Q
R
C
o
n
t
r
o
l
L
o
g
i
c
Input Disable
Wired AND/OR
Slew Rate Limit
Digital Input Pin
Analog Input/Output
Inverted I/O
Pull Enable
Pull Keep
Pull Direction