Using a ring shift counter as a sequencing device, design a traffic light controller that goes through the following sequence: green, 20 s; yellow, 10 s; red, 20 s. Also, at night, flash the yellow light on and off continuously.
By studying the waveforms from Figure 13–6, you will notice that if we add one more flip-flop to that 4-bit ring shift counter and use a clock input of 1 pulse per 10 s, we could tap off the Q outputs using OR gates to get a 20–10–20 sequence. Also, we could use a phototransistor to determine night from day. During the night we want to stop the ring shift counter and flash the yellow light. Figure 13–20 shows a 5-bit ring counter that could be used as this traffic light controller. First, let’s make sure that the green–yellow–red sequence will work properly during the daytime. During the daytime, outdoor light shines on the phototransistor, making its collector-to-emitter resistance LOW, placing a low voltage at the input to the first Schmitt inverter, and causing a LOW input to OR gate 4. The 1-pps clock oscillator will pass through OR gate 4 into the MOD-10, which divides the frequency down to one pulse per 10 s. The output from the MOD-10 is used to drive the clock input to the 5-bit ring shift counter, which will circulate a single HIGH level down through each successive flip-flop for 10 s at each Q output, as shown in the timing waveforms.
OR gates 1, 2, and 3 are connected to the ring counter outputs in such a way that the green light will be on if Q_{0} or Q_{1} is HIGH, which occurs for 20 s. The yellow light will come on next for 10 s due to Q_{2 } being on, and then the red light will come on for 20 s because either Q_{3} or Q_{4} is HIGH.
At nighttime, the phototransistor changes to a high resistance, placing a HIGH at the input to the first Schmitt inverter, which places a HIGH at OR gate 4. This makes its output HIGH, stopping the clock input oscillations to the ring counter.
Also at nighttime, the LOW output from the first Schmitt inverter is connected to the ring counter Resets, holding the Q outputs at 0. The HIGH output from the second Schmitt inverter enables the AND gate to pass the 1-pps clock oscillator on to OR gate 2, causing the yellow light to flash.
At sunrise, the output from the first Schmitt inverter changes from a LOW to a HIGH, allowing the ring counter to start again. This LOW-to-HIGH transition causes an instantaneous surge of current to flow through the RC circuit. That current will cause a HIGH at the input of the third Schmitt inverter, which places a LOW at {\overline{{S_{D0}}}}, setting Q_{0} HIGH.
When the surge current has passed (a few microseconds), {\overline{{S_{D0}}}} returns to a HIGH, and the ring counter will proceed to rotate the HIGH level from Q_{0} to Q_{1} to Q_{2} to Q_{3} to Q_{4} continuously, all day, as shown in the timing waveforms.