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

P89LPC932 External Interrupt 0

Hi, I need to use the external interrupt 0
on the P89LPC932. I know I need to set up the register
TCON = 0x01 for falling edge detection
and then set the P1.3 as an input. and the ISR is number 0. But this interrupt pin active low. This means that a low input like ground will generate the interrupt, even if the micro is sleeping. I tried it this way and it did not work. Do you see anything wrong or missing here? thank you

Parents Reply Children
  • Why do I need an EA if I already set the
    external interrupt in this function.
    Also, I put a for ever loop in this same function.

    //Initialize INT0 as edge triggered
    void Pulses_received(void)
    {
    IT0 = 1; //pulses will be edge triggered
    EX0 = 1;
    }

    //Initialize INT0 as edge triggered
    void Pulses_received(void)
    {
    IT0 = 1; //pulses will be edge triggered
    EX0 = 1;
    while(1);
    }
    please make comments. about the loop and the
    EA.
    Thank you.

  • "Why do I need an EA if I already set the
    external interrupt in this function."

    EA is the global interrupt enable bit. If you don't set this, you won't get any interrupts. You really, really need to read the manual. You may even need to read it several times.

    void Pulses_received(void)
    {
    IT0 = 1; //pulses will be edge triggered
    EX0 = 1;
    while(1);
    }

    If you do this, the function will not return to your main program. Your ISR will continue to respond to interrupts. Is this what you want? If you are trying to go into power down mode you need to set the appropriate bit in PCON.

    Again, you *need* to read the manual.

    Stefan

  • You really, really need to read the manual. You may even need to read it several times.

    This thread went this long because of the above

    Erik

  • Stefan, thank you very much for your help. I am not an expert in programming. I have read the manual, in fact I have printed it out.
    Thank you

  • Erik, thank you very much for your help. I am not an expert in programming. I have read the manual, in fact I have printed it out.
    Thank you