newbee
Newbie level 3
hi
i m studying 8051 with keil and wro a program without an infinite loop, but the simulation on proteus keeps on running, the program repeats itself
here is the code (very simple): i expect nothing even if i press the button sinceit will run and finish very fast
#include <REGX51.H>
#include <stdio.h>
#define button P1_0 // definitions//
#define led P1_1
void main(void) // main program//
{
button=0; // initials //
led=0;
while (button) //when button pressed//
{
led =!led; // complement the led //
while(button) //wait until release the button//
{ }
}
}
i m studying 8051 with keil and wro a program without an infinite loop, but the simulation on proteus keeps on running, the program repeats itself
here is the code (very simple): i expect nothing even if i press the button sinceit will run and finish very fast
#include <REGX51.H>
#include <stdio.h>
#define button P1_0 // definitions//
#define led P1_1
void main(void) // main program//
{
button=0; // initials //
led=0;
while (button) //when button pressed//
{
led =!led; // complement the led //
while(button) //wait until release the button//
{ }
}
}