Thanks Darrel. IOC is definitely more complicated than the RBC interrupt but it's always good to learn new things 
This is the config I have so far:
Code:
ANSELA = %00000000 ' Digital only (PortA)
ANSELC = %00000000 ' Digital only (PortC)
TRISA = %00000011 ' Make PortA pins 0-1 input for rotary encoder
TRISC = %00000000 ' Make all pins on PortC output
INTCON.3 = 1 ' Enable interrupt-on-change (IOCIE)
IOCAP.0 = 1
IOCAP.1 = 1
IOCAN.0 = 1
IOCAN.1 = 1
IOCAF.0 = 0
IOCAF.1 = 0
Are you saying that for my PBP interrupt routine I can change the code to look at IOCAF.0 and IOCAF.1 values instead of the NewBits/OldBits? The values on A/B from the rotary encoder (incremental quadrature) are:
CW
00
10
11
01
CCW
00
01
11
10
I think I still need to track the old values on A/B pins (RA1 & RA0 in my application) and do something like this pseudo code:
If A caused the interrupt then
Compare A & B
If different then
CW rotation
Else
CCW rotation
End If
End If
If B caused the interrupt then
Compare A & B
If same then
CW rotation
Else
CCW rotation
End If
End If
Does that make sense?
Bookmarks