Help with 2 digit BCD counter

  • Thread starter Deleted member 289596
  • Start date

Thread Starter

Deleted member 289596

Joined Dec 31, 1969
0
I also just read this:

Joining, or cascading, counters allows you to count from 0-99 (two counter stages). The preferred method of doing this is by connecting carry out of the first stage to carry in (enable) of the second stage and driving both stages from a common clock.

So I am guessing that I should connect the first 4510's Carry Out to the second 4510's Carry In.

And like I said before, connecting A and D when ABCD= 1001 through an AND gate, then to RESET will reset the counter to 0 so it continue. I know I should do that with one of the 4510's, but I am unsure if I need to do this for both.

Now so far, I know what Carry In/out does kind of, Up/down, Reset, Clock. I am unsure of Preset Enable on the 4510, Strobe on 74157 and I am still not sure what select is actually supposed to do. I also don't know if I will be using the Cin on the first 4510 and the Cout on the second 4510 at all.
 

Thread Starter

Deleted member 289596

Joined Dec 31, 1969
0
Have you read the datasheet?
Have you read the datasheet?
Have you read the datasheet?



Have you read the datasheet? It includes a circuit that does exactly what you want it to! See figure 18. And explains the pins that make it work.
Oh......

Well aparently I haven't read it fully then...
 

GopherT

Joined Nov 23, 2012
8,009
I also just read this:

Joining, or cascading, counters allows you to count from 0-99 (two counter stages). The preferred method of doing this is by connecting carry out of the first stage to carry in (enable) of the second stage and driving both stages from a common clock.

So I am guessing that I should connect the first 4510's Carry Out to the second 4510's Carry In.

And like I said before, connecting A and D when ABCD= 1001 through an AND gate, then to RESET will reset the counter to 0 so it continue. I know I should do that with one of the 4510's, but I am unsure if I need to do this for both.
No, no, no! The CD4510 already rolls over the output from binary 9 to 0 all by itself. That is the definition of BCD (binary converted to decimal). You would need a reset if you were using a counter with a standard 4-bit output like the CD4516 and you were trying to limit the output between 0 and 9. But that would be stupid because the CD4510 is available. See how clever the marketing people were with the names? CD4510 (for BCD output) and CD4516 (for the 4-bit output version)


Now so far, I know what Carry In/out does kind of, Up/down, Reset, Clock. I am unsure of Preset Enable on the 4510, Strobe on 74157 and I am still not sure what select is actually supposed to do.
The preset enable means you can set the initial value into each CD4510 in your cascade as a BCD value.

Now, look at the datasheet logic diagram. See what the Strobe does?

I also don't know if I will be using the Cin on the first 4510 and the Cout on the second 4510 at all.
Clock into the one-digit is the right way. Carry out (from ones digit) to carry in (of the tens digit). Don't make it too complicated.
 

Thread Starter

Deleted member 289596

Joined Dec 31, 1969
0
No, no, no! The CD4510 already rolls over the output from binary 9 to 0 all by itself. That is the definition of BCD (binary converted to decimal). You would need a reset if you were using a counter with a standard 4-bit output like the CD4516 and you were trying to limit the output between 0 and 9. But that would be stupid because the CD4510 is available. See how clever the marketing people were with the names? CD4510 (for BCD output) and CD4516 (for the 4-bit output version)




The preset enable means you can set the initial value into each CD4510 in your cascade as a BCD value.

Now, look at the datasheet logic diagram. See what the Strobe does?



Clock into the one-digit is the right way. Carry out (from ones digit) to carry in (of the tens digit). Don't make it too complicated.
Ok I am really making progress now. Clocks are connected to each other. Preset Enables are connected to each other and a switch. The clock goes into CIN of 1s place for 0-9, then when it finishes, COUT of 1s goes into CIN of 10s place. The other CIN and COUT aren't used. Up/downs connected to each other and a switch.

I still don't get strobe and select after reading what they do.

"When the select signal is low, the output ( Y ) is the same as input A. When the select signal is high, the output Y is the same as input B".
But why would I need to do this?

With strobe, it looks like the strobe pin basically disables the chip? Why would I do that?
 

GopherT

Joined Nov 23, 2012
8,009
Ok I am really making progress now. Clocks are connected to each other. Preset Enables are connected to each other and a switch. The clock goes into CIN of 1s place for 0-9, then when it finishes, COUT of 1s goes into CIN of 10s place. The other CIN and COUT aren't used. Up/downs connected to each other and a switch.

