11.4.9.1 Software Input Pin Control

Some of the functions assigned to an I/O pin may be input functions that do not take control of the pin output driver. An example of one such peripheral is the input capture module. If the I/O pin associated with the input capture is configured as an output, using the appropriate TRISx control bit, the user can manually affect the state of the input capture pin through its corresponding PORTx register. This behavior can be useful in some situations, especially for testing purposes, when no external signal is connected to the input pin.

The organization of the peripheral multiplexers will determine if the peripheral input pin can be manipulated in software using the PORTx register.

In general, the following peripherals allow their input pins to be controlled manually through the PORTx registers:

  • External Interrupt Pins
  • Timer Clock Input Pins
  • Input Capture Pins
  • PWM Fault Pins

Most serial communication peripherals, when enabled, take control of the I/O pin so that the input pins associated with the peripheral cannot be affected through the corresponding PORTx registers. Example peripherals include the following:

  • SPI
  • I2C
  • DCI
  • UART
  • CAN FD
  • QEI