while(1)
{
for(ucb=0;ucb<100;ucb++) // Just some led displaying stuff
{
uca +=1; uca &=0x01F;
BrtData[0]=uca;
Delay10KTCYx(10 );
}
INTCONbits.GIE=0; // Should be off just wake from sleep
LATB=0x00; // Turn off Leds
LATA|=0x0F; // common Anodes off
Delay10KTCYx(250 ); // Just to check
TRISB = 0x01; // Bit 0 input for INT0
INTCONbits.INT0IF = 0; // Must be off prior to enable INT0
INTCON2bits.INTEDG0=1; // Enable Rising edge
INTCONbits.INT0IE=1; // Enable INT0 interrupt
Sleep();
Nop();
TRISB=0; // Back to normal
INTCONbits.INT0IE=0; // Disable INT0 interrupt
INTCONbits.GIE=1; // Back on
}