# 8-bit binary up counter issue!!

Discussion in 'The Projects Forum' started by saad.zafar01, Dec 19, 2012.

1. ### saad.zafar01 Thread Starter New Member

Dec 15, 2012
19
0
How can I limit a 8-bit binary up counter to count upto 215 instead of 256??

2. ### tshuck Well-Known Member

Oct 18, 2012
3,527
679
I've never seen an 8-bit counter count to 256

Anyway, you'd need to add external logic to clear/load the counter with 0 once the count is 215... or maybe you mean 214?

3. ### saad.zafar01 Thread Starter New Member

Dec 15, 2012
19
0
yeah sorry 8 bit counters count upto 255 and i need to limit it to 215

4. ### absf Senior Member

Dec 29, 2010
1,874
513
215 = 11010111 binary

May be this would work....

Get a 6 input NAND gate and connect Q7,Q6,Q4,Q2,Q1,Q0 to the inputs, output goes to the "Reset" of counter. If there is no reset pin, use PL pin and set the Preset inputs to "00000000". If you need 215 to show and only reset at 216 the use "11011000" to reset.

Allen

Aug 23, 2012
6,423
995

Dec 15, 2012
19
0
7. ### WBahn Moderator

Mar 31, 2012
23,209
6,997
In general, be careful about playing this trick. The output of the NAND will go LO for four different input values (sixteen in the case of using 216). Since the one you want is the smallest of them and since you assume that the counter will be coming up from zero, it will work in this case. But don't put it in your bag of tricks as a general way to trap a particular value.

Last edited: Dec 20, 2012
absf likes this.
8. ### saad.zafar01 Thread Starter New Member

Dec 15, 2012
19
0
will the counter count automatically on power & by clock signal or i have to input any data???

9. ### absf Senior Member

Dec 29, 2010
1,874
513
I dont quite get it.

For "11010111" what are the 4 preset values that would make this scheme fail?

Hmm... two of them are "11011111", "11110111", right?

Thanks.

Allen

Last edited: Dec 20, 2012
10. ### WBahn Moderator

Mar 31, 2012
23,209
6,997
It will power up in a random state. It will count up from that state (in response to the clock) until it either rolls over or satisfies the conditions you've established to automatically reset. If that initial behavior is not acceptable, then you will need to include circuitry to effect a power-on-reset to force it to initialize the way you want it to.

11. ### WBahn Moderator

Mar 31, 2012
23,209
6,997
Sure.

If you are only looking at the bits that will be HI, then you have turned all of the other bits into "don't cares".

So the NAND gate will go LO for the following states:

11010111 = 215
11011111 = 223
11110111 = 247
11111111 = 255

absf likes this.
12. ### absf Senior Member

Dec 29, 2010
1,874
513
If you're using 4020 or 4040 as suggested by ScottWang, you dont have to set any input. The counters than I was describing was binary counter like 74163 or 74193 that has presetable inputs.

But you can make a power-up reset for your cmos counter to make sure that it starts with zero. Just use a 1uF cap and a 10K resistor should be fine.

Allen

• ###### PUR_4020.PNG
File size:
17.4 KB
Views:
46
Last edited: Dec 20, 2012
13. ### saad.zafar01 Thread Starter New Member

Dec 15, 2012
19
0
can you give me an alternative for MC10e016 as i cannot find it anywhere....
i want a 8 bit synchronous binary up counter.........

i want a urgent reply plz

14. ### ScottWang Moderator

Aug 23, 2012
6,423
995
Unless you have some other functions needed, otherwise when you use MC10e016, it will bring you to get more questions.

MC10e016 datasheet:
http://pdf1.alldatasheet.com/datasheet-pdf/view/11779/ONSEMI/MC10E016.html

The simply up counter that you can use CD4520, CD4040.

CD4520 datasheet,CMOS Dual Up Counters:
http://www.datasheetcatalog.org/datasheets/120/109587_DS.pdf

square wave generator : NE555 or 4Mhz Xtal module
square wave → up counter → DAC.
The square wave can be divide by CD4520 or CD4040 or 74HC390 to reduce the frequency down to the speed to suit your need.

15. ### saad.zafar01 Thread Starter New Member

Dec 15, 2012
19
0
if i use this cmos cd4520 with the rest of my circuit that uses ttl ics will it create problems for me?

16. ### ScottWang Moderator

Aug 23, 2012
6,423
995
When you use CMOS to TTL, almost just direct to use it, but if you use TTL to CMOS, usually you need a pull up resistor between them.

74HCxx and 74HCT and TTL Series Related Application Details. 74HCxx and 74HCT and TTL Series Related Application Details.

17. ### saad.zafar01 Thread Starter New Member

Dec 15, 2012
19
0
please tell me a 8 bit binary up counter or tell me how to use two 4 bit binary up counters in series

Aug 23, 2012
6,423
995
19. ### saad.zafar01 Thread Starter New Member

Dec 15, 2012
19
0
im now using two dm74ls193n to connect them together do i have to connect pin 12 of one to pin 13 of the second?? or pin 12 of one to clock of 2nd... and for stopping the counter at 215 instead of letting it go to 255 shouldnt i be using a and gate instead of a nand gate as the clear pin works at logic 1??

20. ### MrChips Moderator

Oct 2, 2009
17,369
5,366
The same thoughts crossed my mind as soon as I saw Allen's solution.
I would have though that you must include the 0 bits also.

Thinking about it more carefully, it appears that the solution is valid so long as you are counting up from zero.

absf likes this.