Digital I/O
Almost every pin on the Enhance Mid-Range PIC MCU can be used as a digital input or output pin. Digital Pins share these attributes:
- Monitor Digital Inputs
- Control Digital Devices
- Internal Weak Pull-ups
- Multiplexed with Peripherals
- High Drive Capability (up to 25 mA sink/source on many I/O pins)
- Direct single cycle bit manipulation
- 4 kV ESD protection diodes
At Reset:
- Digital Pins revert to input (Hi-Z)
- Analog Capable pins revert to analog
Typical Digital Pin Structure
Five registers control the operation of a digital pin. These 8-bit registers control 8 pins of a PORT. Using the registers TRISX, PORTx, LATx, WPUx, and ANSEL the program can:
- Configure a pin as an input or output TRISx
- Read an input pin (or all 8 PORT pins) PORTx
- Output a 1 or 0 to a pin LATx
- Enable or disable the internal Pull Up Resistor WPUx
- Determine if analog capable pins operate in analog or digital Mode ANSEL

Multiplexed Pins
In addition to being configured as digital I/Os, pins on enhanced mid-range PIC MCUs can have several possible functions. The pin diagram on the datasheet shows the options for each pin. At start-up, the program has the option of configuring the pins.
