Microchip® Advanced Software Framework

Example

Add this to the main loop or a setup function:

  1. Initialize a pin to trigger an interrupt. Here, we initialize PC03 as an input pin with pull up and glitch filter and to generate an interrupt on a falling edge.
  2. Set a callback for the pin interrupt.
    printf("Set pin callback failure!\r\n");
    while (1) {
    }
    }
  3. Enable pin interrupt.

Interrupt Usage

When an interrupt happens on a pin, it will execute your callback function.

static void pb0_callback(void)
{
/* Handle pin interrupt here e.g. toggle an LED */
}