You are on page 1of 9

Topic 3 Counters

At the end of this section you should be able to:


Describe the use of feedback to make a D-type flop-flip divide by
two.
Convert a four-bit binary number into decimal or HEX notation.
Desin !-bit up or down counters based on risin ede triered
D-type flip-flops.
Desin !-bit modulo-" counters and draw timin diarams.
Describe the use off a #CD or HEX decoder with a seven
sement display.
Counters
Latches can act as a memory for binary numbers that have been put into them.
Eight flip-flops can act as a memory for an eight-bit word, or a single byte. In
computers, which work with bytes, each eight-bit number stands for something,
be it a letter, a number, or a character, determined by the ASCII code, universal
for all computers.
Counters are special memories that store a word that represents the number of
pulses that have passed into the circuit. The D-type flip-flop is the simplest
counter for bit.
The timing diagram shows the behaviour of the circuit!
Question 1. "hat do you notice about the output compared to the input#
ANSWER
This circuit can count two bits!
"hen the reset is made high, the outputs $ go to give a two bit word %& ''. The
circuit then changes state on the falling edge of the clock pulse, according to the
following table!

Pulse B A
' ' '
'
( '
)
* ' '

The word %& tells us the number of pulses that have arrived. % is the most
significnt bit worth (

+, (-, while & is the !est significnt bit worth (


'
+, -.
.o %& , represents ( / 0 / , ). The timing diagram is like this!
Question " "hat do you notice about the output trace %# ANSWER
#i$ide by " Circuit


&s well as acting as a single bit counter, the circuit above, which is a D-type flip-
flop with feedback, acts as a di$ide by two circuit. If we look at the timing
diagram, we can see that the number of output pulses is half the number of clock
pulses.







Question 3 "hen does the output trace change state# ANSWER
The circuit works like this!
The output $-bar is when $ is '.
1n the first rising edge, $ changes to .
&nd stays there as the clock pulse falls to '.
Then on the ne/t clock pulse, the rising edge causes the output to change
to '.
The output changes every other clock pulse.


%inry nd &e'decim! Counting
2omputers work on binry numbers, which mean numbers to the bse ". "e
normally count in tens, because we have ten digits on our front and hind paws.
This is bse 1( or decim!. "e can count in any base we like. In the 34 the
currency was run on a duodecimal system, counting in base twelve. shilling ,
( old pence5 pound , (' shillings.
"hen we e/press a number, we start off with the most significnt bit at the left
hand side, and the !est significnt at the right. 2onsider the number (*6!
Hundreds Tens Units
Powers of Ten '
(
'

'
'
Number ( * 6
( / '' * / ' 6 /
.o (*6 is the sum of ('' 0 *' 0 6
"e do a similar thing in binry. The least significant bit is (
'
+, -, followed by
(

+, (-, followed by (
(
+, *-, etc. "e will look at a four bit number!
Eight Four Two Units
7owers of
Two
(
)
(
(
(

(
'
8umber '
/ 9 ' / * / ( /
.o ' , 9 0 ' 0 ( 0 , .
Try Question )
2omputer memories are designed to act rather like a set of pigeonholes, or
lockers, in which data is posted. Each location has a uni:ue address, which is
given a number in base ; +, (
*
-, called a *e'decim! or &E+ code.
The first < he/adecimal numbers are like the first < decimal numbers. The
character ' represents decimal ;. .o there have to be alternative characters
for decimal ', , (, ), *, and 6. These are &, %, 2, D, E, and =
respectively. The table shows decimal numbers ' to ; with their four bit binary
and he/adecimal codes!
Decima
l
Four-bit
binary
Hea-
decimal
' '''' '
'''
( ''' (
) '' )
* ''' *
6 '' 6
; '' ;
> ' >
9 ''' 9
< '' <
' '' &
' %
( '' 2
) ' D
* ' E
6 =
; '''' '
The binary code for decimal ; or he/adecimal ' is '''', which is a five bit
number.
&ddress codes of four figures give ;
*
+, ;66);- combinations. In real
computers the addresses can be ;digit codes or even )( digit, which give many
more combinations.
Try Question ,

)-bit Counters
"e can cascade the flip-flops so that we can have as many bits as we want. The
ne/t diagram shows a four bit counter!
This circuit is rising edge triggered, and each flip-flop has its $-bar output fed
back to the data input. The timing diagram shows the idea!
8otice that the unit counter goes through a change every two clock pulses, and
the two?s counter every four pulses. The four?s would be every eight pulses, and
the eight?s every si/teen pulses. If we look at the output of the counter, we would
see it increase by every two clock pulses. This is an up-counter.
Question . "hat is the ma/imum decimal number that this counter can count
to# ANSWER
To make a down-counter, we connect the $-bar output to the 24 input of the
ne/t flip-flop, while the $ output is connected to the data input.

/odu!o N Counters
The *-bit counters we have seen above count from ' to 6 +decimal- before
resetting to @ero. "e say that it is a modu!o 1. counter. The modu!o refers to
the number of states that a counter goes through until it resets to @ero.
& counter with n flip-flops will go through (
n
states before it resets to @ero.
If we want to reset to @ero before that (
n
th state is reached, we need to add an
&8D gate to the circuit and feed the output of the &8D gate to the reset line. The
diagram shows the four bit counter with the &8D gate feeding the reset line!
The counter counts up to binary '' +decimal '-. .ince $ and $) are , the
output of the &8D gate is and that makes the reset line , knocking the counter
back to @ero. This circuit is called a binry coded decim! +%2D- counter. "e
could chose any of the lines. The &8D gate between $( and $) would give us a
modulo ( counter.
Question 0 "hy is the circuit above a Aodulo-( counter# ANSWER
2lick *ere to move on to counter displays.

You might also like