You are on page 1of 55

Adding Binary Numbers

Half and Full Adders


Digital computers are able to use logical
functions to perform arithmetic operations.
The basis of this is ADDITION
How do we add two Binary Numbers?

Addition of two binary bits


Since there are only 1s and 0s, there are
only four possible combination of inputs.
0+0 = 0 0+1= 1
1+0 = 1 1+1 =10
1 + 1 = 10 indicates that we must account
for two output bits: the sum and possible
carry.

INPUTS OUTPUTS
A B CARRY SUM
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
HALF ADDER CIRCUITS
LIMITED WHEN WE
HAVE MULTIBITS INPUTS OUTPUTS
A B CARRY SUM
0 0 0 0
0 1 0 1
1 0 0 1

1 1 1 0
HALF ADDER (1, 1)
HALF ADDER (1,0)
FULL ADDER
A full adder is a logical circuit that
performs an addition operation on three
binary digits. The full adder produces a
sum and carry value, which are both binary
digits
INPUTS OUTPUTS
A B C C S
IN OUT
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
THE OUTPUT TO THE 1 1 0 1 0
OR GATE IS NOT THE 1 1 1 1 1
SUM
Full adder (1, 0, 1)
Full adder (1, 1, 1)
Question to try

I1

Two half adders are connected as shown to form a full


adder.
Draw a table to show the outputs at points P, Q, R and S for
the following states
A) I =1, I = 0, I =1
1 2 3 B) I =1, I = 1, I =1
1 2 3
Tips to keep close
All combinations resulting in one
(100, 010, 001) produce a high at the sum
output.
All combinations resulting in two
(011, 101, 110) produce a high carry out
and a low sum.
(111) gives high carry and high sum
Adders can be made from two NORs and
an AND (prove this for yourself)
Memory relies on the concept called
feedback. That is, the output of a gate is
fed back into the input. The simplest
possible feedback circuit using two
inverters is shown below:

If Q happens to be 1, it will always be 1. If it


happens to be 0, it will always be 0.
FLIP FLOPS or Bistables
One of the most interesting things we can do
with logic gates is to create memory with
them.
If you arrange the gates correctly, they will
remember an input value. This simple
concept is the basis of RAM (random
access memory) in computers, and also
makes it possible to create a wide variety
of other useful circuits.
If A is connected to the 6 V supply-X goes
high, Y and Z goes low and W goes high
(i.e. the lamp L1 is off and L2 lights)
If A is now disconnected, L1 remains off
and L2 remains on. The state is stable.
The only way that the state can be
changed is by making input B high.
If Input B is high-Z is now high, W and X
low and Y high. L2 is off and L1 is on.
Buzzer System for quiz team

Light will show which team first presses the


buzzer-but the other teams light should not
come on.
If Oxford presses first, its switch
disconnects W from the 6V line, making it
low-Both inputs to N1 are low and the
Oxford lamp lights.
Check to see that if Cambridge presses
the buzzer after their lamp will NOT light.
FLIP-FLOPS

Memory device capable of storing one


bit
S Q Memory means circuit remains in one
state after condition that caused the
R Q state is removed.
Two outputs designated Q and Q-Not
that are always opposite or
complimentary.
When referring to the state of a flip flop,
referring to the state of the Q output.
R-S FLIP-FLOP

Symbols:
Set Normal
S Q

FF

R Q
Reset Comple-
mentary
Another useful feedback circuit using two NAND gates
is shown above.
The inputs R and S are called Reset and Set
respectively and the outputs Q and Q are
complements of each other (i.e. If Q =0, then Q=1)
SR flip Flop
An SR Flip Flop is an arrangements of
logic gates that maintains a stable output
even after the inputs are turned off. This
simple flip flop circuit has a set input (S)
and a reset input (R). The set input causes
the output of 0 (top output) and 1 (bottom
output). The reset input causes the
opposite to happen (top = 1, bottom =0).
Flip Flops
Once the outputs are established, the
wiring of the circuit is maintained until S or
R go high, or power to the circuit is turned
off.
This is a simple model of how a bit of RAM
can be perpetuated
S=1
R=1
-The flip flops that uses S (set) and R (reset)
are simply called SR flip-flop or SR latch.
-It is sometimes called a latch due to its
ability to latch onto data.
-The flip flop can be made from two NAND
gates or two NOR gates.
-Flip flop circuits will only remember stuff
while power remains in the circuit.
Flip flops from NOR gates
One problem with the basic RS NOR latch is
that the input signals actively drive their
respective outputs to a logic 0, rather than to
a logic 1. Thus, the S input signal is applied to
the gate that produces the Q' output, while the
R input signal is applied to the gate that
produces the Q output.

S R Q Q
0 0 STA BLE
1 0 1 0
0 1 0 1
1 1 AVO ID
FLIP FLOPS FROM NAND
GATES
Stop-Go Traffic Lights
Either the red is on
or the green light is
on, but not both
together
USES OF FLIP FLOP
A fire alarm
which, once
triggered, will
continue to sound
until it is reset.

Remember 0,0 is
not allowed!!
Clock
Digital signal in the form of a rectangular or
square wave

Astable
multivibrator

A clocked flip flop changes state only when


permitted by the clock signal
TRIGGERING OF FLIP-FLOPS

Level-triggering is the transfer of data from input to output of


a flip-flop anytime the clock pulse is proper voltage level.

