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

Hi, I need to use the external interrupts of the LPC932. The micro will be in sleeping mode and will be woke up only by these two events. It works fine the first time, but then it does not work any more for external interrupt 0. Why? Could it be my Port configuration on port 1, which is where these two interrupts are entered. These two pins have to be input only.


IT0 = 1; //pulses will be edge triggered
EX0 = 1;
IT1 = 1; //pulses will be edge triggered
EX1 = 1;
EA = 1;
//EBO = 1; //Brown Out interrupt (IEN0.5)
PCONA = 0xEF; // turn off all peripherals that can be turned off
PCON |= 0x12; // switch to Power Down mode
while(1);

Thank you!

Parents Reply Children
  • Erik, I have a placed a pull up resistor (5K) on the input pin on interrupt 0. (P1^4). I have removed the Power save intruction of the program, but it still does not work. The pulses are at the port. I checked that with an oscilloscope, but it does not see the interrupts.
    Can you help me?
    Thank you

    while(1)
    {
    IT0 = 1; //pulses will be edge triggered
    EX0 = 1;
    EA = 1;
    // PCON |= 0x12; // switch to Power Down mode, valve is closed
    }

  • Erik it works fine if I do not switch to Power save. Why is this I thought it would wake up by either interrupt 0 or 1.
    This is the code I have tried.

    {
    IT0 = 1; //pulses will be edge triggered
    EX0 = 1;
    IT1 = 1;
    EX1 = 1;
    EA = 1;
    PCON |= 0x12; // switch to Power Down mode, valve is closed
    while(1);
    }

    AND

    while(1)
    {
    IT0 = 1; //pulses will be edge triggered
    EX0 = 1;
    IT1 = 1;
    EX1 = 1;
    EA = 1;
    PCON |= 0x12; // switch to Power Down mode, valve is closed
    }

  • whatever you do you will stay in the while(1) after wakeup. what good is that going to do?

    Erik

  • Erik how can I write this code so that it goes into Power Down Mode and when an interupt INT1, INTO is generated it wakes up executes the ISR and goes back to P.D. mode. This is happening probably every 1/10 of a second.
    Thank you

  • Erik I followed the direction from the previous comments. But it does not work if I switch to Power Down Mode. However, it worked on the simulator but not in the application.
    Why?

  • it worked on the simulator but not in the application
    because the simulator simulates.

    an interupt INT1, INTO is generated it wakes up executes the ISR and goes back to P.D. mode.
    You need to get the power down out of the ISR. Power down in main and let the ISR wake the uC up.

    Erik

  • Erik this is what I have

    main() proc.
    {
    ...
    ...
    IT0 = 1;
    EX0 = 1;
    EA =1;
    ...
    ...
    }

    Power_Down() proc.
    {
    while(1)
    {
    PCON = 0x12; // switch to PDM
    }
    }

    ISR for INT0()
    {
    PCON = 0x10; //Normal mode
    ....
    ...
    ...
    }
    It works with the emulator, but not with out it.
    Why.

  • It works with the emulator, but not with out it.
    1) first it was simulator, now it is emulator, what is it? ICE/Keil simul/fried apples?
    2) how do you know it does not work in real mode?

    Erik

  • Erik I tested on both the simulator and emulator and the interrupt was detected when it occurred. It was executed and goes back to PDM. In real it is not doing it, because the pulses are not being counted. I know this because after a certain amount of pulses something is supposed to happen (about 7 seconds) and it does not happen at all. That is why I know it is not working. Makes sense to you?

  • Makes sense to you?
    not at all. You keep feeding me tidbits such as
    I know this because after a certain amount of pulses something is supposed to happen

    reduce your code to the VERY MINIMUM you need for this e.g. alternate a LED in the main, then go to sleep, wake up in isrEX0. Try it ICE and real, if it does not work post IT ALL.

    Erik

  • Erik I went back to read the user's manual and this is what I found.

    "In power down mode the power supply voltage may be reduced to the RAM keep-alive voltage VRAM. This retains the RAM contents at the point where PDM was entered. SFR contents are not guaranteed to after VDD has been lowered to VRAM."
    I think maybe since the contents of some registers are lost after entering PDM, the "pulse counter" is never counting because it is always losing its contents...don't you think? So the micro wakes up, but never accumulates the pulses, therefore not working properly.
    I may be wrong though.

  • I think maybe since the contents of some registers are lost after entering PDM, the "pulse counter" is never counting because it is always losing its contents...don't you think?
    how would I know, you never showed it.

    I have been communicating under the impression that you showed "the whole truth and nothing but the truth". It is annoying to get information in the 25th post, or whatever the number is, that might have cleared the problem in post 3.

    Erik

  • "the contents of some registers are lost after entering PDM"

    That's not what the manual says, is it?

    The manual says, as you've just quoted, that it's lowering VDD to VRAM that causes the SFR contents to become undefined - not going into powerdown per se.

    So, the question is: are you lowering VDD to VRAM?
    Or are you going to keep us guessing on that one for another dozen posts?

  • What do you suggest Erik. Because I do not know why it does not work?