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.

00 to 99 counter using 2 seven segment multiplexing

Status
Not open for further replies.

sayf alawneh

Junior Member level 3
Junior Member level 3
Joined
Aug 15, 2014
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
256
2 common cathode 7 segments and pic 16f877a and mikroc pro for pic
2 transistors connected with RD0 and RD1 , the RD0 transistor is responsible about the tens digit and the RD1 transistor is responsible about the ones digit the 2 common cathode 7 segments are connected to portb
code :

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
35
char x,y=0; // x for ones and y for 10s
char I;
unsigned short mask(unsigned short num){
switch(num){
case 0:return 0x3f;
case 1:return 0x06;
case 2:return 0x5B;
case 3:return 0x4F;
case 4:return 0x66;
case 5:return 0x6D;
case 6:return 0x7D;
case 7:return 0x07;
case 8:return 0x7F;
case 9:return 0x6F;
}
}
void main()
{
TRISB=0;// PORTB is output
TRISD=0;// PORTD is output
PORTB=0;// initialize PORTB
PORTD=0;// initialize PORTD
for(;;){ // ifinite loop
for (I=0;I<200;I++){ // delay_1second for the counter since every digit takes 5 ms 
PORTD=1; // PORTD=0B00000001; transistor on RD0 is enabled and transistor on RD1 is disabled
PORTB=mask(y); //tens digit
delay_ms(5);// eye delay
PORTD=2; // PORTD=0B00000010; transistor on RD1 is enabled and transistor on RD0 is disabled
PORTB=mask(x); //ones digit
delay_ms(5); // eye dealy
}
x++;
if(x==10){x=0;y++;if(y==10)y=0;}
}
}

 
Last edited:

I dont see a question in your post:roll:

Was it working now after you modified your last program?:-D

Allen

yes it is working well i just posted this thread to help those who need help in the future cause i really find it hard to find helpful info on the web sometimes ^_^
 

Use interrupts for SSD. This way if you have huge code and/or delays in while(1) loop it will not affect the SSD display, else you will see flickering or even blinking of SSD.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top