Atmel Xplained Pro Evaluation Kit for the ATSAMD21J18A Microcontroller ATSAMD21-XPRO ATSAMD21-XPRO Fiche De Données
Codes de produits
ATSAMD21-XPRO
371
Atmel | SMART SAM D21 [DATASHEET]
Atmel-42181C–SAM-D21_Datasheet–07/2014
The PORT also allows peripheral functions to be connected to individual I/O pins by writing a one to the corresponding
PMUXEN bit in the PINCFGy registers and by writing the chosen selection to the Peripheral Multiplexing registers
(
PMUXEN bit in the PINCFGy registers and by writing the chosen selection to the Peripheral Multiplexing registers
(
) for that pin. This will override the connection between the PORT and that I/O pin, and connect the selected
peripheral line interface to the pin instead of the PORT line interface.
Each group of up to 32 pins is controlled by a set of registers, as described in
duplicated for each group of pins, with increasing base addresses.
Figure 22-3. Overview of the Peripheral Functions Multiplexing
22.6.2 Basic Operation
22.6.2.1 Initialization
After reset, all standard-function device I/O pins are connected to the PORT with outputs tri-stated and input buffers
disabled, even if no clocks are running. Specific pins, such as the ones used for connection to a debugger, may be
configured differently, as required by their special function.
disabled, even if no clocks are running. Specific pins, such as the ones used for connection to a debugger, may be
configured differently, as required by their special function.
Each I/O pin y can be configured and accessed by reading or writing PORT registers. Because PORT registers are
grouped into sets of registers for each group of up to 32 pins, the base address of the register set for pin y is at byte
address PORT + (y/32) * 0x80. (y%32) will be used as the index within each register of that register set.
grouped into sets of registers for each group of up to 32 pins, the base address of the register set for pin y is at byte
address PORT + (y/32) * 0x80. (y%32) will be used as the index within each register of that register set.
To use pin y as an output, configure it as output by writing the (y%32) bit in the DIR register to one. To avoid disturbing
the configuration of other pins in that group, this can also be done by writing the (y%32) bit in the DIRSET register to one.
The desired output value can be set by writing the (y%32) bit to that value in register OUT.
the configuration of other pins in that group, this can also be done by writing the (y%32) bit in the DIRSET register to one.
The desired output value can be set by writing the (y%32) bit to that value in register OUT.
Similarly, writing one to a bit in Data Output Value Set (OUTSET) register will set the corresponding bit in Data Output
Value (OUT) register to one. Writing one to a bit in Data Output Value Clear (OUTCLR) register will set the corresponding
bit in Data Output Value (OUT) register to zero. Writing one to a bit in Data Output Value Toggle (OUTTGL) register will
toggle the corresponding bit in Data Output Value (OUT) register.
Value (OUT) register to one. Writing one to a bit in Data Output Value Clear (OUTCLR) register will set the corresponding
bit in Data Output Value (OUT) register to zero. Writing one to a bit in Data Output Value Toggle (OUTTGL) register will
toggle the corresponding bit in Data Output Value (OUT) register.
To use pin y as an input, configure it as input by writing the (y%32) bit in the DIR register to zero. To avoid disturbing the
configuration of other pins in that group, this can also be done by writing the (y%32) bit in DIRCLR register to one. The
desired input value can be read from the (y%32) bit in register IN as soon as the INEN bit in the Pin Configuration register
(PINCFGy) is written to one. Refer to
configuration of other pins in that group, this can also be done by writing the (y%32) bit in DIRCLR register to one. The
desired input value can be read from the (y%32) bit in register IN as soon as the INEN bit in the Pin Configuration register
(PINCFGy) is written to one. Refer to
Port x bit y PINCFG
Port x bit y
Periph Line 0
PORT x bit y
PMUXEN
Data+Config
Periph Line 1
Periph Line 15
Port x bit y
PMUX[3:0]
PMUX[3:0]
Port y PMUX Select
Port y Line Interface
Pin y
Pin y
Peripheral Line Interface
to be muxed to Pin y
to be muxed to Pin y
Port y Peripheral
Mux Enable
Mux Enable
15
1
0
0
1
Line Interface