Academic Program

Hardware Design

Hardware Design

Input output circuit

There are five registers controlling the operation of a digital pin. They control the eight pins of a specific PORT.

  • TRIS register configures a pin as an input or output
  • PORT register reads the input value of a digital pin
  • The LAT register latches the outputs values for a digital pin
  • WPU register enables the internal weak pull-up
  • ANSEL register determines if an analog capable pin works as an analog input or digital I/O

All of the register setup for the Digital I/O pins is handled by the Pin Module in MPLAB Code Configurator (MCC). Through a set of GUI style selections, MCC will generate the necessary .h and .c files for the XC8 Compiler that properly setup these registers and will even generate macros to read and control the digital input and output pins.

Pin manager