#pragma code low_vector=0x18 //setup the ISR vector
void low_interrupt (){
_asm GOTO LowISR _endasm //jump to interrupt handler
}
#pragma code
#pragma interruptlow LowISR
void LowISR()
{
if (INTCONbits.TMR0IF == 1)
{
INTCONbits.TMR0IF=0; // Put breakpoint here and monitor the time interval using stopwatch (in MPLAB SIM).
}
}
void main()
{
// Counting from 6 to 255 should give 250 counts
// Prescaler = 1:8
// 250 * 8 * 500ns = 1ms
TMR0L = 6;
T0CON = 0b11000010;
INTCONbits.GIE = 1;
INTCONbits.PEIE = 1;
INTCONbits.TMR0IE = 1;
while(1);
}