This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Interrupt Enable

Hello,

here's a question about the interrupt handling of a Siemens 80C165:
I use the external interrupt 5, which works like it should. Sometimes,
I want to disable that interrupt, so that the controller doesn't recognize
an incoming interrupt. Therefore, I have a function to enable/disable
that interrupt:

void ExtInt5 (bit en)
{
if (en)
{
EXI5ESH = 1;
EXI5ESL = 0;
CC13IE = 1;
CC13IC |= 0x04;
}
else
{
CC13IE = 0;
}
}

Calling that function with en=1 enables the interrupt input (CC13IE = 1)
and I get the immediate response if there's an interrupt condition.
If I disable the interrupt (CC13IE = 0), the system doesn't respond on
an interrupt condition anymore... like it should be, but:
As soon as I enable the interrupt again, the controller jumps into the
Interrupt service routine, if there was an interrupt condition while it was
disabled.
Why does it even recognize the interrupt if CC13IE = 0?
It seems that this register only prevents the controller from jumping
to the interrupt service routine, but doesn't disable the interrupt at all.
And how would I really disable the interrupt?
Thanks for any help!
Holger

  • When you mask the interrupt, and that's what you are doing - not disabling it, you must be sure to clear the interrupt pending bit for that piece of hardware.

    For example, on the 8051, if you mask the UART interrupt and do some processing while a char is received by hardware (which it will be if one is sent and the receiver enable (REN) is set) the receive interrupt bit (RI) will be set, essentially queueing the interrupt. As soon as you unmask the UART interrupt you will vector to the UART ISR. If you don't want to vector, in this case, you'd clear RI before unmasking the UART interrupt.

    - Mark