Chapter 1: Further Sequential Logic Systems Synchronous Counters
Chapter 1: Further Sequential Logic Systems Synchronous Counters
Learning Objectives:
Synchronous counters based on D-type flip-flops differ from ripple counters and dedicated synchronous
counter ICs in that:
• they can produce any sequence of output signals (and so are also known as sequence generators),
whereas ripple counters can count only up or down in binary
• the clock inputs of all stages of the counter are connected together and so receive clock pulses at
exactly the same time (which is why they are called synchronous)
• logic gates generate appropriate signals at the data inputs of each stage.
In ripple counters, the clock signals move through the system, stage by stage, and so it takes time for
the last stage to react to a pulse received at the first stage. This causes inaccuracy when the counter is
counting at high speed. There is no such problem with the synchronous counter, because all stages receive
the clock signal at the same time and so react at the same time.
The following diagram shows a basic 3-bit synchronous counter, constructed from D-type flip-flops:
(The set and reset inputs of the D-types have been omitted to improve the clarity of the diagram.)
The first step is to formalise the required sequence of output states into either:
a table showing how one set of outputs creates the next input states
•
a state diagram, or equivalent, showing the progression of output states as a visual representation
•
of the sequence
or
• Boolean expressions, showing the relationships between output and input states in the form of
Boolean equations.
This means that we need a logic system, attached to the data input DC of the first flip-flop, which:
Inputs DB and DA need their own logic systems to carry out similar tasks.
In this example, it is easiest to start with the DA signal. Compare the DA column and the ‘A’ output column in
the table.
We do not need much of a logic system. DA is always the opposite of output A.
In other words:
DA = A
We do not need any logic gates for the DA input, as the third D-type flip-flop has an output, the Q output,
which gives us the inverse of output A.
The other two logic systems, for the DB and DC input are more complicated.
In general, Karnaugh maps may be needed to sort out the Boolean expressions.
For DB:
and so:
DB = B.A + B.A
For DC:
An important point
When the system is powered up, it can start in any of the eight states. However, in this system, no matter
where it starts, it then counts up in binary from that point and resets when it reaches 1112. It could be forced
to start at 0002 by linking together the Reset inputs of the D-type flip-flops and activating them briefly when
the system powers up.
This system is a little unusual in that the required sequence, called the main sequence, includes all
possible states. In many cases, some of the possible states are unused. This can cause problems, as
shown in the next example.
State LEDs
number C B A
0 Off Off Off
1 Off Off On
2 Off On Off
3 On Off Off
Finally, the same specification shown as a state diagram for the main sequence (but not any unused
states).
It assumes that a LED is on when a logic 1 signal is applied, and off when logic 0 is applied.
Unused states:
The synchronous counter will drive the three LEDs in the correct sequence. It will have three digital outputs,
which means that there are eight (= 23) possible combinations of these outputs. The main sequence uses
only four of these – 000, 001, 010 and 100. This means that there are four unused states – 011, 101, 110
and 111.
As pointed out earlier, the system can output any of the eight states when it is first switched on. We have
to design the counter so that even if, on power-up, it starts in an unused state, it will eventually progress
onto the required sequence.
We complete the state diagram by showing how the system will deal with the unused states. One possible
solution, but rarely the best, is to link all the unused states to state S0, the 000 state. This is shown in the
next diagram:
Suppose that the system starts in an unused state, say state S4, and outputs 011.
When the first clock pulse arrives, the system moves to the S0 state, in the main sequence. After that, the
next clock pulse moves the system to the S1 state, and after that it continues through, and is locked into,
the main sequence.
DC = C.B.A
DB = C.B.A
DA = C.B.A
The drawback of connecting all unused states to the 000 state is that usually the solution leads to Boolean
expressions and logic systems that are more complicated.
While the expressions above are not excessively complicated, the design can be simplified by linking the
unused states in a different way (they are unused, so we can do what we like with them as long as they
lead into the main sequence). We consider how this can be done later on.
Stuck states:
Stuck states are unused states that do not progress into the main sequence.
Careless design of a system can lead to a situation where, on power-up, the system locks in an unused
state, and never progresses to the main sequence.
The next state diagram shows the same main sequence that was used earlier but with a different, undesira-
ble arrangement of unused states:
Now, when you switch on the system, there is a chance that it starts in either state S4 or S5. If so, as the
three D-type clock inputs receive pulses, the outputs simply alternate between the 011 and 101 states.
They never reach the main sequence. These are known as stuck states.
Exercise 1.1
Draw a state diagram for this system, taking care to avoid stuck states.
In an industrial plant, a liquid is added to a drum and then stirred. After sufficient time, the drum is emptied.
The sequence of operations is:
To design the counter, first we turn the description of the sequence of events into a truth table for the main
sequence. Assume that a logic 1 signal turns a device on and logic 0 turns it off (check that the contents of
the table match the description above).
Not all possible combinations are used in the sequence. These unused states are ‘don’t care’ states. They
never happen in practice and so it doesn’t matter where they go (as long as they lead into the main
sequence).
State Current state Next state
number Pump C Motor B Valve A DC DB DA
0 0 0 0 1 0 0
1 1 0 0 1 1 0
Main
2 1 1 0 0 1 0
Sequence
3 0 1 0 0 0 1
4 0 0 1 0 0 0
5 0 1 1 X X X
Unused
6 1 0 1 X X X
States
7 1 1 1 X X X
X = Don’t care
Next, we work what logic gates are needed by looking at the Boolean relationships between outputs and
inputs, ignoring the unused states. Once we decide what these relationships are, we use them to determine
the fate of the three unused states.
1. Look at the DB column. It is identical to the ‘Pump C’ column. Hence, the relationship:
DB = C
2. The DC column has logic 1 entries only in the rows where ‘Motor B’ and ‘Valve A’ are both logic 0.
We can specify this relationship as:
DC = B . A
3. The DA column has a logic 1 entry only in State 3, which is the only time that ‘Motor B’ = 1 and
‘Pump C’ = 0 in the main sequence.
We can specify this relationship as:
DA = C . B
We obtained these relationships by inspection. It is advisable to check them using Karnaugh maps (we use
this approach later, in example 2).
Having the Boolean expressions, we return to the question of the unused states. These Boolean expres-
sions apply to both the unused states and the main sequence.
Including the results for the unused states, the full truth table for the control system is:
State Current state Next state
number Pump C Motor B Valve A DC DB DA
0 0 0 0 1 0 0
1 1 0 0 1 1 0
2 1 1 0 0 1 0
3 0 1 0 0 0 1
4 0 0 1 0 0 0
5 0 1 1 0 0 1
6 1 0 1 0 1 0
7 1 1 1 0 1 0
The state diagram for this system will identify whether there are any stuck states:
As you can see, all unused states lead into the main sequence. If the control system powered up in an
unused state, it would progress onto the main sequence in the next clock cycle.
However, it does mean that the main sequence can start at any point. In practice, this may be a problem.
Where it is important that the sequence always starts in the 000 state, the reset pins of the D-types can be
linked to a ‘Start Process’ switch.
Example 2:
Another industrial process uses three devices connected to outputs C, B and A of a synchronous counter.
The sequence of operations defined in the following table:
There are three unused states, leading to ‘don’t care’ states, marked with an X.
Notice that three of the boxes contain ‘don’t care’ states, shown by ‘X’. We can choose to make these either
logic 0 or logic 1, in order to make the Boolean algebra and the electronics easier to implement. In this case
we will make the ‘don’t care’ state in the top right hand corner into a 1 and make the other two ‘don’t cares’
into 0’s.
The map becomes:
Here, we have converted all the ‘don’t care’ states into logic 1’s to give:
DB = C + A
In this case we have converted the ‘don’t care’ state in the top right hand corner into logic 0 and the other
two into logic 1 to give:
DA = C + B
Then, we apply the Boolean expressions for DA, DB and DC to find the corresponding ‘Next state’ values and
check that there are no stuck states.
Now complete the example by drawing the state diagram and circuit diagram for this system:
State diagram
Circuit diagram
When it is important that the sequence starts in a particular state, the ‘Set’ pins of the D-types can be linked
to a ‘Start Process’ switch.
For example, to start in state 0 (0,0,1) the ‘Start Process’ switch would trigger the ‘Set’ input
on D-type flip-flop A momentarily.
Although the first method is more direct, it requires you to spot a Boolean expression from a column of 0’s
and 1’s.
The second method takes longer but has a more visual approach.
We return to the first of the LED light chasers, on page 6, to redesign the solution. This time, we make
better use of unused states in order to produce a simpler solution.
In the following truth table, the unused, or ‘don’t care’, states are marked with an X.
State Current state of LEDs Next state of LEDs
number C B A DC DB DA
0 0 0 0 0 0 1
Main 1 0 0 1 0 1 0
sequence 2 0 1 0 1 0 0
3 1 0 0 0 0 0
4 0 1 1 X X X
Unused 5 1 0 1 X X X
states 6 1 1 0 X X X
7 1 1 1 X X X
Karnaugh maps enable us to sort out the Boolean algebra.
Here is the map for DC, showing the ‘don’t care’ states:
We can convert the ‘X’s into 0’s and 1’s to give us a simple solution:
DC = B
DB = A
DA = C+B+A
These are then the expressions produced earlier, when all unused states were connected directly to S0.
The truth table is now:
Current state of LEDs Next state of LEDs
State
C B A DC DB DA
0 0 0 0 0 0 1
Main 1 0 0 1 0 1 0
sequence 2 0 1 0 1 0 0
3 1 0 0 0 0 0
4 0 1 1 1 1 0
Unused 5 1 0 1 0 1 0
states 6 1 1 0 1 0 0
7 1 1 1 1 1 0
Investigation 1.1
Set up the following synchronous counter on Circuit Wizard using three CMOS 4013 D-types. Outputs A, B
and C are connected to logic indicators.
At the start of the simulation, all three logic indicators should be green (logic 0).
(a) Press the clock switch SW1 several times and record your result in the truth table below.
State Current state Next state
number C B A DC DB DA
0 0 0 0
1
2
3
4
(b) Compare the sequence with that obtained in example 1 on page 9.
(c) Momentarily press the set switch SW2 and comment on what you observe.
(d) Momentarily press switch SW1 and explain what has happened.
Exercise 1.2
1. A sequence generator is needed to provide signals for a lighting display control system.
State
C B A DC DB DA
number
5 0 0 1 0 1 1
6 1 0 0 1 1 1
7 1 1 0 1 1 1
(a) Complete the first table to show the inputs DC, DB and DA needed to generate the sequence.
(b) Determine Boolean expressions for DC, DB and DA in terms of outputs C, B and A (simplify the
expressions as much as possible, using the rules of Boolean algebra or Karnaugh maps).
DC =
DB =
DA =
2. Design a synchronous counter that will produce the following ‘light chaser’ effect:
Circuit diagram:
3. Design a synchronous counter that will count up in binary from 0002 to 1002, and then, on the next
clock pulse, reset to 0002.
Your design should include:
• a truth table and state diagram showing both the main sequence and the unused states
• the circuit diagram.
It should manipulate the unused states to produce the simplest solution.
State Current state Next state
number C B A DC DB DA
0
1
2
3
4
5
6
7
State diagram:
Circuit diagram:
Example 1:
Step 1:
Write down Boolean expressions for inputs DC, DB and DA in terms of outputs C, B and A.
In this case:
DC = C.B.A
DB = C
DA = C + B
Step 2:
Use these relationships to complete the truth table to show the sequence of output states (unless told
otherwise, we start at the ‘000’ state, and see what happens).
In this case, the ‘000’ state was part of the main sequence.
We know when the main sequence comes to an end because it returns to the first state we looked at.
Altogether there are four states in the main sequence, and four unused states.
Step 3:
Check whether any of the unused states are stuck states. To do this, use the truth table to create the state
diagram.
We can now see that the system functions without any risk of stuck states.
Example 2:
DC = C
DB = B . A
DA = C ⊕ B
Step 2:
Use these relationships to complete the truth table to show the sequence of output states.
Current state Next state
State
C B A DC DB DA
0 0 0 0 1 0 0
1 1 0 0 0 0 1
2 0 0 1 1 1 0
3 1 1 0 0 0 0
4 0 1 0 1 0 1
5 1 1 1 0 0 0
6 0 1 1 1 0 1
7 1 0 1 0 1 1
The first four states make up a sequence, presumably the main sequence.
States 4, 5, 6 and 7 are, we assume, the unused states.
Now use the truth table to draw the state diagram for this system:
Problem
Only one unused state, state 5, leads into the main sequence. If the system powers up in states 4, 6 or 7, it
can never progress into the main sequence. These three are stuck states.
This problem can be overcome by redesigning the circuit for the sequence generator:
• firstly replace all the next state outputs in the truth table with X’s (don’t cares)
• convert the ‘X’s into 0’s and 1’s to give the simplest solution
• draw the state diagram to check that the stuck states have been removed
• draw the modified circuit diagram.
DC = C
DB = A
DA = C. B
Example 3:
DC = A
DB = A ⊕ C
DA = B.C
Step 1:
Step 2:
Use these relationships to complete the truth table to show the sequence of output states (again, we start
at the ‘000’ state, and see what happens).
(i) The table to show the main sequence produced by the sequence generator.
Step 3:
Exercise 1.3
(a) Obtain the Boolean expressions linking the inputs and outputs;
DC = DB = DA =
(b) Complete the truth table (hint – there are four states in the main sequence).
DA = A
DB = B ⊕ A
DC = B ⊕ A
(a) Complete the circuit diagram for this sequence generator by adding:
• correct clock connections for the three D-type flip-flops
• logic gates to provide the required input signals for the D-type flip-flops.
(b) Complete the truth table to show the main sequence of states. (You should find that it
contains only four states.)
(c) Identify the four unused states, and for each one, show into which state the unused state will
lead.
State Current state Next state
number C B A DC DB DA
4
5
6
7
(d) Hence draw the state diagram for this sequence generator.
3. (a) Why are synchronous counters more suitable than ripple counters for counting high
frequency pulses?
(iv) Why is it important to avoid stuck states when designing synchronous counters?
4. The state diagram shows the main sequence of a 3-bit synchronous counter.
5. A student designs a light-chaser effect, based on a synchronous counter, for a model car. Part of the
circuit diagram is shown below:
……………………………………………………………………………………………..
……………………………………………………………………………………………..
……………………………………………………………………………………………..
(b) Write down Boolean expressions for the inputs DA, DB and DC in terms of the outputs A, B
and C.
DA = ……………………………………………….
DB = ……………………………………………….
DC = ……………………………………………….
(c) Use these Boolean expressions to complete the table, showing the main sequence of output
states that this system will generate and the unused states.
You should find there are only three states in the main sequence.
(e) There is a serious defect with the design of this sequence generator.
(i) Explain what this defect is, and why it might cause a problem.
(ii) Redraw the state diagram showing how to overcome this defect, without changing
the main sequence.