1
\$\begingroup\$

Traffic Light Circuit

That's a Traffic Light circuit I designed on Multisim. I used 2 74LS191 Counters, 2 74LS47 Decoders, 2 Seven Segment Displays, a 555 timer and a J-K flip-flop as you see.

It should count from 29 down to 00 then the lights switch and the same process repeats again.

The problem I am having is that the bottom counter, which is responsible for showing numbers on the left display, goes like this 0 -> 2 -> 1 -> 0 instead of starting from 2 when I run the simulation for the first time, but after it finishes the first cycle it works correctly. I think the problem is either from the connections or Multisim, but I can't really determine the cause. Can you help me, please?

\$\endgroup\$
  • \$\begingroup\$ YOu do not appear to have any power-on reset system... \$\endgroup\$ – Trevor_G May 3 '17 at 19:26
  • \$\begingroup\$ @Trevor I think connecting the RCO to the Load pin causes the counter to reset every time it reaches zero, if I got what you said correctly \$\endgroup\$ – Supa hot Fire May 3 '17 at 19:36
  • \$\begingroup\$ That would be correct for further operation, but not for initial loading. I have posted answer, not sure it is correct, can you try setting bottom counter to 9 to see if it starts with 9? \$\endgroup\$ – Anonymous May 3 '17 at 19:38
  • 1
    \$\begingroup\$ Ya but what it starts at on power on is undefined. You need to use those spare AND gates and an RC to hold it in reset while the power comes up. \$\endgroup\$ – Trevor_G May 3 '17 at 19:38
  • \$\begingroup\$ If you get stuck... just call out. Adding a push button to that to manually reset it while you are at it would be a nice add too. \$\endgroup\$ – Trevor_G May 3 '17 at 19:47
1
\$\begingroup\$

I would agree with Trevor that you need external reset circuit. Several years ago I was designing circuit basing on LS191, to find out that its TC and RCO output are tricky to use.

In general, you can not use them as reset, and they have kind of limited applications other than cascading counters.

Look into this datasheet from TI on page 5. It has timing diagram, and you can see that at the bottom RCO is going active when counter value is 9. most probably that's why top counter self-resets, and that's why bottom counter does not. I bet if you set bottom counter to 9 at its inputs, it will also start with 9, not with 0. Prove me wrong :)

Update: Reset circuit is simple - as Trevor said you use two spare AND gates connecting their outputs to LOAD inputs of LS191, connecting one of their inputs to respective RCO, and connecting second inputs together to the resistor-capacitor circuit like this. So on power on, while capacitor is not charged, there will be some time until it charges to the voltage enough to trigger 1 at AND gates' inputs, and then these gates continue working being driven low by RCOs. LS191 load will happen somewhere at the end of capacitor "charge period".

Update 1: I upvoted WhatRoughBeast for mentioning requirement of Schmitt trigger action between RC circuit and AND gate input. While circuit may behave properly in simulation, in real life it may experience glitches and bugs.

I have checked STMicroelectronics' article I referred above, and ST6 MCU it targets does have Schmitt trigger on its reset input (page 25). It seems AND gates chip with Schmitt triggers at their inputs do not exist; thus the simplest/cheapest (but may be not most optimal way) is to use LS14 (it has 6 inverters, while you need only two daisy-chained). More optimal way, I would say more advanced way, is to use a kind of reset supervisor, e.g. TLC7705. Good reset signal, generated by this chip, may be reliably used elsewhere in your circuit.

\$\endgroup\$
  • 1
    \$\begingroup\$ You're not wrong at all, it starts to count from 99, but I never thought of making an external reset circuit before, so I kinda not know how to make it \$\endgroup\$ – Supa hot Fire May 3 '17 at 19:43
  • \$\begingroup\$ Updated answer with simple reset circuit explanation \$\endgroup\$ – Anonymous May 3 '17 at 19:49
  • \$\begingroup\$ Whoa! Thanks! It worked just as intended. You're great, dude! \$\endgroup\$ – Supa hot Fire May 3 '17 at 20:01
1
\$\begingroup\$

With all due respect, you have missed the point of synchronous counters, and synchronous logic in general. This shows up in your use of the upper counter's RCO to drive the clock of the lower. Of course, using the 191 for the purpose you want is going to be a challenge anyways, due to the asynchronous reset.

In fact, there is no reason to think that your circuit works as you intend. When the upper counter hits zero, it will instantaneously load to 9 and force a count on the lower counter. So you will count 29,28,27,26,25,24,23,22,21,(20),19,18, etc, with the count in parentheses just a flicker. Not only that, but the RCO output will be prone to spurious runt pulses at clock edges, as internal propagation skew causes improper decoding of the outputs.

In general, making a power-on reset circuit is perhaps a bit (only a bit) more complicated than has been suggested. This is because you need a Schmitt trigger on the RC network - a large time constant will produce a slow transition through the logic threshold and there then exists the possibility of a noisy power-on signal, and that can have unexpected effects.

Finally, I would not recommend using a binary counter for decade work, or at least not one with an asynchronous load function. You are best off using a fully synchronous counter such as the 74LS169.

So, I'd recommend the following changes to your circuit, assuming you must use the 191

schematic

simulate this circuit – Schematic created using CircuitLab

In this circuit, all inverters are Schmitt triggers such as the 74LS14. You'll notice that TCO of the first stage connects to CTEN of the 2nd, and there is a common clock. Also, each TCO goes to a flip-flop which will generate a brief (100 usec or so) load pulse, which gets combined with the power-on reset generated by the RCD circuit on the left.

This is a really klugey circuit, and can be greatly simplified by using 74169s, as follows

schematic

simulate this circuit

You'll note how much simpler this is. However, you do need to be careful of one thing. Since the load function is synchronous, the power-on reset must be long enough to guarantee that at least one clock edge occurs while the reset is active (low). If you don't do that, the reset will not work reliably.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.