|
Hi Odesus,
The PICU Interrupt can be set to Rising edge, Falling edge or on Both edge.
The project attached by David is configured for interrupt on Falling edge. The LED toggles on the Falling edge. Interrupt is not generated on the rising edge.
As mentioned by David, the Switch Debounce might result in the input pin going high > low > high instead of going high directly (The resistive pull up is enabled, hence the pin is pulled up by default).
This will inevitably result in the PICU interrupt getting triggered because of a high > low transition (falling edge).
In order to overcome the ambiguity introduced by the switch debounce, I tested the project by giving a square wave at the Pin input. The output pin was supposed to toggle on falling edge of the input signal.
The oscilloscope snap-shot is attached below:

Yellow waveform = Input signal to PICU
Blue waveform = Output pin toggle.
It can be seen that the output pin toggles only on the falling edge of the PICU input pin.
|