Using TMR4 in One-Shot Mode with External Signal as Reset

This example will present how to use the TMR4 peripheral in One-Shot mode to stop TMR2 if an external pin is pulled to GND for more than the desired period.

The application will blink the LED0 with a rate of Timer2 Period (100 ms) and, if the external pin RC7 is pulled down for more than the Timer4 Period (500 ms), the LED0 will stop blinking.

To achieve the functionality described by this use case, the following actions will have to be performed: