To activate a single I/O pin as IOC (Interrupt on Change) you use the "IOC" Register; Register 3.4 in the Data Sheet:
If you want to enable IOC interrupts on multiple GPIO pins you can use the IOC Register in binary mode. Assume you want an IOC Interrupt on GPIO pins 0 & 1:Code:IOC.0 = 1 'Enables IOC on GPIO 0
Then you must enable IOC interrupts using the INTCON Register:Code:IOC = 000011 'Enables IOC on GPIO 0 & 1
Next, you need to create an Interrupt Handler (See PBP Manual) so when you get the Interrupt, you can do something with it. In your Interrupt Handler, when you get an IOC interrupt you have to clear the Interrupt Flag:Code:INTCON.3 = 1 'Enables IOC Interrupts
If you need more than one GPIO IOC Interrupt (2 or more Port Pins), you will have to Poll which GPIO triggered the IOC Interrupt:Code:INTCON.0 = 0 'Clears IOC Interrupt Flag
The above code assumes that a low-to-high transition triggers your IOC interrupt. You may need to change that depending on your goals.Code:IF GPIO.0 = 1 THEN <Interrupt Handler Code for GPIO.0> ELSE IF GPIO.1 = 1 THEN <Interrupt Handler Code for GPIO.1> ENDIF
<edit> I tried to write "IOC = 000011 'Enables IOC on GPIO 0 & 1" but the forum keeps changing it to "IOC = 000011 'Enables IOC on GPIO 0 & 1"




Bookmarks