1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

61
1 Chapter 7 Counters and Registers

Transcript of 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

Page 1: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

1

Chapter 7 Counters and Registers

Page 2: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

2

7-1 Asynchronous(ripple)counters

Page 3: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

3

Asychronous Counters(Cont.)

• Each FF output drives the CLK input of the next FF. • FFs do not change states in exact synchronism with

the applied clock pulses.• There is delay between the responses of successive

FFS.• It is also often referred to as a ripple counter due

to the way the FFs respond one after another in a kind of rippling effect.

Page 4: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

4

Signal Flow

• It is conventional in circuit schematics to draw the circuits(whenever possible) such that the signal flow is from left to right, with inputs on the left and outputs one the right.

• In this chapter, we will often break with this convention, especially in diagrams showing counters.

Page 5: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

5

Example

• The counter in Figure 7-1 starts off in the 0000 state, and then clock pulses are applied. Some time later the clock pulses are removed, and the counter FFs read 0011. How many clock pulses have occurred?

Page 6: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

6

Example

• The counter in Figure 7-1 starts off in the 0000 state, and then clock pulses are applied. Some time later the clock pulses are removed, and the counter FFs read 0011. How many clock pulses have occurred?

Answer:3 or 19 or 163

N*16 + 3 (N is unknown)

Page 7: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

7

MOD Number

• The counter in Figure 7-1 has 16 distinct states, thus, it is a MOD-16 ripple counter.

• The MOD number can be increased simply by adding more FFs to the counter. That is– MOD number = 2N

• Example– A counter is needed that will count the number of

items passing on a conveyor belt. A photocell and light source combination is used to generate a single pulse each time an item crosses its path. The counter must be able to count as many as one thousand items. How many FFs are required?

Page 8: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

8

Frequency division

In any counter, the signal at the output of the last FF(i.e., the MSB) will have a frequency equal to the input clock frequency divided by the MOD number of the counter. Such circuits are known as divide-by-N counters.

Page 9: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

9

Example

• The first step involved in building a digital clock is to take the 60-Hz signal and feed it into a Schmitt-trigger, pulse-shaping circuit to produce a square wave as illustrated in Figure 7-3. The 60HZ square wave is then put into a MOD-60 counter, which is used to divide the 60-HZ frequency by exactly 60 to produce a 1-HZ waveform. This 1-HZ waveform is fed to a series of counters, which then count seconds, minutes, hours, and so on. How many FFs are required for the MOD-60 counter?

Page 10: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

10

Page 11: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

11

Review Questions

• True or False: In an asychronous counter, all FFs change states at the same time.

• Assume that the counter in Figure 7-1 is holding the count 0101. What will be the count after 27 clock pulses?

• What would be the MOD number of the counter if three more FFs were added?

Page 12: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

12

7-2 Counters with MOD NUMBER < 2N

MOD-6 counter produced by clearing a MOD-8 counter when a count of six occurs.

Page 13: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

13

State Transition Diagram

Page 14: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

14

Example

• What will be the status of the LEDs when the counter is holding the count of five?

• What will the LEDs display as the counter is clocked by a 1-kHz input?

• Will the 110 state be visible on the LEDs?

Page 15: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

15

Changing the MOD number

Determine the MOD number of the counter in Figure 7-6(a). Also determine the frequency at the D output

Page 16: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

16

Changing the MOD number

Construct a MOD-10 counter that will count from 0000(zero) through 1001(decimal 9)

Page 17: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

17

Decade Counters/BCD counters

• Decade counter– Any counter has 10 distinct states, no matter

what the sequence.• BCD counter

– A decade counter counts in sequence from 0000(zero) through 1001(decimal 9).

Page 18: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

18

Example

• Construct an appropriate MOD-60 counter.

Page 19: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

19

Review Questions

• What FF outputs should be connected to the clearing NAND gate to form a MOD-13 counter?

• True of False: All BCD counters are decade counters.

• What is the output frequency of a decade counter that is clocked from a 50-KHz signal?

Page 20: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

20

7-3 IC Asynchronous counters

Page 21: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

21

Example

• Show how the 74LS293 should be connected to operate as a MOD-16 counter with a 10-kHz clock input. Determine the frequency at Q3.

Page 22: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

22

Example

• Show how to wire the 74LS293 as a MOD-10 counter

Page 23: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

23

Example

• Show how to wire a 74LS293 as a MOD-14 counter

Page 24: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

24

Example

• A way to get a MOD-60 counter is shown below. Explain how this circuit works.

Page 25: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

25

Review Questions

• A 2-kHz clock signal is applied to of a 74LS293. What is the frequency at Q3?

• What would be the final output frequency if the order of the counters were reversed in Figure 7-12?

• What is the MOD number of a 74HC4040 counter?• What would the notation “DIV64” mean on a counter

symbol?• Which outputs would you connect to an AND gate to

convert the 74HC4024 to a MOD-120 counter?

1CP

Page 26: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

26

7-4 Asychronous Down counter

Page 27: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

27

Review Questions

• What is the difference between the counting sequence of an up counter and a down counter?

