Hello everyone,
I am experiencing a problem with the KBI interrupt on an AW60 microcontroller.
The interrupt is enabled on the falling edge of KBIP0 (PTG0) by an init routine.
On the occurrance of the interrupt a pin toggle is executed.
Here are the routines:
void KBIInit(void)
{
KBI1PE = 0b00000001; /* interrupt on KBI0 */
KBI1SC = 0b00000100; /* KBEDGE7..4 --> 0 (don't care) */
/* KBF --> 0 (read only) */
/* KBACK --> 1 (reset KBF) */
/* KBIE --> 0 (interrupt disabled) */
/* KBIMOD --> 0 (only edge detection) */
KBI1SC = 0b00000110; /* KBI interrupt enable */
return;
}
#pragma TRAP_PROC
void KbiIntHandler (void)
{
if (KBI1SC_KBF)
{
OUPUT = !OUPUT; //pin toggle
KBI1SC_KBACK = 1; /* ACK to reset interrupt flag */
}
return;
}
The input signal on the KBI pin is a square ware with frequency approx 50Hz.
I would expect to see a 50 Hz pin toggle on the output pin.
What happenes is that some times (quite often) as soon as the interrupt procedure is exited it is entered again so I see a pin toggle 10 usec after the previous one.
Thank you,
John