GPIO Reading pin state

Software can read the state of all GPIO pins except those selected for an analog function in the switch matrix logic. A pin does not have to be selected for GPIO in the switch matrix in order to read its state. There are several ways to read the pin state:

  • The state of a single pin can be read with 7 high-order zeros from a Byte Pin register.
  • The state of a single pin can be read in all bits of a byte, halfword, or word from a Word Pin register.
  • The state of multiple pins in a port can be read as a byte, halfword, or word from a PORT register.
  • The state of a selected subset of the pins in a port can be read from a Masked Port (MPORT) register. Pins having a 1 in the port’s Mask register will read as 0 from its MPORT register.

-->