i made 1 code for timer interrupt but it is not working
#include <p18f97j60.h>
//----------------------------------------------------------------------------
void InterruptHandlerHigh (void);
union
{
struct
{
unsigned Timeout:1; //flag to indicate a TMR0 timeout
unsigned None:7;
} Bit;
unsigned char Byte;
} Flags;
//----------------------------------------------------------------------------
// Main routine
void main (void)
{
Flags.Byte = 0;
INTCON = 0x20; //disable global and enable TMR0 interrupt
INTCON2 = 0x84; //TMR0 high priority
RCONbits.IPEN = 1; //enable priority levels
TMR0H = 0; //clear timer
TMR0L = 0; //clear timer
T0CON = 0x82; //set up timer0 - prescaler 1:8
INTCONbits.GIEH = 1; //enable interrupts
TRISJbits.TRISJ1 = 0;
LATJbits.LATJ1=0;
while (1)
{
if (Flags.Bit.Timeout == 1)
{ //timeout?
Flags.Bit.Timeout = 0; //clear timeout indicor
LATBbits.LATB7 = LATBbits.LATB0; //copy LED state from RA0 to RA7
}
}
}
//----------------------------------------------------------------------------
// High priority interrupt vector
#pragma code InterruptVectorHigh = 0x08
void InterruptVectorHigh (void)
{
_asm
goto InterruptHandlerHigh //jump to interrupt routine
_endasm
}
//----------------------------------------------------------------------------
// High priority interrupt routine
#pragma code
#pragma interrupt InterruptHandlerHigh
void InterruptHandlerHigh ()
{
if (INTCONbits.TMR0IF)
{
//check for TMR0 overflow
INTCONbits.TMR0IF = 0; //clear interrupt flag
Flags.Bit.Timeout = 1; //indicate timeout
LATBbits.LATB0 = ~LATBbits.LATB0; //toggle LED on RB0
}
}
please help me,