Cpre 281: Digital Logic: Instructor: Alexander Stoytchev
Cpre 281: Digital Logic: Instructor: Alexander Stoytchev
Cpre 281: Digital Logic: Instructor: Alexander Stoytchev
Digital Logic
http://www.ece.iastate.edu/~alexs/classes/
Counters & Solved Problems
The first flip-flop changes The second flip-flop changes The third flip-flop changes
on the positive edge of the clock on the positive edge of Q0 on the positive edge of Q1
1 T Q T Q T Q
Clock Q Q Q
Q0 Q1 Q2
(a) Circuit
Clock
Q0
Q1
Q2
Count 0 1 2 3 4 5 6 7 0
1 T Q T Q T Q
Clock Q Q Q
Q0 Q1 Q2
Clock
Q0
Q1
Q2
Count 0 1 2 3 4 5 6 7 0
1 T Q T Q T Q
Clock Q Q Q
Q0 Q1 Q2
(a) Circuit
Clock
Q0
Q1
Q2
Count 0 7 6 5 4 3 2 1 0
1 T Q T Q T Q T Q
Q0 Q1 Q2 Q3
Clock Q Q Q Q
(a) Circuit
Clock
Q0
Q1
Q2
Q3
Count 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1
T0= 1
T1 = Q0
T2 = Q0 Q1
[ Table 5.1 from the textbook ]
A four-bit synchronous up-counter
T0= 1
T1 = Q0
T2 = Q0 Q1
[ Figure 5.21 from the textbook ]
In general we have
T0= 1
T1 = Q 0
T2 = Q 0 Q 1
T3 = Q0 Q1 Q2
…
Tn = Q0 Q1 Q2 …Qn-1
Adding Enable and Clear Capability
Inclusion of Enable and Clear capability
Enable T Q T Q T Q T Q
Clock Q Q Q Q
Clear_n
Enable T Q T Q T Q T Q
Clock Q Q Q Q
Clear_n
0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, …
1 Enable
0 D0 Q0
0 D1 Q1
0 D2 Q2
Load
Clock
Clock
(a) Circuit
Clock
Q0
Q1
Q2
Count 0 1 2 3 4 5 0 1
1 T Q T Q T Q
Q0 Q1 Q2
Clock Q Q Q
(a) Circuit
Clock
Q0
Q1
Q2
Count 0 1 2 3 4 5 0 1 2
1 T Q T Q T Q
Q0 Q1 Q2
Clock Q Q Q
Q0
Q1
Q2
Count 0 1 2 3 4 5 0 1 2
What is this?
1
1
1
1
Setting "Clear" to 1,
zeroes both counters.
[ Figure 5.27 from the textbook ]
Zeroing the BCD counter
0
0
0
0
0
1
1
0
0
0
0
0
1
1
Setting "Clear" to 1,
zeroes both counters.
[ Figure 5.27 from the textbook ]
How to zero a counter
0
0
0
0
0
0
0
0 0
0
0 0
0
0 0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
2
0
1
0
0
0
0
0
0
0
3
1
1
0
0
0
0
0
0
0
4
0
0
1
0
0
0
0
0
0
5
1
0
1
0
0
0
0
0
0
6
0
1
1
0
0
0
0
0
0
7
1
1
1
0
0
0
0
0
0
8
0
0
0
1
0
0
0
0
0
9
1
0
0
1
0
0
0
0
0
9
1
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
1
1
0
0
0
0
1
1
0
0
0
Enabling the second counter
2
0
1
0
0
0
1
1
0
0
0
...
Enabling the second counter
8
0
0
0
1
0
1
1
0
0
0
Enabling the second counter
9
1
0
0
1
1
1
1
0
0
0
Enabling the second counter
0
0
0
0
0
0
2
0
1
0
0
Enabling the second counter
1
1
0
0
0
0
2
0
1
0
0
...
Enabling the second counter
8
0
0
0
1
0
9
1
0
0
1
Enabling the second counter
9
1
0
0
1
1
9
1
0
0
1
Enabling the second counter
9
1
0
0
1
1
9
1
0
0
1
1
1
Enabling the second counter
0
0
0
0
0
0
0
0
0
0
0
0
0
Enabling the second counter
1
1
0
0
0
0
0
0
0
0
0
0
0
N-bit ring counter
1000, 0100, 0010, 0001, 1000…….
Reset
• Set start to 1
• Sets output to 1000
N-bit ring counter