Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Floyd, Digital Fundamentals, Tenth Edition

C h a pt er 8: C o u n t er s

Experiment 21
The Traffic Signal Controller

Objectives When certain conditions of these variables are met,


the counter advances to the next state. The three input
After completing this experiment, you will be able variables are defined as follows:
to
□ Complete the design of a sequential counter that Vehicle on side street = Vs
is controlled by input variables. 25 s timer (long timer) is on = r L
□ Construct and test the circuit from the first ob- 4 s timer (short timer) is on = Ts
jective.
The use of complemented variables indicates
the opposite conditions. A state diagram, introduced
Materials Needed in the text, is repeated in Figure 21-1 for reference.
Based on this state diagram, the sequential opera-
7408 quad AND gate tion is described as follows:
7474 dual D flip-flop
74121 one-shot 1st state: The counter shows the Gray code 00,
74LS153 dual data selector representing main-green, side-red. It
One 150 (xF capacitor will stay in the first state if the long
Two LEDs timer is on or if therej s no vehicle on
Resistors: two 330 Cl, six 1.0 kft, one to be deter- the side street (r L + Vs). It will go to
the second state if the long timer is off
mined by student
and there is a vehicle on the side street
o rLvs).
Summary of Theory 2nd state: The counter shows 01, representing
main-yellow, side-red. It will stay in the
A synchronous counter forms the heart of many small second state if the short timer is on (Ts).
digital systems. The traffic signal controller intro- It will go to jh e third state if the short
duced in Experiments 13 and 17 uses a small syn- timer is off (Ts).
chronous counter to represent each of the four possi- 3rd state: The counter shows 11, representing
ble “states” that the output can take. The block main-red, side-green. It will stay in the
diagram of the system was given in Figure 13—4. third state if the long timer is on and
Unlike the counters in Experiment 20, the state of the there is a vehicle on the side street
counter in the traffic signal controller is determined (TiVg). It will go to the fourth state if
by three input variables and two state variables. the long timer is off or_there_is no
vehicle on the side street (TL + Vs).

163
T j+ V g this idea to that shown in Experiment 12 for imple-
menting combinational logic with a MUX.
In this experiment, you will design and con-
struct a portion of the system. To make our simula-
tion more realistic, it will be helpful to have the
short timer working. The short timer was con-
structed from a 74121 one-shot in Experiment 17.
The same IC will be used but the trigger connec-
tions will be different since the trigger logic is not
available for this part of the experiment. From the
next-state table, it can be seen that the short timer
should be ON in the second and fourth states (Gray
codes 01 and 10). Triggering will be set up so that
the short timer will trigger on the trailing edge of the
clock, causing it to start in any state. This won’t
matter for this experiment because it is tested only
to move into states 00 and 11. The trailing edge is
used for triggering the short timer because the
outputs change on the leading edge. This avoids a
“race” condition where the clock and states change
FIGURE 21-1 together. The triggering for this experiment is
State diagram. shown in Figure 21-3.
The present state-next state table with input
conditions is shown in Table 21-1 of the report.
4th state: The counter shows 10, representing Each pair of lines in Table 21-1 represents the two
main-red, side-yellow. It will stay in the
fourth state if the short timer is on (Ts).
It will go to first state if the short timer
+5.0 V
is off (T s).
The block diagram in Figure 21-2 further
defines the sequential logic. The input logic block
consists of two data selectors to route the three input
variables (Vs, r L, and Ts) to the flip-flops. This is
shown in more detail in the partially completed
schematic shown in the report. The data selectors
(DS-0 and DS-1) are the 74LS153 chips. The line
selected (C0 through C3) is determined by the
present state (because the flip-flop outputs are con-
nected to the select inputs). Notice the similarity of

+5.0 V
Ts' 2-bit Gray
To state
1L- Input logic decoder
code counter
vs ■
CLK -----------------------
r s : Short timer (4 s)
Tl : Long timer (25 s)
Vs : Vehicle sensor for the side street

FIGURE 21-2
Block diagram of the sequential logic. FIGURE 21-3

