18.3.2.4 Multi-Pin Configuration
The multi-pin configuration function is used to configure multiple port pins in one
operation. The wanted pin configuration is first written to the
PORTx.PINCONFIG register, followed by a register write with the selected
pins to modify. This allows changing the configuration (PORTx.PINnCTRL) for
up to eight pins in one write.
Tip: The PORTx.PINCONFIG
register is mirrored on all ports, which allows the use of a single
setting across multiple ports. The PORTx.PINCTRLUPD/SET/CLR
registers are not mirrored and need to be applied to each
port.
For the multi-pin configuration, port pins can be configured and
modified by writing to the following registers.
Register | Description |
---|---|
PORTx.PINCONFIG | PINnCTRL (ISC, PULLUPEN, INLVL and INVEN) setting to load simultaneously to multiple PINnCTRL registers |
PORTx.PINCTRLUPD | Writing a ‘1 ’
to bit n in the PINCTRLUPD register will copy the
PINCONFIG register content to the PINnCTRL
register |
PORTx.PINCTRLSET(1) | Writing a ‘1 ’
to bit n in the PINCTRLSET register will set the
individual bits in the PINnCTRL register,
according to the bits set to ‘1 ’
in the PINCONFIG register |
PORTx.PINCTRLCLR(2) | Writing a ‘1 ’
to bit n in the PINCTRLCLRn register will clear
the individual bits in the PINnCTRL register,
according to the bits set to ‘1 ’
in the PINCONFIG register |
Note:
- Using PINCTRLSET to configure ISC bit fields that are non-zero will result in a bitwise OR with the PINCONFIG and PINnCTRL registers. This may give an unexpected setting.
- Using PINCTRLCLR to configure ISC bit fields that are non-zero will result in a bitwise inverse AND with the PINCONFIG and PINnCTRL registers. This may give an unexpected setting.