#include <xc.h>
#include <sys/attribs.h>

void __ISR_AT_VECTOR (_TIMER_2_VECTOR, IPL4SRS) T2Interrupt(void)
{
    // Toggle LED LD1
    LATGINV = _LATG_LATG6_MASK;

    // Reset interrupt flag
    IFS0bits.T2IF = 0;
}

int main(void)
{
    // Initialization
    T2CONbits.TON = 0;                /* turn off Timer 2 */
    T2CONbits.TCKPS = 7;                /* pre-scale = 1:256 (T2CLKIN = 31250 Hz) */
    PR2 = 3125;                    /* T2 period = 100mS */
    TMR2 = 0;                        /* clear Timer 2 counter */

    PRISS = 0x76543210;                /* assign shadow set #7-#1 to priority level #7-#1 ISRs */

    while(1);                        /* main application loop */

}