IOCB.7=1 is correct (you are enabling that pin for interupt on change interrupts)
You will also need to enable Weak pullups...
OPTION_REG.7 = 0
WPUB.7 = 1 '
I normally use a variable mapped to the associated interrupt bit like this...
IOC_FLAG VAR INTCON.0 ' Alias RABIF interrupt flag bit
...then it's easier to track clearing it, for example...
IOC_FLAG = 0 ' Clear the int-on-change flag bit
(the flag needs to be cleared before you enable with @ INT_ENABLE RABC_INT )
also it's a good idea to put a wend in at the beginning of your program to ensure things have settled. So pulling the sequence together would look something like this
Code:ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler RABC_INT, _Switch_Interrupt, PBP, YES end INT_CREATE ; Creates the interrupt processor ENDASM ' IOC_FLAG = 0 ' Clear the int-on-change flag bit ' WHILE SW1 = 0 : WEND ' Wait until all sw has settled and is at logic 1 before proceeding ' @ INT_ENABLE RABC_INT ; Now things have settled,eEnable 'Int On Change' interrupts
If it's still not working, get a DVM onto RB7 and make sure it's sitting at supply voltage. RB7 is also the EUSART TX pin, so if you're using anything with serial output, that could cause you grief, from recollection, it can be disabled something like this...
RCSTA.7 = 0
It sounds like your LED1 is actually toggling fine...it's just that it's toggling at one helluva lick (hence dim)....better to put a pause in your interrupt routine to give it a breather between on & off...
Hope that helps a little.Code:'---[INT - interrupt handler]--------------------------------------------------- ToggleLED1: TOGGLE LED0 pause 250 @ INT_RETURN
Bookmarks