#include <p18f4610.h>
#include<stdio.h>
#include<delays.h>
#include<timers.h>
#pragma config WDT=OFF , OSC=HS , PWRT = ON, LVP=OFF
int count=0;
void interrupt_at_high_vector(void);
void high_isr(void);
#pragma code high_vector=0x08
void interrupt_at_high_vector(void)
{
_asm GOTO high_isr _endasm
}
#pragma code /* return to the default code section */
#pragma interrupt high_isr
void high_isr(void)
{
if(PIR1bits.TMR2IF==1)
{
count=count++;
PORTAbits.RA0=1;
}
PIR1bits.TMR2IF=0;
}
void main (void)
{
//T2CON=0x7F;
TRISA = 0;
CMCON = 7;
ADCON1 = 7;
T2CONbits.T2OUTPS0=0;
T2CONbits.T2OUTPS1=0;
T2CONbits.T2OUTPS2=0;
T2CONbits.T2OUTPS3=0;
T2CONbits.TMR2ON=1; // turn on the timer2
T2CONbits.T2CKPS0=1;
T2CONbits.T2CKPS0=1;
PR2= 100;
PIE1bits.TMR2IE=1; //Enable TIMER2 Interrupt
INTCONbits.PEIE=1; //Enable Peripheral Interrupt
INTCONbits.GIE=1; //Enable INTs globally
while(1);
}