this is my program.In this program when I pressed the switch 7 segment starts to count 0 to 9.after that again I press switch only it will count.i need when i pressed the switch it will count continuously.
Code C - [expand] |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
| /////////////////////////counter display 7 segment//////
#include <reg51.H>
#define p0 P0
#define p2 P2
sbit r1=P3^2;
void seg();
void wait (int j) {
long int d;
for(d =0;d<j;d++);
}
void main()
{
if(r1==1)
{
while(1)
{ //run infinitly
seg();
}
}
}
void seg()
{
for(p0=0xf0; p0<=0xf9; p0++)
{
wait(10000);
}
} |