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

Input to "disabled" INT1 halts execution

87C51RA+
Trying to use P3.3/INT1 as an input.

I set EX1 = 0; at the beginning of main(), which should disable INT1. EX1 is not referenced again, and remains =0.

Whenever I pull the P3.3/INT1 pin low, the program slows down to a crawl . . . when I let the pin go high, the program picks back up to normal speed.

Here is one place that I am seeing it happen:

while (sec < MSEC_100 * 2) {
kick_dog();
}

void kick_dog()
{
EA = 0;
CCAP4L = 0X00;
CCAP4H = CH;
EA = 1;
}

As you can see, global enable is used to toggle interrupts on and off. My impression is that the EX1=0; instruction should keep the INT1 disabled whether the EA global bit is subsequently toggled or not, but all that I can figure is that the interrupt IS active and causing the slowdown.

EX1 and EA are defined in #include <reg51f.h>

What am I missing here?

Thanks,
Scott Kelley

Parents
  • Thanks for the help - everything kept coming up negative.

    Finally found it. Nothing to do with the interrupt. The port bit was assigned to two separate variables, and the second was being used in the clock initialization. So the clock was running in the wrong mode when this port pin was held low.

    Thanks for the help.

Reply
  • Thanks for the help - everything kept coming up negative.

    Finally found it. Nothing to do with the interrupt. The port bit was assigned to two separate variables, and the second was being used in the clock initialization. So the clock was running in the wrong mode when this port pin was held low.

    Thanks for the help.

Children
No data