GPIO Recommended practices

The following lists some recommended uses for using the GPIO port registers:

  • For initial setup after Reset or re-initialization, write the PORT registers.
  • To change the state of one pin, write a Byte Pin or Word Pin register.
  • To change the state of multiple pins at a time, write the SET and/or CLR registers.
  • To change the state of multiple pins in a tightly controlled environment like a software state machine, consider using the NOT register. This can require less write operations than SET and CLR.
  • To read the state of one pin, read a Byte Pin or Word Pin register.
  • To make a decision based on multiple pins, read and mask a PORT register.

-->