GPIO

  • Each Port Has

    • Data Direction (DIR)
      • 1 for OUT, 0 for IN
    • Data Output (OUT)
    • Data Input (IN)
  • The following Port registers are available

    • DIR – Data Direction register
      • If a one is written to DIRn, pin n is configured as an output pin – If a zero is written to DIRn, pin n is configured as an input pin
    • DIRSET – Data Direction Set Register
      • Writing a one to a bit will set the corresponding bit in DIR – Reading will return the value of the DIR register
    • DIRCLR – Data Direction Clear Register
      • Writing a one to a bit will clear the corresponding bit in DIR – Reading will return the value of the DIR register
    • DIRTGL – Data Direction Toggle register
      • Writing a one to a bit will toggle the corresponding bit in DIR – Reading will return the value of the DIR register
    • OUT – Data Output Value
      • Sets the data output value for the individual pins of the port – If a one is written to OUTn, pin n is driven high
      • If a zero is written to OUTn, pin n is driven low
      • For this to have any effect, the pin direction must be output
    • OUTSET – Data Output Value Set register
      • If a one is written to bit n, OUTn is set; writing a 0 has no affect – Reading this register will return the value in the OUT register
    • OUTCLR – Data Output Value Clear register
      • If a one is written to bit n, OUTn is cleared Writing a zero has no affect
      • Reading this register will return the value in the OUT register
    • OUTTGL – Data Output Value Toggle register
      • If a one is written to bit n, OUTn will toggle; writing a zero has no affect
      • Reading this register will return the value in the OUT register
    • IN – Data Input Value register
      • INn shows the value of pin n
      • The input is not sampled and cannot be read if the digital input buffers are disabled