Edge-triggering is the transfer of data from input to output


of a flip-flop on the rising edge (L-to-H) or falling edge (H-
to-L) of the clock pulse. Edge triggering may be either
positive-edge (L-to-H) or negative-edge (H-to-L).
NGT-Negative Going Transition
PGT-Positive Going Transition
Negative-edge triggering
Positive-edge triggering

L
time
Level triggering
Clocks and synchronization
A clock is a special device that whose output
continuously alternates between 0 and 1.

clock period

The time it takes the clock to change from 1 to 0 and back to 1 is called the clock
period, or clock cycle time.
The clock frequency is the inverse of the clock period. The unit of measurement for
frequency is the hertz.
Clocks are often used to synchronize circuits.
They generate a repeating, predictable pattern of 0s and 1s that can trigger certain events in
a circuit, such as writing to a latch.
If several circuits share a common clock signal, they can coordinate their actions with
respect to one another.

This is similar to how humans use real clocks for synchronization .


Flip-flops
Triggered Bistable
Flip-flops can be either simple
(transparent) or clocked.
The operation of a binary counter
depends on the triggered bistable. The
state can be triggered by connecting
either inputs to the power source or by a
series of pulses which are fed to the
trigger.
The module then directs each of these
pulses in turn to each of the inputs so that
the state of the bistable can be switched.
Some flip-flops change output on the rising
edge of the clock, others on the falling
edge.
Toggle flip-flops (T flip-flops)
If the T input is high, the T flip-flop changes
state ("toggles") whenever the clock input
is strobed. If the T input is low, the flip-flop
holds the previous value.

A circuit symbol for a T-type flip-


flop, where > is the clock input,
T is the toggle input and Q is
the stored data output.
Diagram shows how three such triggered
bistable modules may be used to count up
to 7. It triggers on the trailing edge of the
pulse.
Initially the bistable is set so that each of
the outputs Q1, Q2 and Q3 are low.
Q1, Q2 and Q3 will all be high.
Then the pulses are applied.
On the trailing edge of the first pulse, X X
1 1,

the first module will trigger and Q1


becomes high.
However the second module does not
trigger since there is now the leading edge
of a pulseY Y going to the trigger.
1 1

So after one pulse L1 is on, L2 is off and


L3 is off.
This corresponds to binary state 001
After the second pulse the first module
triggers again on the trailing edge X X
2 2

Now Q1 drops back to a low state but the


second module is triggered by the trailing
edge, Y Y of the pulse from Q1 and Q2
2 2

therefore goes high.


The binary state after 2 pulses is 010
The results are tabulated below. Check
to ensure that you get the results
shown below.
No. of Pulses L1 L2 L3 Binary State
Units Twos Fours

0 OFF OFF OFF 000

1 ON OFF OFF 001

2 OFF ON OFF 010

3 ON ON OFF 011

4 OFF OFF ON 100

5 ON OFF ON 101

6 OFF ON ON 110

7 ON ON ON 111
Digital to analogue converters
Digital computers and microcomputers are
digital information processing systems, but
information quite often is in analog form
(e.g. speech, music and video signals).
To process this information with digital
techniques it must first be converted from
its analog to digital form. The device that
does this is knows as an analog-to-
digital converter (ADC or A/D converter).
In addition, since many types of electronic
equipment are inherently analog devices
(e.g., stereo amplifiers, radio and
television receivers), there are many
occasions when it is necessary to
transform digital information to analog
information. This is accomplished by using
a device know as a digital-to-analog
converter (DAC or D/A converter).
Using the Summing Amplifier as a
digital to analogue converter
Recall that for the summing amplifier
V1 V2
VOUT R f ( )
R1 R2

A particular use of this circuit is to make a


digital to analogue converter.
This is a system that takes a binary
number, consisting of an array of 1s and
0s and turn it into a p.d proportional to the
actual number.
The circuit above can handle a 2-bit binary
number. Suppose we feed the binary digit p.ds
(which are either on or off) as follows:
1s digit to R1
2s digit to R2
Thus we want V2, if on, to give twice as much
contribution to Vout as V1
Digital analogue cont
R2 = R1
For example, R1=8k, R2 = 4k
Now whatever 2 digit binary combination comes
into R1 and R2, the value of Vout will be
proportional to the binary number being
signalled.
4-bit digital to analogue converter
2007 CAPE P2 Q7
Figure shows three T-type flip flops
(bistables) connected together. Their
output changes when the input detects a
downward pulse i.e. the input changes
from logic 1 to logic 0
Copy and complete the truth table to show the
ouputs at X, Y and Z for four successive input
pulses starting with all the outputs at zero.

Pulse X Y Z
No.

0 0 0 0

1 1

2 0

3 1

4 0
(b) Outputs X, Y and Z of the diagram on the
previous page are connected to the inputs
of the circuit below. Each of the inputs has
a potential of 5V if it recieves a 1 and 0V
if it receives 0V
1. Write an equation relating Vout to the three
input voltages Vx, Vy and Vz
2. Calculate the value of Vout for the
following binary inputs (in reverse order
Z,Y,X)
(i) 001(i.e. Z=0, Y=0 and X=1)
(ii) 101
(iii) 110
3. Briefly describe how the circuit can act as
a digital to analogue converter
Try this question!!

Assume : R1=RF and R2=R


If A2 =1
A1 =1
A0 =1
Determine the value of V2

You might also like