I still don't get strobe and select after reading what they do.

"When the select signal is low, the output ( Y ) is the same as input A. When the select signal is high, the output Y is the same as input B".
But why would I need to do this?
How do you plan on putting the values of each CD4510 into the display? Each CD4510 has outputs ABCD, for a total of eight. The display has only has 4 total inputs.

The answer is, connect the four outputs from the MSD display to all of the A inputs on the 74157, and all of the outputs from the LSD cd4510 to the B inputs on 74157. Then, when "select"pin is low, all of the MSB connections flow to the display. When select pin is high, all of the B (LSB) connections flow to the display. Use the D1 and D2 pins as needed to control the select pins and (clock) and to get the proper information to the display at the right time.

Do you understand?

With strobe, it looks like the strobe pin basically disables the chip? Why would I do that?
you won't need it in this project but you will have to set it (high or low as appropriate to make the circuit work)
 
Clocks are connected to each other
That's like
11
22
33
44
55
etc

But then you fix it.

Strobe:
You have to "set-up" the new value. That takes time. You also generally want the preset value to change on "some event".

In your case, you don't want the preset to follow the inputs until you finished setting all of them.
 

Thread Starter

Deleted member 289596

Joined Dec 31, 1969
0
How do you plan on putting the values of each CD4510 into the display? Each CD4510 has outputs ABCD, for a total of eight. The display has only has 4 total inputs.

The answer is, connect the four outputs from the MSD display to all of the A inputs on the 74157, and all of the outputs from the LSD cd4510 to the B inputs on 74157. Then, when "select"pin is low, all of the MSB connections flow to the display. When select pin is high, all of the B (LSB) connections flow to the display. Use the D1 and D2 pins as needed to control the select pins and (clock) and to get the proper information to the display at the right time.

Do you understand?

you won't need it in this project but you will have to set it (high or low as appropriate to make the circuit work)
The part about the ABCD outputs in the 4510's were basically already done. I put the 10's digit in all of the pins that had a in the 74157 (so 1a, 2a, 3a, 4a), and then put the second 4510's outputs into the bs (1b, 2b, 3b, 4b), then the 74157 outputs into the 1st pins of the actual counter with the 7 segment displays. This was all shown on the first picture.

Ok so with that said, I could just connect select to the clock then? That would be able to let select jump between low and high so that both displays can be updated.

I don't understand the part about D1 and D2. I think that was already done too though.
 

Thread Starter

Deleted member 289596

Joined Dec 31, 1969
0
That's like
11
22
33
44
55
etc

But then you fix it.

Strobe:
You have to "set-up" the new value. That takes time. You also generally want the preset value to change on "some event".

In your case, you don't want the preset to follow the inputs until you finished setting all of them.
Oh so just connect clock to the 1s 4510 chip. Not both. Clock on the second chip isn't used then.
 

Thread Starter

Deleted member 289596

Joined Dec 31, 1969
0
One more question. On the project it says that I need 8 switches for parallel loading purposes. Are these switches on the counter itself, or are these 8 switches the P1-4 inputs on the 4510 chips? If they are on the counter, do I ground p1-4 on the 4510s?
 

GopherT

Joined Nov 23, 2012
8,009
One more question. On the project it says that I need 8 switches for parallel loading purposes. Are these switches on the counter itself, or are these 8 switches the P1-4 inputs on the 4510 chips? If they are on the counter, do I ground p1-4 on the 4510s?
I think the question should be phrased, 8-inputs (4 switches).
 

Thread Starter

Deleted member 289596

Joined Dec 31, 1969
0
I think the question should be phrased, 8-inputs (4 switches).
Yea sorry about that, but yea I don't think I need those 8 inputs in the way that I thought I would.

I'm trying to put it all together now and my breadboard is acting funny. I have to look at it and see what's going on.
 

Thread Starter

Deleted member 289596

Joined Dec 31, 1969
0
Ok guys. I am so close to finishing this, so bare with me here. I have attached two more pictures dealing with my progress. Thank you all for your help.

So basically, when I connect everything, it doesn't do any counting at all. I will tell you exactly what I am doing with everything.
With the 4510s:
- Connect the clocks together to a switch
- Connect up/downs together to a switch
- Connect Preset Enables together to a switch
- Connect Resets together to a switch
- On the first 4510, Carry In is not used, but I connect Carry Out to Carry In of the second 4510. The second Carry Out is not used
- On both 4510s, none of the ABCD inputs are used.

