interrupt on portb.5 (Triggers only one way)
I want an interrupt to trigger everytime i change the switch on portb.5 (using a simple on/off switch connected to ground). My led is on porte.1
this is what happens: no matter what the initial condition of the switch is, the interrupt triggers only one way. i.e once i change the switch it sits in the interrupt handler and DOES NOT go back to the main loop untill i take it back to the original position. So if the switch is ON at power up, the interrupt triggers every time i go from ON to OFF. But if the switch is OFF at power up, the interrupt triggers when i go from OFF to ON. I want the interrupt to trigger BOTH ways. (i.e everytime the state of the switch changes.)
Isnt this what is "supposed" to happen according to the "Input change interrupt protocol" on PORTB<4:7> as per the data sheet?!?
The funny part is i have a second test circuit with the LED connected to portb.1 and this setup works perfectly (i.e interrupt both @ ON and OFF) with the exact same code (ofcourse i just change my led var to portb.1) PLS HELP! This is driving my insane. My complete code is below.
>>>>>>>>>>>>>>>>>>>>>>
DEFINE OSC 20
led var PORTe.1
OPTION_REG = $7f ' Enable PORTB pullup
On Interrupt Goto myint ' Define interrupt handler
INTCON = %10001000 ' Enable interrupt portb 4:7 change
loop: High led ' Turn LED on
Goto loop ' Do it forever
' Interrupt handler
Disable ' No interrupts past this point
myint: Low led ' If we get here, turn LED off
Pause 1000 ' Wait .5 seconds
INTCON.0 = 0 ' Clear interrupt flag
Resume ' Return to main program
Enable
>>>>>>>>>>>>>>>>>>>>>>>>>>>