#include #include #include void example_timer_isr ( void ); #pragma code low_vector=0x18 void low_interrupt ( void ) { _asm GOTO example_timer_isr _endasm } #pragma code #pragma interruptlow example_timer_isr void example_timer_isr ( void ) { INTCONbits.TMR0IF = 0; ++PORTB; } void main( void ) { // Configure PORTB TRISB = 0; PORTB = 0; // Disable analog components ADCON1 = 0x0F; CMCON = 0x07; // Setup and start timer OpenTimer0( T0_16BIT & TIMER_INT_ON & T0_SOURCE_INT & T0_PS_1_16 ); // Enable interrupts INTCONbits.GIE = 1; // Do nothing ... the port state will be changed from the ISR while ( 1 ); }