counters - digital logic design (eee 241)€¦ · •other counters •counter with unused states...

24
Counters Lecture # 21 & 22 By : Ali Mustafa

Upload: others

Post on 30-Apr-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Counters

Lecture # 21 & 22

By : Ali Mustafa

Page 2: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Counters

• A register that goes through a prescribed sequence of states upon the application of input pulses is called a counter.

• The input pulses may be clock pulses or they may originated from some external source and may occur at a fixed interval of time or at random.

• A counter that follows the binary number sequence is called a binary counter.

• An n-bit binary counter consists of n flip-flops and can count in binary from 0 through 2^n -1.

Page 3: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Types of Counters

• Ripple counter (asynchronous): – Flip-flop output transition serves as source for triggering the

other flip-flops• Binary Ripple Counter• BCD Ripple Counter

• Synchronous counter: – Common clock for all flip-flops (same design procedure)

• Binary Counter• Up-Down Binary Counter• BCD Counter

• Other Counters• Counter with unused States• Ring Counter• Johnson Counter

Page 4: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

4-Bit Binary Ripple Counter

Page 5: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Count sequence for Binary Ripple Counter

Page 6: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

BCD Ripple Counter

Page 7: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

BCD Ripple Counter

Page 8: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

BCD Ripple Counter

Page 9: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

3 Decade Decimal BCD Counter

Page 10: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Synchronous counters

• Clock pulses are applied to the inputs of all flip-flops

• A common clock triggers all flip-flops simultaneously rather than one at a time as in a ripple counter

Page 11: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

4-Bit synchronous Binary Counter

Page 12: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Up-Down Counter

Page 13: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Binary Counter with Parallel Load

Page 14: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

BCD Counter with T-Flip flop

Circuit can be drawn with four T-FFs, five AND gates & 1 OR gate.

Page 15: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Counter with Unused States• A circuit with n flip-flops has 2n states

– We may have to design a counter with a given sequence (unused states)

– Unused states may be treated as don’t care or assigned specific next state

– Outside noise may cause the counter to enter unused state

– Must ensure counter eventually goes to the valid state

Page 16: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Counter with Unused States

Simplified eq’s are JA = B KA= BJB = C KB = 1JC = B’ KC = 1

Page 17: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Unused states can be don’t cares… • To get the simplest possible circuit, you can fill in don’t cares

for the next states. This will also result in don’t cares for the flip-flop inputs, which can simplify the hardware.

• If the circuit somehow ends up in one of the unused states (110 or 111), its behavior will depend on exactly what the don’t cares were filled in with.

Page 18: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

…or maybe you do care• To get the safest possible circuit, you can explicitly

fill in next states for the unused states 110 and 111. • This guarantees that even if the circuit somehow

enters an unused state, it will eventually end up in a valid state.

• This is called a self-starting counter.

Page 19: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Ring Counter

• It is a circular shift register with only one FF being set at any particular time , others are cleared.

• A ring counter takes the serial output of the last Flip-Flop of a shift register and provides it to the serial input of the first Flip-Flop.

• Ring Counters are also known as re-circulating shift registers.

Page 20: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Ring Counter

Page 21: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Johnson Counter

• A Johnson Counter re-circulates the last flip-flop Q’ output back to the input of the first Flip-Flop. It doesn’t require an initialization value, and will provide a predictable output state sequence.

Page 22: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Re-Circulating Counters

Johnson Counter00001000110011101111011100110001

A 4-bit Johnson counter has a modulus of 8, meaning there are 8 unique output states.

8 unique states

Page 23: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Johnson Counter

Page 24: Counters - Digital Logic Design (EEE 241)€¦ · •Other Counters •Counter with unused States •Ring Counter •Johnson Counter. 4-Bit Binary Ripple Counter. Count sequence for

Self Study

• Revise chapter 6

• Quiz will be taken tomorrow