counter program on led and 7 segment

Status
Not open for further replies.

sukarthi

New Member
hi...
now am doing counter program for led and 7 segment both ran successfully .but 0 t0 9.i wants to run continuously without stop.for that am using while loop also but it doesn't run
 
Basically you will need nested FOR loops in order to do this. But we have no way of showing you how without knowing how many digits your display has and how your code is written. If you can post your code and tell us how many digits your display has we can help you further.
 
Last edited:
this is my coding
am using 8051.counter program I have to stop after that I have to run where I stop.ex counter program its run 0....9 if I press 1 button it stop 7 after that it has to start from 7.


#include<reg51.H>
unsigned int t,i;
#define p0 P0
#define p3 P3
#define p1 P1
sbit c1=p3^2;
sbit c2=p3^3;
void led();
void segment();
void wait (int j) {
long int d;

for(d =0;d<j;d++);
}
void main()
{
//if(c2==1)
//{
//while(1)
//{
segment();
//}


//}
}
void segment()
{
P0 = 0xf0;
//p1=0xff;
for(i=0;i<10;i++)
{
for(t=0;t<256;t++)

wait(50);
P1=P1-1;

P0 = P0+1;
if(c1==1)
break;
else if(c2==1)
continue;

}
while(1)
{
}

}



/*void led()
{
p1=0xff;
for(t=0;t<256;t++)
{
wait(5000);
P1=P1-1;

}

}
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…