Transitions into 74157:
- On the first 4510, I connect ABCD outputs to 1A, 2A, 3A and 4A respectively on 74157
- On the second 4510, I connect ABCD outputs to 1B, 2B, 3B and 4B respectively on the 74157

74157:
- Strobe is grounded

Transitions into counter:
- Select is connected to the clock (Square wave, 100hz, 4v amp).
- Outputs 1y, 2y, 3y and 4y are connected into the 1st hole of A, B, C and D on the counter.
- The clock is connected to D1's second hole, and D2's first hole (through a not gate).

I am sure that I am doing everything right. I tried my best to draw it out so you could see what I'm doing. I'm not sure what's going on?
 

Attachments

- Connect the clocks together to a switch
We talked about it.

The reason why it can't work is because the clock pulse has to be an EDGE.

Does preset work?

- Select is connected to the clock (Square wave, 100hz, 4v amp).
Why?

Doesn;t the select switch SELECT chose what nibble is loaded?

Confused:
Where is the 7 segment decoder driver?
Why are the outputs going to the multiplexer?

I THOUGHT you were supposed to use 5 switches and a push button to load each digit. e.g. a4 a2 a1 a0 (digit select) and (preset - momentary)
So, the procedure is something like:
select digit
set a0 through a4
press preset
select the other digit
set a0 to a4
press preset



Start small. Get one digit to work, at least somewhat. Then build from that.

One comment:
Suppose we had a 3 digit counter and it was at 899.
Clock on the LSD changes it to a 0, ---< 890
Carry out goes to carry in; the 10's digit changes ---> 800
carry out goes to carry in again ---> 900

That's how carry is supposed to work. See any clocks on anything but the LSD?

I'd kinda start over with just one digit. Get something to work. Preset or count. Even ignore some of the switches, for the time being.

For CMOS parts, you MUST connect every unused input to SOMETHING.
When an input wants and edge, it has to be a fast rising edge.
Remember that switches bounce.

The signal generator will also cause you problems because of the logic levels of CMOS. You are using CMOS parts, right?

Preset should be the easiest to get to work.

Seeing the breadboard makes things a bit more understandable, but only a bit.

the LED displays look like they need to be multiplexed.
Not sure if you have a BCD to 7 segment decoder/driver.
So, need to know a bit about the display.

You do have access to a signal conditioned pulse.

I'm a lot confused.

You actually have LEDs (rather than 7-segment displays) you can use, so you might actually start there.

You might benefit by understanding the pieces first. One counter as simple as you can make it.

With 8 LEDs you can actually do both counters. Switches might be in short supply though,

I know I'm not being much help, because I'm not designing the thing. My intent is to make YOU think.

If your doing multiplexing, your design will probably suffer from blurrig of the digits because of the lack of inter-digit blanking.

That breadbord pic would have helped a WHOLE LOT seeing it from the beginning.
A link to a manual would help more.
 
Last edited:

Thread Starter

Deleted member 289596

Joined Dec 31, 1969
0
We talked about it.

The reason why it can't work is because the clock pulse has to be an EDGE.

Does preset work?



Why?

Doesn;t the select switch SELECT chose what nibble is loaded?

Confused:
Where is the 7 segment decoder driver?
Why are the outputs going to the multiplexer?

I THOUGHT you were supposed to use 5 switches and a push button to load each digit. e.g. a4 a2 a1 a0 (digit select) and (preset - momentary)
So, the procedure is something like:
select digit
set a0 through a4
press preset
select the other digit
set a0 to a4
press preset



Start small. Get one digit to work, at least somewhat. Then build from that.

One comment:
Suppose we had a 3 digit counter and it was at 899.
Clock on the LSD changes it to a 0, ---< 890
Carry out goes to carry in; the 10's digit changes ---> 800
carry out goes to carry in again ---> 900

That's how carry is supposed to work. See any clocks on anything but the LSD?

I'd kinda start over with just one digit. Get something to work. Preset or count. Even ignore some of the switches, for the time being.

For CMOS parts, you MUST connect every unused input to SOMETHING.
When an input wants and edge, it has to be a fast rising edge.
Remember that switches bounce.

The signal generator will also cause you problems because of the logic levels of CMOS. You are using CMOS parts, right?

Preset should be the easiest to get to work.
Oh boy... I am so confused right now...
 
Now, the project really makes sense to me.

1. Totally ignore the multiplexor. I mean totally. leave room for it, but IGNORE IT.