164
possible states that the counter could assume. For vehicle sensor, add the sequential logic in Figure
example, on the first pair of lines, the counter is in 21-4. The LEDs serve as state indicators. Connect
the first state (Gray code 00) and could either stay in all inputs in accordance with your design in Step 1.
the first state (Gray code 00) or go to the second Set the pulse generator to 10 kHz.
state (Gray code 01), depending on the long timer 5. The state diagram (Figure 21-1) will guide
and vehicle sensor inputs. Notice that in the first you through the inputs required for the sequence in
state (Gray code 00), the next state for Qx requires order to test the circuit. Start by opening the long
that it remain a 0 no matter what the inputs do, so a timer and vehicle sensor switches (both HIGH).
0 is entered for the product term for data selector-1 Place the counter in the first state (Gray code 00) by
(DS-1). On the other hand, Q0 will be a 1 only if the placing a momentary ground on the CLR inputs. In
long timer is LOW (timed out) and the vehicle this condition, a vehicle is assumed to be on the side
sensor is HIGH (vehicle waiting). Thus, the input street (because Vs is HIGH) but the long timer has not
product term for DS-0 is TLVS. As one more finished the cycle on the main street. Close the long
example, notice that in the second state (Gray code timer switch. This should immediately cause the
01), the next state for Q0 will be a 1 no matter what circuit to go into the second state (Gray code 01),
the inputs do, so a 1 is entered in the table. and the 4 s short timer should take over. While the 4 s
timer is on, open the long timer switch again. The
Procedure circuit should switch by itself (after 4 s) to the third
state (Gray code 11).
1. Review the Summary of Theory to be sure 6. If you successfully arrived in the fourth
you understand the idea for the circuit. The present state (Gray code 10), look at the state diagram and
state-next state table with input conditions is shown decide what steps need to be taken to return to the
in Table 21-1 of the report. Three of the inputs for first state and remain there. Then, use the switches
the data selectors are completed as an example. to move back to the first state. Summarize your
Decide what to do with the remaining inputs and results in the Results and Conclusion section.
complete the remaining five inputs in Table 21-1.
2. From the inputs determined in Step 1, com-
plete the schematic shown in Figure 21^4- of the
report. Show the inputs to each data selector and the
For Further Investigation
enable. Note that the select lines of the data selec- Assume your boss wonders, “Can you simplify the
tors are connected to the outputs of the flip-flops. traffic signal controller if you eliminate the short
3. To simulate the inputs, you could construct timer and make the clock (pulse generator) operate
the one-shots and the oscillator from Experiment at a period of 4 s? Does this have any advantages?
17. However, to save time and board space, con- Also, as a second idea, I noticed you triggered the
struct only the short timer shown in Figure 21-3. short timer without using trigger logic, just the
You will need to compute the value of /?i in order to clock. Could you also trigger the long timer this
make a 4 s timer. Notice that the triggering of the way?”
short timer is different than in the full system for Consider both of these ideas (after all, you
reasons of simplicity. The long timer and vehicle shouldn’t ignore the boss). Indicate the circuit mod-
sensor are made from SPST switches as shown in ifications you would suggest in order to accomplish
Figure 21-3. A “NOTed” variable, such as TL, is as- each. Try putting the first idea into effect by modify-
serted when the switch is closed. ing the circuit and testing it again. Then write a
4. On the same protoboard as the short timer short summary to the boss stating what you think of
and the switches representing the long timer and her idea.

165
Report for Experiment 21
Name: D ate:_____________Class: _

Objectives:
□ Complete the design of a sequential counter that is controlled by input variables.
□ Construct and test the circuit from the first objective.

Data and Observations:

TABLE 21-1

Present State Next State


Input Product Term Input Product Term
Qi Qo Qi Qo Input Conditions for Data Selector-1 for Data Selector-0

0 0 0 0 TL + v s
0 0 0 1 t l vs 0 t l vs

0 1 0 1 Ts
0 1 1 1 Ts 1

1 1 1 1 TiV:s
1 1 1 0 TL + v s

1 0 1 0 Ts
1 0 0 0 Ts

167
DS-1

Q\ Qo
FIGURE 21-4

Results and Conclusion:

Further Investigation Results:

168
Evaluation and Review Questions
1. Why was Gray code selected for the design of the traffic signal controller?

2. What two conditions are required for the counter to stay in the third state (Gray code 11)?

3. Explain what modifications would be needed to make the traffic signal controller cycle through eight
states instead of four states.

4. Suppose you want to build the traffic signal controller using J-K flip-flops instead of D flip-flops. How
should the J and K inputs be connected to allow this change?

5. The B input of the 74121 (Figure 21-3) was connected to a HIGH. Explain why.

6. Assume the traffic signal controller is “locked-up” in the first state (Gray code 00). The light never cycles
to the side street even when a vehicle is present, causing drivers to become extremely annoyed. You test
the vehicle sensor and find that it is HIGH at the input to the 7408 AND gate. Describe the troubleshooting
procedure you would use to identify the problem.

169

You might also like