Don P
Joined: 26 Aug 2004 Posts: 23 Location: California
|
Clearing B0 external interrupt ? |
Posted: Tue Jan 25, 2005 10:14 am |
|
|
I have a project with 2 hardware buttons, on the B0 & A5 inputs. I use the B0 interrupt to quickly grab a button press in most of the program.
In another situation I use the A5 button to call another procedure. In that one, I immediately disable the B0 interrupt. The user then uses the B0 button to return to the main loop. I watch for the B0 (return) button to be released, and even put in a 2 second delay to eliminate any contact bounce. Then I re-enable the B0 interrupt, and return to the main loop.
The problem is that the program immediately performs the B0 interrupt routine. I confirm this by having an LED-blink performed just inside the interrupt code. I acts as if the B0 button press is stored and then used when the B0 interrupt is enabled.
The 16F628 manual refers to the Intcon Register bit 1 as being the B0 Int flag, and notes that it must be cleared in software. I don't see anything in the CCS book that seems to do this. Any ideas on what I'm doing wrong? Is it that interrupt clearing. What command does this?
Regards,
Don |
|