Quote:
|
Originally Posted by GW (Greg) Ross
Exactly. Try printing the on/off messages only when the pin state changes.
|
Alright, I did that, and I am pretty sure that was the lag I was experiencing, so now I can poll the input and if it is different from the last input I print something to the screen.
Now I'm trying to do it with interrupts, and I have the code in the ISR as so:
Code:
else if (INTCONbits.RBIF && INTCONbits.RBIE){ /* Ints 3-6 (RB4, RB5, RB6, or RB7) changed. */
int_byte = PORTB; /* You must read or write to PORTB */
INTCONbits.RBIF = 0; /* and clear the interrupt flag */
if(accel_x){
printf("High!n");
}
else if (accel_x ==0){
printf("LOW!n");
}
}
But I never get any output from the program, telling me that the interrupt is never... interrupting. Right?
[EDIT]-Stupid mistake... I never enabled interrupts by setting bit : INTCONbits.RBIE :-p