...to wake up on PIN change
If you want to use the Input Change Notification feature (to monitor multiple pins), then I think you want to use the CN interrupt.
In addition to setting up CNEN1/CNEN2 and CNPU1/CNPU2 to match the bits you want to use, you'll need to setup
interrupt enable reg IEC1.3 (CNIE) and monitor/clear interrupt flag status reg IFS1.3 (CNIF)
Also, make sure the intr priority setting for IPC4.CNIP<2:0> is set to match what you want to do...
If the assigned priority level of the CN interrupt is equal to, or less than, the current CPU priority
level, device execution continues from the instruction immediately following the SLEEP or IDLE
instruction.
If the assigned priority level of the CN interrupt is greater than the current CPU priority level,
device execution continues from the CN interrupt vector address.
The isr (if used) would look something like
- Code: Select all
interrupt OnInputChange(Pic.CNInterrupt)
' read pins to clear mismatch
' clear intr flag
IFS1.3 = 0
end interrupt