counters - digital logic design (eee...

24
Counters Lecture # 21 & 22 By : Ali Mustafa

Upload: others

Post on 12-May-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Counters

Lecture # 21 & 22

By : Ali Mustafa

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.

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

4-Bit Binary Ripple Counter

Count sequence for Binary Ripple Counter

BCD Ripple Counter

BCD Ripple Counter

BCD Ripple Counter

3 Decade Decimal BCD Counter

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

4-Bit synchronous Binary Counter

Up-Down Counter

Binary Counter with Parallel Load

BCD Counter with T-Flip flop

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

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

Counter with Unused States

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

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.

…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.

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.

Ring Counter

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.

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

Johnson Counter

Self Study

• Revise chapter 6

• Quiz will be taken tomorrow