We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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!
I have read the user's manual and P1^3 can only be input or open drain. ... I am supposed to be seeing a high on P1^3 (INT0) and just don't get that... How, just how, can an input or an open drain be expected to go high unless an external signal drive them there? Erik
Erik are you referring to a pull up resistor or the signal that will triggered the interrupt? Also, this pin (INT0) has to be an input and according to the user's manual the open drain configuration recommends an external pull up resistor tied to Vdd, but not for the input configuration. Thanks
Ok, now read this(if you need do it multiple times) To generate an interrupt you must have something driving the interrupt pin on the 932. Whether that pin is high or low does NOT depend on anything in the 932, it depends on the output of the device driving the pin. Erik
Erik, can you please be more specific, because I do know which way to go. I need the pin to receive pulses every 1/10 of a second. this may be endless pulses. The way I have it now is with a resistor 10K connected to the pin from one end and to Vdd from the other end. I checked the pin and it has 3.3 volts on it. But it still does not accept the pulses. I checked with an oscilloscope, and the pulses and they are going in to the pin. What is left to do? Thank you
I checked with an oscilloscope, and the pulses and they are going in to the pin. That proves that your hardware works, now forget about it and fix the software. 1) load blinky to verify your download works, if not fix it. 2) verify that you do not do anything to the watchdog, if you do, remove it. 3) bring your code to an absolute minimum for the problewm you describe and look it over, and if you can not find the software problem show your complete code ISR, main and your complete initialization. Erik
Erik, I usually do steps 1, 2, and 3, but the only problem is a software one. the function Min_Power is called after doing some memory reading and writing. the ISR are not shown here, but they are well developed. void init(void) { P0M1 = 0x00; P0M2 = 0x00; // Quasi-bidirectional P1M1 = 0x00; // Push-pull P1M2 = 0xFF; P2M1 = 0x00; // push pull output P2M2 = 0xFF; P1M1 |= 0x18; // P1^3 and P1^4 as inputs only P1M2 &= 0xE7; ES = 1; // enable UART interrupt EA = 1; } void brkrst_init(void) // This function allows ISP entry through the UART break detect { //AUXR1 |= 0x40; // enable reset on break detect, pg. 102 SCON = 0x50; // select the BRG as UART baud rate source, pg. 60 SSTAT = 0x00; //Timer1 BRGR0 = 0xF0; // 9600 BAUD at @ 7.373MHz internal RC oscillator BRGR1 = 0x02; BRGCON = 0x03; // enable BRG, pg. 59 } void Min_Power(void) { while(1) { IT0 = 1; //pulses will be edge triggered EX0 = 1; IT1 = 1; //pulses will be edge triggered EX1 = 1; EA = 1; PCON |= 0x12; // switch to Power Down mode }
does it work if you do not switch to powersave? Erik
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
see above
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