PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Aug 08, 2009 11:52 pm |
|
|
Here is the explanation:
There is only one "interrupt on change" interrupt. It's called #INT_RA.
But, each pin (GP0-GP5) can be individually enabled for the interrupt-on-
change feature. So the interrupt routine itself will always only have
#INT_RA above it. But in your code, for the enable_interrupts() and
disable_interrupts() functions, you should use INT_RA0 to INT_RA5 as
the parameter. See the example below:
Code: |
#include <12F675.h>
#fuses INTRC_IO, NOWDT, NOMCLR, PUT, BROWNOUT
#use delay(clock=4000000)
#int_ra
void int_ra_isr(void)
{
int8 temp;
temp = input(PIN_A4); // Read pin to clear mismatch condition
}
//======================
void main()
{
// There is only one "INT_RA" interrupt. Clear it.
clear_interrupt(INT_RA);
// Enable interrupt-on-change for pin A4 only.
enable_interrupts(INT_RA4);
enable_interrupts(GLOBAL);
while(1);
} |
|
|