Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[51] Debugging seems to be ok but not running satisfactorily

Status
Not open for further replies.

GYU1751ASB

Newbie level 4
Joined
Sep 1, 2010
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,328
Hi,
I am testing a simple program of Blinking two LEDs with 8051 uC, one LED will blink all the time and another will toggle during an interrupt. I am using proteus simulator and keil v5. Debugging step by step of the code in keil shows it ok while running the code is not giving satisfactory output with interrupt LED. Proteus is also not responding with Interrupt LED which is connected with P2.3 and supposed to be toggle with interrupt in INT1 pin of 8051. I have attached a .rar file which contains interrupt.pngthe project file.
Please help me.
 

Attachments

  • 8051 interrupt.rar
    48.9 KB · Views: 92

You should not use large delays inside ISR. Your blinkLED() function contains large delays and it is called from within ISR.
 

Thanks for your reply. I have now used no delay but only toggling of the LED connected to P2.3 with interrupt 1. So now it is working in Keil V5. But can you tell me why this effect is not showing in the simulator. Actually when I run the simulator, The
LED connected to P2.0 is blinking fine as per the code, but why this is not ok with the interrupt LED. Please help me.
 

If external interrupt is happening too fast then you will either see the LED as ON or OFF but not both. So, use
Code:
LED2 = ~LED2;
in external interrupt ISR and make your external interrupt frequency slow.
 

If external interrupt is happening too fast then you will either see the LED as ON or OFF but not both. So, use
Code:
LED2 = ~LED2;
in external interrupt ISR and make your external interrupt frequency slow.

Thanks for your reply. As you have mentioned, I have done the same. I have attached my modified code and circuit. But still the Proteus simulator is not toggling the Interrupt LED at P2.3 with pressing the spst switch in P3.3 (external interrupt 1). But with KEIL v5 the code is working fine. I could not understand what is the issue with Proteus simulator. Please help.

the code segment is given below:

Code:
#include<stdio.h>
#include<REG52.H>

#define EXT_INT1 2
sbit warning_LED=P2^0;
sbit interrupt_LED=P2^3;
void blink_LED(void);

void ext_int(void) interrupt EXT_INT1
{
    interrupt_LED=~interrupt_LED; 
}

void main(void)
{
    int i;
    EA=1; //Enable global interrupt
    IT1=0; // Enable level trigger on external 1 interrupt
   EX1=1; // Enable external 0 interrupt
   
    while(1)
    {
        for(i=0;i<100;i++)
            warning_LED=~warning_LED;            
    
    }
}
 

Attachments

  • 8051 interrupt_2.rar
    47.8 KB · Views: 76

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top