I think what you want here is RABC_INT. So:
Code:
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RABC_INT, _Switch_Interupt, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
@ INT_ENABLE RABC_INT ; Enable 'Int On Change' interrupts
Note: Your schematic is wrong with pins 11 & 12 shown as RB2 & RB3. These should be RB6 & RB5 respectively. So;
Code:
Switch_Interupt:
if portB.4 = 0 then mode = 1
if portB.5 = 0 then mode = 2
Should be;
Code:
Switch_Interupt:
if portB.6 = 0 then mode = 1
if portB.5 = 0 then mode = 2
if porta.2 = 0 then ? whatever ' this is the interrupt pin on RA.2
Or, of course, you can use RA.1 as shown in your schematic for this interrupt pin. Either will work the same since they both have IOC (interrupt-on-change) functionality, and internal pull-ups.
Note I have not used DT_INTs on this PIC type with interrupt-on-change, but that should get you going. I'm sure Darell will jump in here, and correct me if I'm wrong, but I think that's what you're looking for.
But, I HAVE used his DT_INTs for our 4-digit & 6-digit serial LED displays, and I most certainly can vouch for them working spot-on, and making life a lot easier for us mere mortals...
I've also used DT_INTs in several commercial applications, and had ZERO problems - so a huge thanks to DT for all the hard work, and sharing his routines with us.
Bookmarks