• Describe how an asynchronous down-counter circuit differs from an up-counter circuit.

Page 28: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

28

7-5 Propagation delay in ripple counters

Page 29: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

29

Discussion on Ripple Counter

• For proper counter operation, we need

pdclock tNT

Asychronous counters are not useful at very high frequencies, especially for large number of bits.

Another problem caused by propagation delays in asychronous counters occurs when the counter outputs are decoded, as is discussed later.

Page 30: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

30

Review Questions

• Explain why a ripple counter’s maximum frequency limitation decreases as more FFs are added to the counter.

• A certain J-K flip-flop has tpd=12 ns. What is the largest MOD counter that can be constructed from these FFs and still operate up to 10 MHz?

Page 31: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

31

7-6 Synchronous(Parallel) counters

• Synchronous(parallel) counters– All of the FFs are triggered simultaneously by

the clock input pulses.– Overcome the problem caused by FF propagation

delay.

Page 32: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

32

Circuit operation

Only those FFs that are supposed to toggle on that NGT should have J=K=1 when that NGT occurs.

Page 33: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

33

Advantage of Synchronous counters over Asychronous

• States are changed simultaneously.– Total delay

• FFtpd+ANDgate tpd

• Actual Ics– 74ALS160/162, 74HC160/162: Synchronous decade

counters– 74ALS161/163, 74HC161/163: Synchronous MOD-16

counters

Page 34: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

34

Example

• Determine fmax for the counter of Figure 7-17(a) if tpd for each FF is 50ns and tpd for each AND gate is 20 ns. Compare this value with fmax for a MOD-16 ripple counter.

• What must be done to convert this counter to MOD-32?• Determine fmax for the MOD-32 parallel counter.

Page 35: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

35

Review Questions

• What is the advantage of a synchronous counter over an asynchronous counter? What is the disadvantage?

• How many logic devices are required for a MOD-64 parallel counter?

• What logic signal drives the J,K inputs of the MSB flip-flop for the counter of question 2?

Page 36: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

36

7-7 Synchronous Down and UP/Down counters

Page 37: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

37

Example

• What problems might be caused if the UP/Down signal changes levels on the NGT of the clock?

Page 38: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

38

Presettable counters

Page 39: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

39

Synchronous Presetting

• Examples of IC counters – 74ALS160, 74ALS161, 74ALS612, 74ALS163– 74Hc160, 74HC161, 74HC162, 74HC163

Page 40: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

40

Review Questions

• What is meant when we say that a counter is presettable?

• Describe the difference between asynchronous and synchronous presetting.

Page 41: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

41

The 74ALS193/HC193

Page 42: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

42

Example

Page 43: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

43

Example

Page 44: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

44

Variable MOD Number using the 74ALS193/HC193

Page 45: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

45

Multistage Arrangement

Page 46: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

46

Review Questions

• Describe the function of the input PL and P0 to P3.

• Describe the function of the MR input• True or False: The 74HC193 cannot be preset while MR

is active.• What logic levels must be present at CPD, PL and MR

in order for the 74ALS193 to count pulses that appear at CPU?

• What would be the maximum counting range for a four-stage counter made up of 74HC193 Ics?

Page 47: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

47

7-11 Decoding a counter

• Mentally decoding the binary states of the LEDs– Becomes inconvenient as the size of the counter

increases• Electronically decoding

– To control the timing or sequencing of operations automatically without human intervention.

– Active-High Decoding– Active-Low Decoding– BCD counter decoding

Page 48: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

48

Active-High Decoding

Page 49: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

49

Example

• How many AND gates are required to decode completely all of the states of a MOD-32 binary counter? What are the inputs to the gate that decodes for the count of 21?

Page 50: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

50

Active-LOW Decoding

Page 51: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

51

BCD Counter Decoding

Page 52: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

52

Review Questions

• How many gates are needed to decode a six-bit counter fully?

• Describe the decoding gate needed to produce a LOW output when a MOD-64 counter is at the counter of 23.

Page 53: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

53

7-12 Decoding Glitches

Page 54: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

54

Strobing

Page 55: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

55

Review Questions

• Explain why the decoding gates for an asynchronous counter may have glitches on their outputs.

• How does strobing eliminate decoding glitches?

Page 56: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

56

Cascading BCD counters

Page 57: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

57

7-15 Shift-Register Counters

Page 58: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

58

Starting a Ring Counter

Page 59: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

59

Johnson Counter

Page 60: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

60

Decoding A Johnson Counter

Page 61: 1 Chapter 7 Counters and Registers. 2 7-1 Asynchronous(ripple)counters.

61

Review Questions

• Which shift-register counter requires the most FFs for a given MOD number?

• Which shift-register counter requires the most decoding circuitry?

• How can a ring counter be converted to a Johnson counter?• True or False:

– The outputs of a ring counter are always square waves.– The decoding circuitry for a Johnson counter is simpler

than for a binary counter– Ring and Johnson counters are synchronous counters.

• How many FFs are needed in a MOD-16 ring counter? How many are needed in a MOD-16 Johnson Counter?