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 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
Erik thanks for getting back to me. I am already using a internal timer and it works fine, but since I'm adding more code, I am missing some of the pulses being received. That is why I need an interrupt instead. Please help me. I have declared Pulse = P1^3; Pulse = 1; main calls this fucntion Pulses_received(); //Initialize INT0 as edge triggered void Pulses_received(void) { IT0 = 1; //pulses will be edge triggered EX0 = 1; } void Interrupt_Pulses (void) interrupt 0 { P_Counter++; P2 = Liters; if (P_Counter == 100) { Counts--; //decreased every 100 p. P2 = Counts; //shown on port 2 } } Do I need a loop somewhere?
I do not see EA Erik
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