Beruflich Dokumente
Kultur Dokumente
Counters
8.1 Objectives
To design digital counter circuits using JK-Flip-Flop. To implement counter using 74LS193 IC.
8.2 Introduction
Circuits for counting events are frequently used in computers and other digital systems. Since a counter circuit must remember its past states, it has to possess memory. Flip-flops are introduced and connected to make a counter. The number of flip-flops used and how they are connected determine the number of states and the sequence of the states that the counter goes through in each complete cycle. Counters can be classified into two broad categories: a. Synchronous counters b. Asynchronous counters
Session 8
Counters
Notice that the small delay between the CLK, Q0 and Q1 transitions is not shown in the timing diagram of Figure 8.2.
50
Session 8
Counters
For an asynchronous counter to become an up/down counter the circuit in Figure 8.3 is connected to the clock of each flip-flop (except FF0 of course because it is connected to CLK).
Session 8
Counters
Solution: To count from 0 to 15 there is 16 states which mean 4 flip-flops are needed. By default when designing asynchronous counters, all flip-flop inputs are connected to 1 and only the first flip-flop is trigger with a clock input. By inspecting Table 8.2, Q1 is toggled when Q0 changes from1 to 0. Q2 is toggled when Q1 changes from 1 to 0. Q3 is toggled when Q2 changes from 1 to 0.
For synchronous counter, the design procedure is the same procedure of designing using flip-flops, starting from the state diagram and ending with the logic circuit.
Example 8.2 Design a logic circuit that counts from 0 to 4 then back to 0 only if an input signal is 1. Use synchronous counter. Solution: Step one: Figure 8.5 shows the state diagram.
Figure 8.5: Example 8.2 state diagram 405312: Digital Logic and Digital Electronics lab. 52
Session 8
Counters
Step two and three: The state and excitation tables are shown in table 8.3. Table 8.3: State and excitation tables of Example 8.2. Current state Q1 0 0 0 0 1 1 1 1 Q0 0 0 1 1 0 0 1 1 Input U 0 1 0 1 0 1 0 1 Next state Q1+ 0 0 0 1 1 1 1 0 Q0+ 0 1 1 0 0 1 1 0 Flip flop 1 J1 0 0 0 1 X X X X K1 X X X X 0 0 0 1 Flip flop 0 J0 0 1 X X 0 1 X X K0 X X 0 1 X X 0 1
53
Session 8
Counters
Figure 8.7: K-map for K0 in Example 8.2. K0= U Notice that even though the implementation is with JK flip-flop the result is that K0=J0 then it is a T flip-flop.
54
Session 8
Counters
55
Session 8
Counters
Pre-Lab 8
1- Design a synchronous counter that counts from 0 to 7 if an input R is high and from 7 to 0 if the input R is low.
You are required to draw the state diagram, the state table, the excitation table. Then to obtain the inputs to the flip-flops (J1, K1, J2, and so on). But you are NOT required to draw the counter logic circuit.
Lab Work 8
Use the synchronous 4-bit counter IC 74ls193 and 3*8 decoder IC 74ls138 to implement a counter that counts from 2 to 5.
Homework 8
1. Design a 2 bit asynchronous up counter using the JK flip flop shown in Figure 8.10 (take care that the flip flop has a rising edge clock).
2. Using the 74193 4-bit counter you used during your lab work, design an up counter that counts from 2 to 12. To detect the presence of 12, you may use active low 3*8 decoder.
56
Session 8
Counters
Figure 8.11: 74193 up down counter. 3. Using the 74193 4-bit counter you used during your lab work, design an up/down counter that will count up if an input X is 1 and will count down if X is 0. You can use ON LY one clock for both the COUNT UP and the COUNT DOWN terminals.
57