You are on page 1of 46

EEM3442 Electronics Engineering

Topic 5: Principles of Digital


Electronics

University College of Technology Sarawak


Objectives

• Be able to understand the


• introductory concepts of digital electronics
• number systems and codes
• digital logic circuit (logic gates)

2
Analog and Digital Signal
• Analog system
• The physical quantities or signals may vary continuously over a specified
range, take any shape and represent an infinite number of possible values
(e.g. temperature, pressure, distance, resistance, current etc.)
• Digital system
• The physical quantities or signals can assume only defined, discrete set
of possible values – usually only two (e.g. round number)
• Greater accuracy
X(t) X(t)

t t
Analog signal Digital signal
The Digital Revolution
• In recent years, many types of devices have been converted
from analog to digital.
• Examples:

Analog Digital
Music cassette CDs
VHS tapes DVDs
Analog television Digital TV

• In all of these digital devices, info is stored and transmitted


as long strings of 1s and 0s.
Analog and Digital Systems
• Many systems use a mix of analog and digital electronics
to take advantage of each technology. A typical CD player
accepts digital data from the CD drive and converts it to
an analog signal for amplification.
• Computers use digital circuits internally
• Interface circuits (for instance, sensors and actuators)
are often analog

CD drive

10110011101 Digital-to-analog Linear amplifier


Digital data converter Analog
reproduction
of music audio Speaker
signal
Sound
waves

© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Ones (“1”) and Zeros (“0”)
• Digital devices (computers, iPods, cell phones, …) store
information (numbers, text, images, music, …) as strings of 1s
and 0s.
• Each 1 or 0 in such a string is called a bit (short for binary
digit).
• Example of an 8-bit word: 01101100
• A typical song in an MP3 file might contain 40 million bits.
Common Number Systems

Used by Used in
System Base Symbols humans? computers?
Decimal 10 0, 1, … 9 Yes No
Binary 2 0, 1 No Yes
Octal 8 0, 1, … 7 No No
Hexadecimal 16 0, 1, … 9, No No
A, B, … F
Decimal Number System
• Base (also called radix) = 10 2 1 0 -1 -2
• 10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
• Digit Position
5 1 2 7 4
• Integer & fraction
100 10 1 0.1 0.01
• Digit Weight
Position
• Weight = (Base)
• Magnitude
• Sum of “Digit x Weight” 500 10 2 0.7 0.04
• Formal Notation d2*B2+d1*B1+d0*B0+d-1*B-1+d-2*B-2

(512.74)10
Binary Inputs and Outputs
• A single binary input can only have two values:
True or False (Yes or No) (1 or 0)

9
Binary Inputs and Outputs
• More bits = more combinations

00 01 10 1 1

Each additional input doubles the number of


combinations we can represent
i.e. with n inputs it is possible to represent 2n
combinations
Binary numbers
• For digital systems, the binary number system is
used. Binary has a base of two and uses the digits 0
and 1 to represent quantities.
• The column weights of binary numbers are powers
of two that increase from right to left beginning with
20 =1:

…25 24 23 22 21 20

11
Binary numbers
Decimal Binary
• A binary counting sequence for Number Number

numbers from zero to fifteen is shown. 0 0000


1 0001
• Notice the pattern of zeros and ones in 2 0010
each column. 3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
10 1010
11 1011
12 1100
13 1101
14 1110
15 1 1 1121
The Power of 10

• Base 10 Power Preface Symbol Value


10-12 pico p .000000000001

10-9 nano n .000000001

10-6 micro  .000001

10-3 milli m .001

103 kilo k 1000

106 mega M 1000000

109 giga G 1000000000


1012 tera T 1000000000000
The Power of 2

n 2n n 2n
0 20=1 8 28=256
1 21=2 9 29=512
2 22=4 10 210=1024 Kilo

3 23=8 11 211=2048
4 24=16 12 212=4096
5 25=32 20 220=1M Mega

6 26=64 30 230=1G Giga

7 27=128 40 240=1T Tera


The Power of 2

• Base 2 Power Preface Symbol Value


210 kilo k 1024

220 mega M 1048576

230 Giga G 1073741824

• What is the value of “k”, “M”, and “G”?

• In computing, particularly memory, the


base-2 interpretation generally applies
Conversion among Bases

• The possibilities:

Decimal Octal

Binary Hexadecimal
Decimal, Binary, Octal and Hexadecimal
Decimal Binary Octal Hex
00 0000 00 0
01 0001 01 1
02 0010 02 2
03 0011 03 3
04 0100 04 4
05 0101 05 5
06 0110 06 6
07 0111 07 7
08 1000 10 8
09 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
Decimal to Binary
12510 = ?2 2 125
2 62 1

2 31 0
15 1
2
7 1
2
2 3 1

2 1 1
0 1

12510 = 11111012
Fractions (decimal to binary)
.14579
x 2
3.14579 0.29158
x 2
0.58316
x 2
1.16632
x 2
0.33264
x 2
0.66528
x 2
1.33056
11.001001...
etc.
Binary to Decimal
1010112 => 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
4310

Binary to decimal (fractions)


10.1011 => 1 x 2-4 = 0.0625
1 x 2-3 = 0.125
0 x 2-2 = 0.0
1 x 2-1 = 0.5
0 x 20 = 0.0
1 x 21 = 2.0
2.6875
Octal to Decimal
7248 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810

