I thought 4 digits would be easy but everything goes wrong (The Great Multi-Digit Saga: Part 2)
Вставка
- Опубліковано 19 сер 2024
- I tried to add 2 more digits to my 2 digit counter circuit, but it didn't go well.
This turned into a multi-part miniseries:
Part 1: • Upgrading the counter ...
Part 2: (you are here)
Part 3: • I fixed my 4 digit cou...
-- Links
HLF SN74LS160N Data Sheet: hlf-ic.cn/uploa...
HLF SN74LS162N Data Sheet: hlf-ic.cn/uploa...
(Possibly wrong!)
Texas Instruments SN74LS192 Data Sheet: www.ti.com/lit...
HLF SN74LS48N Data Sheet: hlf-ic.cn/uploa...
XLITX 5161AS LED Display Data Sheet: www.xlitx.com/d...
-- Stuff
Timers/Op-Amps IC Kit: amzn.to/3Hqysz0
74LS TTL IC Kit: amzn.to/40WH75c
Multimeter: amzn.to/49PUg45
Power supply: amzn.to/3uAYxIE
Breadboard kit: amzn.to/3MYwfho
7 Segment Display: amzn.to/3viAu1l
Logic Probe: amzn.to/3SfDRz4
Antistatic mat: amzn.to/49RhcQi
My Wife's Books: amzn.to/47yt9Ji
(Maybe you and/or someone you know will like them!)
We all "fail miserably" from time to time but most of us are too afraid to show it. We're all learning here.
man i do this every night alone and know who had the same problems and enjoy so much this is the best, its like sharing a passion i love it, sorry for my bad english keep going
I've been doing a 4 digit counter as well, here's what I ran into. I constantly had to push down in the ICs, due to inconsistent counting. Eventually I'd get it to work, but they would loosen back up and I had to push them back down. Eventually I had enough and had to solder everything to a circuit board... which is unfortunate because I wasn't done with the circuit as a whole. But, since soldering everything down, its rock solid. Seeing your counters skip digits is so reminiscent to what I dealt with. Consider what I'm saying... I wasted so much time troubleshooting a circuit that was correct. You are making such great progress, I hate to see you lose ground to breadboard issues.
I hope to demystify some of the datasheet, I don't think all of it will remedy the glitches you are seeing, but here goes. Firstly, the Bar on pins refers to the active state, so /LOAD means Load is active when logic low. Where you aren't intending with your current test to use that, it should be held High, which you are. The logic diagram on page 5 of the TI datasheet illustrates first clearing the data with a HIGH pulse to CLR (effectively storing zero), setting some bits with a LOW pulse to /LOAD (for the number 7 in the example), then on the RISING Clock EDGE on UP the counter increments. When the counter reaches 9 the /CO pin "follows" the UP Clock pulse, so by connecting /CO on digit1 to UP on digit2 you get synchronized increment. (On the rising edge of the UP CLOCK (digit1) the /CO also rises, giving digit2 UP a rising edge to increment, thus simultaneously digit1 goes to zero and digit2 goes up). Also DATA in is only read on a /LOAD pulse, it appears you can leave them float, but It may be useful to incorporate a CLR pulse to set zero. It likely won't behave as intended if held high, you may be able to do it with an RC filter and a pair of inverting schmitt-triggers. (that should only fire once on power-up which is what you appear to want, you may be able to add a button for manual reset later.) With regards to the GND pin on BOTH chips bending when placed in the right hand position, I recommend checking that hole with a sturdy piece of wire to see if there is something off about it. Not all breadboards are of the same quality, It's hard to tell from the video (and I have only just found your channel and watched about 3-4 vids) how good the ones you have are, but if you are going to use bread boards, shop around and buy the good ones, they can save many headaches. Ben Eater sells some good ones, or has some advice on what to look for. (he also has a handy 555 based clock breadboard circuit on his webpage that allows for variable speed and single stepping which is handy for trying to understand what the heck is going on sometimes.) Last thing I will say, if you have additional bread boards, it might be handy to build a 4 or 8 LED "Logic analyzer", if you have or acquire a buffer ic to run the LED's such as a 74ls540/541 then you could connect ground and any of the inputs to a specific signal on your circuit to inspect the state as it is ticking away. The buffer is recommended to not put extra draw on your circuit under test. Great video, hope you figure it out. I enjoyed following along!
You should read the whole paragraph. At 7:45, there is a paragraph about those preset lines that are A,B,C and D. It means that when you put a binary or BCD number there, when activate LOAD signal, can load that value into the counters. That is useful to make division, like in a clock, to force the counter to count from 00 to 59 and then to return to 00. They have to connect the unused clock input low to count; i.e to count up, input the clock to the UP input and ground the DOWN input. You are correct to get the output from the carry pin of the second counter to cascade with the other counter module but you do not need to connect the clock signal to the counter module on the left.
I suspect a bad contact on the breadboard or a error with the wiring. You should show the schematic that you are using to check first that there is no error there and then to check the actual circuit on the breadboard.
What you should have is (not sure if I can explain clearly enough) counter 1: Clock in to UP, DOWN to ground, QA-QD outputs to the LED decoder, A-D to 0 or 1, LOAD to 5V, Borrow to Count DOWN of the second counter, Carry to Count UP of the second counter. The second counter should be wired the same as the first, but leave Borrow unconnected and use Carry as the output clock for the counters on the left. Both counters should have CLEAR pin to ground.
Edit: I used 192/193 counters many times either TTL or CMOS, and they are very well behaved and also easy to work with. The pinout makes the PCB easier to design that the old 7490 and also have the ability to count up and down from a single clock input with only few logic gates. If the circuit misbehave at higher frequency, use a decoupling capacitor directly on the IC pins, however, on the breadboard you should be ok up into the KHz range.
I was shouting to the screen, EXCHANGE THE CHIPS, if then the problems moves to the other side then the fault is in the chip, of the problem remains then it is in the wiring.
Remember that the state of a counter on power-up will be undefined, so the counter must be cleared if it is necessary to have it operate properly as soon as clocking is started. Remember also that a counter with four flip flops has 16 possible states. Even if the counter is intended to count from 0 to 9, it could power up in one of the six unused states. Typically TTL counters did not have circuitry to specifically define the transition from an unused state to a used state, so the behavior is unpredictable until a used state is eventually entered (the next state from any particular unused state _may_ actually be highly predictable but still not what might be wished for; in some sequential circuitry you can wind up never getting from an unused states to used states unless reset is used).
EDIT - I had a look at the datasheet for the CD74HC192/3. It includes a state diagram showing the transitions from "illegal" states.
place a capacitor ACROSS the power and ground pins on some of the counters. the bad counting will go away. thats what happend to me with that circuit.
connct the power as uuasual but place a cap along side the power pin to ground.
I see no evidence of decoupling capacitors on the breadboards.
Power supply decoupling caps are very important in sequential circuitry because transient misoperation is "remembered." Counters, depending on specific type, can be particularly difficult because you can have multiple outputs making transitions simultaneously.
Decoupling is too complex to explain in detail here (though I can if someone really wants it). There should be some good info on the web. Decoupling primarily negates the detrimental effects of inductance in the power distribution paths.
Basically you want a ceramic capacitor of around 100 nF connected between Vcc and ground close to each counter IC (usually OK to have one cap for 2 or 3 counters if they are close together) and on the shortest leads possible. There should be one for the 555 - they are *horrible* for putting noise on supply lines. When power is coming from another breadboard or a remote power supply, a "bulk capacitor" of 10 µF or more (aluminum electrolytic cap usually OK) somewhere around where the power comes onto the board.
Hmm. This sounds like the kind of thing I was afraid of - a whole new dimension of possible problems that I didn't even know about!
Simple way to find out. Put a scope on the power rails
@@rty1955
Zaphod doesn't have an oscilloscop.There really isn't any alternative method I can think of for assessing supply quality.
In any case, use of power supply decoupling is standard practice. He uses a local regulator board that presumably has input and output bulk capacitors, so at least he's off to a good start there. A lot of people will connect their bench power supply with two rather long, separate wires, which is very bad practice since you get a lot of inductance in those wire (a twisted pair is very much better).
I can't be sure that his issue is caused by lack of decoupling, but odd and inconsistent behavior certainly can be a sign of need for decoupling. Inconsistent behavior can make debugging very frustrating.
You’re a Madman!
What a thriller!
Maybe I should have added dramatic movie background music.
On the datasheet for the 74ls192 it says the down pin must be held high when clock is connected to the up pin
I feel your pain! 😋 If you crank up the speed and it stops working, your timings are maybe a bit off. You might need an edge detection circuit to ensure a clear pulse instead of short pulses that can be missed by other chips when the speed is increased. Check if your 555 timer is producing a nice 50% duty cycle pulses. If so, go down the line and see if everything else is producing nice pulses. If not, you may need an edge detector circuit to prolong the pulse. I made a short about a simple edge detector circuit: ua-cam.com/users/shorts0Jpop3v_-x0
There no need whatever for a 50% duty cycle clock. If the clock rate were approaching the maximum that the counters could handle (which would NEVER happen with a 555 clock generator and TTL counters), then there might be some value to having about 50% to meet the specified requirements for HIGH and LOW times for the clock.
A 555 is simply unable to produce a clock with either HIGH or LOW time that would violate the timing requirements for TTL.
First off, is this a simple 4 digit counter? If so its a veey simple design.
If you post your schematic, it would be easy enough to guide you.
First begin with the right digit first. You are also using 7492 which is a divide by 12 which will count 0-11 or bcd 0-1011. Clearly this will not work for 7 seg displays..use a full 7490 for right leds, then use ONLY the divide by 5 portion of the next 7490 for the next digit to the left. This will displa 00-59
I think thats what your after