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.

counter program of 7 segment display

Status
Not open for further replies.

suga

Member level 2
Member level 2
Joined
Jan 23, 2012
Messages
49
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
chennai
Activity points
1,596
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
/////////////////////////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)
  {
  seg();
 
  }
 
}
 
void seg()
{
for(p0=0xf0; p0<=0xf9; p0++)
{
 wait(10000);
 
 
 
 }
}

 
Last edited by a moderator:

Elaborate your question Plz.
 
  • Like
Reactions: suga

    suga

    Points: 2
    Helpful Answer Positive Rating
In my program r1 is a switch.once a press a switch 7 segment had count 1 t0 9.after that 7 segment stopped i want when i press the switch 7 segment has to run continunosly without stop.
 

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);
 
 
 
 }
}


Try this code, it will work
 

your telling about OP.OP means
 

Original Poster, the person who started this thread (you :-D)
 

Stoping is not your headache, it is according to the requirement of user. By the way it is not so difficult to stop it.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top