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, thank you for your help. But I need it for falling edge detection. this will set the IE1 (when detected) in the TCON register, generating an interrupt, in this case ISR number 0. Right? Should this pin be high or low. when IT0 is not set and as you have set it you get "falling edge detection" as the datasheet say
But I need it for falling edge detection. this will set the IE1 (when detected) in the TCON register, generating an interrupt. read "the bible" ch 2 pg 14 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_PROG_GUIDE_1.pdf Erik
Erik, I've look at "the bible" chapter 2 page 14, but it gives you the 80C51 Instruction set summary. I need to know how to make the external interrupt 0 as a edge level detector. I am inputting pulses on its pin P1^3, using a 555 timer. Create an interrupt which increases a counter from 0 to 100 pulses. Can you help me, because I cannot get it right. What do I need to do after setting IT0 = 1; in the TCON register. Please help me. I already have the port as input, made the pin high, set the BRG. Help!
"the bible" chapter 2 page 14, describes the function of the bits in TCON 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 no, edge triggerd will only wake up if a wiggle occur But I need it for falling edge detection. this will set the IE1 (when detected) in the TCON register, generating an interrupt, in this case ISR number 0. Right? Should this pin be high or low. when configured as an input high/low is determined by what is fed to the pin from the outside. I am inputting pulses on its pin P1^3, using a 555 timer. Create an interrupt which increases a counter from 0 to 100 pulses. Can you help me, because I cannot get it right. I assume this is a test, otherwise use an internal timer. What do I need to do after setting IT0 = 1; in the TCON register. wait for the interrupt to occur If this does not help, show your code (initialization and ISR) pls remember 'pre' and '/pre' ' symbolozes < and > se above Erik
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