I've been trying, but I guess I don't know what to look for. I feel like the code I'm writing should work. Would you take a look and tell me why it doesn't?
This program is simple...wait for the button press, then turn on all of PORTC.
#include /* for the special function register declarations
*/ #include /* for the RB0/INT0 interrupt */
#pragma config OSC = HS #pragma config WDT = OFF #pragma config LVP = OFF #pragma config DEBUG = ON
void toggle_light (void);
#pragma code HIGH_INTERRUPT_VECTOR = 0x8 void high_ISR(void) { _asm goto toggle_light _endasm } #pragma code
#pragma interrupt toggle_light void toggle_light (void) { TRISC=0; PORTC=255; }
void EnableHighInterrupts (void) { RCONbits.IPEN = 1; /* enable interrupt priority levels */ INTCONbits.GIEH = 1; /* enable all high priority interrupts */ }
void main(void){ EnableHighInterrupts(); OpenRB0INT (PORTB_CHANGE_INT_ON & /* enable the RB0/INT0 interrupt */ PORTB_PULLUPS_ON & /* configure the RB0 pin for input
*/ FALLING_EDGE_INT); /
* trigger interrupt upon S3 button depression */ CCP1CON = 0x0F; while(1); }