2. Start with one counter and connect the outputs tohe single LED.s. The count push buttons are preconditioned.

3. So, you should be able to create a single BCD digit binary coounter
e.g.
0000
0001
0010
0011
0100
etc

You should be able to get preset and load to work.

Now, duplicate the most significant digit. Make it a single digit. For the time being connect the clocks together. Add the other LEd's

0000 0000
0001 0001
0010 0010

Now, with every press, each digit should increment or decrement.

You can preset them to different values
1001 0111
1000 0110 count down

Now remove the clock to the most significant digit. and connect carry in//out.

Now it should count like
0000 0001 ---> 01 decimal
0000 0010 ---> 02 decimal
...
1001 1001 --- > 99

You can still leave the single LEDs in place

Now, you can try to take a big step and multiplex them. Initially don't use the function generator. Use a switch or a wire.
Be warned that a miswire on the multiplexor wlll give you wierd numbers.

So, start small and grow. Leave room to grow.

I can't expect you to wire something and expect it to work. Designing, simulating and building works.

Seeing the breadboard made all of the difference in the world.

There are still breadboard issues. I'm not crazy with you using CD4xxx parts.

REMEMBER that all unused inputs have to be connected to something. (GND or VCC whatever is convenient)
 

Thread Starter

Deleted member 289596

Joined Dec 31, 1969
0
Now, the project really makes sense to me.

1. Totally ignore the multiplexor. I mean totally. leave room for it, but IGNORE IT.

2. Start with one counter and connect the outputs tohe single LED.s. The count push buttons are preconditioned.

3. So, you should be able to create a single BCD digit binary coounter
e.g.
0000
0001
0010
0011
0100
etc

You should be able to get preset and load to work.

Now, duplicate the most significant digit. Make it a single digit. For the time being connect the clocks together. Add the other LEd's

0000 0000
0001 0001
0010 0010

Now, with every press, each digit should increment or decrement.

You can preset them to different values
1001 0111
1000 0110 count down

Now remove the clock to the most significant digit. and connect carry in//out.

Now it should count like
0000 0001 ---> 01 decimal
0000 0010 ---> 02 decimal
...
1001 1001 --- > 99

You can still leave the single LEDs in place

Now, you can try to take a big step and multiplex them. Initially don't use the function generator. Use a switch or a wire.
Be warned that a miswire on the multiplexor wlll give you wierd numbers.

So, start small and grow. Leave room to grow.

I can't expect you to wire something and expect it to work. Designing, simulating and building works.

Seeing the breadboard made all of the difference in the world.

There are still breadboard issues. I'm not crazy with you using CD4xxx parts.

REMEMBER that all unused inputs have to be connected to something. (GND or VCC whatever is convenient)
So basically I should just start out slower instead of doing everything at once. I'll try tomorrow. The chips we get are what we use lol, we don't have a choice.

So looking at my circuit on the picture, did everything look like it made sense, or were there mistakes that popped out right away after looking? I'll ground everything I'm not using next time.

I think for now that's all I got for questions. Now I'm just open to suggestions. Thank you
 
Power pins. They are usually not shown, but make sure they are connected.
Tie all unused inputs to something
Preset wasn;t wired.

What you can do is, pull the inputs to the 74157 and hard wire a 1 and a 7.
See if a 17 appears.
that will check you mux. Not 100%, but something predictable should happen.

remove the outputs from the counters and connect to the 8 individual LEDs.

There is a parallel clock mode, http://people.ece.cornell.edu/land/courses/ece4760/FinalProjects/s2011/kj83_twl46/docs/CD4510B.pdf (Pdf page 6) but make sure CI on the LSD (Least significant digit) is set to zero. In the figures the LSD is shown first.

Note, it say if CI is held low, the counter advances on a positive going pulse. So make sure your using the right pulser.

You missed the boat, or got eleuded with the counters. You kinda have the 1s and 10s not interconnected properly.
The way TI drew it, it's 1's, 10s, 100's
You drew it as 10's, 1's . CI has to be low on the 1's digit.
the 1's digit CO, goes to the 10's digit CI.

If you use the TI method, the drawing would be neater.
but the chips are layed out as 02 for displaying 20.

Make sure the pulse signal goes below 0.5V and above 4.5 V and goes to >4.5 when pushed assuming your using a 5V supply.. This is critical.

Actually using a voltmeter to check the power pins can be helpful.

Kinda sorry, I wasn't quite paying attention. I do suffer from migraines and I'm suffering with one as I write.
 
Top