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.

pic16f86 -want to make 2 digit BCD counter

Status
Not open for further replies.

exotic-13

Newbie
Joined
Dec 19, 2021
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
10
i wanna make a counter that goes from 00 to 59 using two bcd displayers , how can i do this and please i need some youtube channels that would help improve myself .
the program is the following :
Code:
void main () {
TRISB=0;
for(i=0;  i<=5;  i++);
{    for(j=0;  j<=9; j++);
        {  PORTB=j; i<<4;
          delay_ms(1000);
}
i=i++
}
}

[code tags added by moderator]
 
Last edited by a moderator:

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,459
Helped
296
Reputation
592
Reaction score
279
Trophy points
1,363
Location
France 01800
Activity points
10,409
i wanna make a counter that goes from 00 to 59 using two bcd displayers , how can i do this and please i need some youtube channels that would help improve myself .
the program is the following :
Code:
void main () {
TRISB=0;
for(i=0;  i<=5;  i++);
{    for(j=0;  j<=9; j++);
        {  PORTB=j; i<<4;
          delay_ms(1000);
}
i=i++
}
}

[code tags added by moderator]

show your schematic ....
I can suppose, the 2 BCD displayers are connected on PORT B
MSB on B7..B4 (0 to 5 ) and LSB on B3 ..B0 (0 to 9)
don't increase "i" in the loop, it is allready done inside "for" instruction


Code:
void main ()
 {
do
{
 TRISB=0;
   for(i=0;  i<5;  i++);
    {
       for(j=0;  j<9; j++);
        {
         PORTB=( i<<4 )  |  j ;      // combine the two  i=MSB and  j=LSB
          delay_ms(1000);
         }
   }
while(1);
}
 

Aussie Susan

Advanced Member level 4
Joined
Jan 5, 2015
Messages
1,473
Helped
402
Reputation
804
Reaction score
440
Trophy points
1,363
Activity points
17,312
Also the "i<<4;" doesn't do much other than waste a few cycles.
Please show us your real code.
Susan
 

danadakk

Advanced Member level 5
Joined
Mar 26, 2018
Messages
2,215
Helped
344
Reputation
706
Reaction score
512
Trophy points
113
Activity points
9,788
As an aside this can be done as a HW only solution in case you ever
need it (1 chip, in this case 3 digits, 7 segment output data) -

1634859593969-png.134176


This was an done on a ARM core part that has fabric inside to create other
digital HW functions, verilog was used for actual synthesis inside part.

The BCD to 7 seg was done via a simple LUT, as you can see on
above chip internal schematic.

Regards, Dana.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top