Hexadecimal to Decimal
ABC16 => C x 160 = 12 x 1 = 12
B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810
Hexadecimal Number (Fraction) to Decimal
• Base = 16
• 16 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }
• Weights 256 16 1 1/16 1/256
Position
• Weight = (Base)
• Magnitude 1 E 5 7 A
• Sum of “Digit x Weight”
2 1 0 -1 -2
• Formal Notation
1 *162+14 *161+5 *160+7 *16-1+10 *16-2
(1E5.7A)16 =(485.4765625)10
Octal Number (Fraction) to decimal
• Base = 8
• 8 digits { 0, 1, 2, 3, 4, 5, 6, 7 }
• Weights
Position
• Weight = (Base)
• Magnitude
• Sum of “Digit x Weight”
• Formal Notation
64 8 1 1/8 1/64

5 1 2 7 4
2 1 0 -1 -2
2 1 0 -1 -
5
2 *8 +1 *8 +2 *8 +7 *8 +4 *8

=(330.9375)10
(512.74)8
Octal to Binary
7058 = ?2

7 0 5

111 000 101

7058 = 1110001012
Hexadecimal to Binary
10AF16 = ?2

1 0 A F

0001 0000 1010 1111

10AF16 = 00010000101011112
Binary − Hexadecimal Conversion
Hex Binary
• 16 =24 0 0000
• Each group of 4 bits represents a 1 0001
hexadecimal digit 2 0010
3 0011
4 0100
5 0101
Example: Assume Zeros
6 0110
7 0111
( 1 0 1 1 0 . 0 1 )2 8 1000
9 1001
A 1010
B 1011
C 1100
(1 6 . 4 )16 D 1101
E 1110
F 1111
Works both ways (Binary to Hex & Hex to
Binary)
Binary to Hexadecimal
10101110112 = ?16

10 1011 1011

2 B B

10101110112 = 2BB16
Binary Addition

• Two n-bit values


• Add individual bits
• Propagate carries
• E.g.,

1 1
10101 21
+ 11001 + 25
101110 46
Binary Subtraction

• Have previously looked at the subtraction


operation. A quick review.
• Just like subtraction in any other base
• Minuend 10110
• Subtrahand -10010
• Difference 00100
• And when a borrow is needed. Note that the
borrow gives us 2 in the current bit position.

•.

29
And a full example

• And more ripple -

30
Two’s compliment

• But how do you represent a minus sign electronically in a


computer?
• How can you represent it such that arithmetic operations
are manageable?
• There are two types of compliments for each number base
system.
• Have the r’s complement
• Have the (r-1)’s complement
• For base 2 have 2’s complement and 1’s
complement

31
1’s Complement

• This is just inverting each bit.


• Example: 1’s compliment of 1011001 is 0100110

32
2’s complement

• The 2’s complement is defined as 2n-N


• Can be done by subtraction of N from 2n or adding 1 to the
1’s complement of a number.
• For 6 = 0110
• The 1’s complement is 1001
• The 2’s complement is 1010

33
Operation with 2’s complement

• Add 4 and -6
• Will use the 2’s complement of -6 or 1010
• 4 0100
• -6 1010
• 1110 (final carrier=0)
• And taking the 2’s complement of 1110 get 0001 + 1 = 0010

• How about 6-4


• 6 0110
• -4 1011+1= 1100
• 6 0110
• -4 1100
• 10010 (final carrier=1, then neglect it)
• 0010= 2

34
Signed Binary Numbers
Multiplication of binary
• Binary, two 1-bit values

A B AB
0 0 0
0 1 0
1 0 0
1 1 1
Multiplication of binary
• Binary, two n-bit values
• As with decimal values
• E.g.,
1110
x 1011
1110
1110
0000
1110
10011010
Division of binary

38
Logic Gates (AND, OR, NOT)
• Graphic Symbols and Input-Output Signals for Logic gates:

Input-Output signals for gates


Logic Gates (exclusive OR (XOR) )
• Another very useful gate is the exclusive OR (XOR)
gate.
• The output of the XOR operation is true only when
the values of the inputs differ.
Note the special symbol
 for the XOR
operation.

40
Logic Gates

• NAND and NOR are


two very important
gates. Their symbols
and truth tables are
shown at the right.

41
Logic Gates (multiple inputs)
• Gates can have multiple inputs and more than
one output.
• A second output can be provided for the
complement of the operation.

42
Boolean Algebra
• The main thing to remember is that combinations
of gates implement Boolean functions.
• The circuit below implements the Boolean
function:

We simplify our Boolean expressions so that we can


create simpler circuits.

43
Basic Properties

• Commutative • Commutative
• X+Y=Y+X • X · Y=Y · X
• Associative • Associative
• X+(Y+Z)=(X+Y)+Z • X(YZ) = (XY)Z
• Distributive • Distributive
• X(Y+Z) =XY+XZ • X+YZ=(X+Y)(X+Z)
• AND distributes over OR • OR distributes over AND

44
Basic Properties

• DeMorgan’s Theorem
• Very important in simplifying equations
• (X + Y)’ = X’ · Y’
• (XY)’ = X’ + Y’

45
Simplify
• These properties (Laws and Theorems) can be used to
simplify equations to their simplest form.

• Simplify F=X’YZ+X’YZ’+XZ

46

You might also like