Glad there's some progress on this issue. Thanks all.
I have an odd probelm: Keyboard interrupts.
If I enable edge only, I never see one. If I use edge & level, all is fine. I see from the logic diagram that level interrupts skip the flip-flop. It's acting as if the FF reset is stuck.
Either edge or level interrupts work for this application, but I'm just bugged by this.
Code:
extern SWITCHES Switches;
void KBIInterruptInit(void) // switches 1-4
{
KBISC_KBMOD = 0; // edges. Change to =1 and it works
KBIES = 0; // falling edge
KBIPE = 0xc3; // We are using KBIP 0, 1, 6, & 7
KBISC_KBACK = 1;
KBISC_KBIE = 1;
key_interrupt_timer = 0;
}
void interrupt KBI_interrupt(void)
{
KBISC_KBIE = 0; // disable interrupts, will be re-enabled by the timer.
KBISC_KBACK = 1;
if(!SW1)
Switches.Bits.SW_1 = 1;
if(!SW2)
Switches.Bits.SW_2 = 1;
if(!SW3)
Switches.Bits.SW_3 = 1;
if(!SW4)
Switches.Bits.SW_4 = 1;
key_interrupt_timer = 100; // 100 ms before we recognize another keypress
}