You are on page 1of 49

Dar-es-salaam Institute of Technology

Department of Electronics and Telecommunications Engineering.

ETU 07322: DIGITAL ELECTRONICS

Lecture 1: Fundamentals of Digital Electronics


Number systems and codes

MDK 1
Introduction
• This course introduces the students to digital electronics and provides
a broad overview of many important concepts, components, and tools.
• The students will get the up-to-date coverage of digital fundamentals-
from basic concepts to programmable logic devices.
• Laboratory experiments provide hands-on experience with the devices
and circuits studied in the classroom.

MDK 2
OBJECTIVES
• To present the Digital fundamentals, Boolean algebra and its
applications in digital systems
• To familiarize with the design of various combinational digital
circuits using logic gates
• To introduce the analysis and design procedures for synchronous and
asynchronous sequential circuits
• To explain the various semiconductor memories and related
technology
• To introduce the electronic circuits involved in the making of logic
gates

MDK 3
OUTCOMES:
At the end of the course:
• Use digital electronics in the present contemporary world
• Design various combinational digital circuits using logic gates
• Do the analysis and design procedures for synchronous and
asynchronous sequential circuits
• Use the semiconductor memories and related technology
• Use electronic circuits involved in the design of logic gates parallel
in/ parallel out shift register, parallel in/Serial out shift register, Bi-
directional register

MDK 4
Policy
Attendance:
• Regular classroom attendance is expected and attendance is taken.
• Students more than 10 minutes late for class will not be given credit for attendance
• Mobile phones must be set to the silent mode.
Lecture and lecture slides
• Available before lecture
Assignments and Exams:
• All assigned work is due at the assigned time on the assigned date.
• All exams are to be taken at the assigned time on the assigned date.
• All late or missed work receives a score of 0. Late work is accepted only in extra ordinary
circumstances, and is accepted and graded at the instructor's discretion.
• We will have some pop quizzes (without prior warning or announcement).
• Cheating will not be tolerated.
• It is highly encouraged to discuss each other but highly discouraged to copy somebodies’ work

MDK 5
Grading Policy

 Homework/assignment 15%
 Test 1& Test 2 15%
 Quizzes and
presentation 15%
 Practical/Labs 15%
 Final Exam 40%
 Surprise Quizzes may be conducted and having
share of five marks in individual assignments
 All quizzes and exams will be closed book.
Calculators are not allowed
 No Make-Up Tests
MDK 6
Fundamentals of Digital
Electronics
Introduction

MDK 7
Introduction
• Digital electronics is the foundation of all microprocessor-based
systems found in computers, robots, automobiles, and industrial
control systems
• Analog versus Digital Electronics
• Most observables are analog
• But the most convenient way to represent and transmit information
electronically is digital
• Analog/digital and digital/analog conversion is essential

MDK 8
Analog versus Digital comparison
Analog Digital
• Analog signal is a continuous signal • Digital signals are discrete time
which represents physical signals generated by digital
measurements. Denoted by sine waves modulation. Denoted by square waves.
• Uses continuous range of values to • Uses discrete or discontinuous values
represent information.
to represent information.

• Examples: Human voice in air, analog


electronic devices • Examples: Computers, CDs, DVDs,
• Uses: Can be used in analog devices and other digital electronic devices.
only. Best suited for audio and video • Uses: Best suited for Computing and
transmission. digital electronics
MDK 9
Digital vs. Analog Data Representation
• The real world is analog! Most things that can be
measured quantitatively occur in nature in analog form.
Examples: air temperature, pressure, distance, sound.
• Even digital systems are really analog deep down.
• Interfacing between analog and digital is important.
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.
MDK 10
Digital vs. Analog Data Representation
• Problems with analog?
• Hard to measure an exact value.
• Noise (or interference) may disrupt signal.
• Signal is hard to maintain across large distances.
• Analog systems can generally handle higher power than digital
systems.
• Digital systems can process, store, and transmit data more
efficiently but can only assign discrete values to each point.
• Noise (unwanted voltage fluctuations) does not affect digital data
nearly as much as it does analog signals.
• Can use error-correcting codes.
• Can use compression.

MDK 11
Digital and Analog Quantities
• Digitization:
• Digitization is the process of converting information into a digital format. In
this format, information is organized into discrete units of data called bits
that can be separately addressed, usually in multiple-bit groups called bytes.
• Sampling: Discretize the time
• Get sampled values of the analog signal.

• Quantization: Discretize quantity values


• Convert each sampled value to a binary code.
Digitization

MDK 12
Digital and Analog Quantities
• This is the binary data that computers and many devices with computing
capacity, such as digital cameras and digital hearing aids, can process.

MDK 13
Digital representations of logical functions
• Digital signals also offer an effective way to execute logic. The
formalism for performing logic with binary variables is called switching
algebra or Boolean algebra.
• Digital electronics combines two important properties:
• The ability to represent real functions by coding the information in
digital form.
• The ability to control a system by a process of manipulation and
evaluation of digital variables using switching algebra.

MDK 14
Digital Representations of logic functions (cont.)
• Digital signals can be transmitted, received, amplified, and
retransmitted with no degradation.
• Binary numbers are a natural method of expressing logic variables.
• Complex logic functions are easily expressed as binary function.
• With digital representation, we can achieve arbitrary levels of
“ dynamic range,” that is, the ratio of the largest possible signal to
the smallest than can be distinguished above the background noise.
• Digital information is easily and inexpensively stored

MDK 15
Fundamentals of Digital Electronics

Number systems

MDK 16
Overview
• The design of computers
• It all starts with numbers
• Building circuits
• Building computing machines
• Digital systems
• Understanding decimal numbers
• Binary and octal numbers
• The basis of computers!
• Conversion between different number systems

MDK 17
Digital Computer Systems
• Digital systems consider discrete amounts of data.
• Examples
• 26 letters in the alphabet
• 10 decimal digits
• Larger quantities can be built from discrete values:
• Words made of letters
• Numbers made of decimal digits (e.g. 239875.32)
• Computers operate on binary values (0 and 1)
• Easy to represent binary values electrically
• Voltages and currents.
• Can be implemented using circuits
• Create the building blocks of modern computers
MDK 18
TYPES OF NUMBER SYSTEM
There are four types of number systems. They are
1. Decimal number system
2. Binary number system
3. Octal number system
4. Hexadecimal number system

MDK 19
Decimal Number System
• The decimal system with its ten digits is a base-ten system
• You use decimal numbers every day.
• Each of the ten digits (symbols), 0 through 9, represents a
certain quantity.
• The position of each digit in a weighted number system is
assigned a weight based on the base or radix of the system.
• The radix of decimal numbers is ten.
• The weights for whole numbers are positive powers of ten
that increase from right to left, beginning with 100 = 1
NOTE: The radix or base of a number system is defined as the
number of different digits which can occur in each position in
the number system.

MDK 20
Decimal Number System Cont…
• Example: Express the decimal number 47 as a sum of the
values of each digit.
47 = (4 x101) + (7 x 100) = 40 + 7
• Example: What weight does the digit 7 have in each of the
following numbers?
(a) 1370: 10 (b) 6725: 100 (c) 7051: 1000 (d) 58.72: 0.1
• Example: Express each of the following decimal numbers as a sum of
the products obtained by multiplying each digit by its appropriate
weight
(a) 51 = (5 x 10) + (1 x 1)
(b) 137 = (1 x 100) + (3 x 10) + (7 x 1)
(c) 106.58 = (1 x 100) + (0 x 10) + (6 x 1) + (5 x 0.1) + (8 x 0.01)

MDK 21
Understanding Binary Numbers
• Binary numbers are made of binary digits (bits):
• 0 and 1
• How many items does an binary number represent?
• (1011)2 = 1x23 + 0x22 + 1x21 + 1x20 = (11)10
• What about fractions?
• (110.10)2 = 1x22 + 1x21 + 0x20 + 1x2-1 + 0x2-2
• Groups of eight bits are called a byte
• (11001001) 2
• Groups of four bits are called a nibble.
• (1101) 2

MDK 22
Binary Number System
• The position of a 1 or a 0 in a binary number indicates its weight or value
within the number.
• The weight structure of a binary number is 2n-1 ... 23 22 21 20

• Largest decimal number = 2n - 1


• The weights increase from right to left by a power of two for each bit.
• The right-most bit is the LSB (least significant bit) in a binary whole
number and has a weight of 20 = 1.
• The left-most bit is the MSB (most significant bit); its weight depends
on the size of the binary number.

MDK 23
The Growth of Binary Numbers
n 2n n 2n
0 20=1 8 28=256
1 21=2 9 29=512

2 22=4 10 210=1024

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

MDK 24
Conversion Between Number Bases

Octal(base 8)

Decimal(base 10) Binary(base 2)

Hexadecimal
(base16)
° Learn to convert between bases.

MDK 25
Decimal-to-Binary Conversion
• Two methods
1. Sum-of-Weights Method
2. Repeated Division-by-2 Method
• Sum-of-Weights Method: determine the set of binary weights
whose sum is equal to the decimal number.
• Repeated Division-by-2 Method:
• The remainders form the binary number.
• The first remainder to be produced is the LSB.

• But for this case we will use method 2.

MDK 26
Decimal-to-Binary Conversion
Repeated Division-by-2 Method is illustrated as follows for
converting the decimal number 12 to binary.

MDK 27
Binary-to-Decimal Conversion example
• Add the column values of all of the bits that are 1 and discarding all of the bits that are
0.
• Example: Convert the binary number 10111101.011
to decimal.
weight 27 26 25 24 23 22 21 20 2-1 2-2 2-3
128 68 32 16 8 4 2 1 0.5 0.25 0.125
Binary 1 0 1 1 1 1 0 1 . 0 1 1
number

• 10111101.011 = 128+32+16+8+4+1+0.25+0.125
= 189.375
• Example: What is the largest decimal number that can be represented in binary with
seven bits?
• The largest decimal number that can be represented in binary with n bits is 2n-1.

MDK 28
Binary arithmetic
• Binary arithmetic is essential in all types of digital
systems
• To understand digital systems, you must know the
basics of binary
• addition,
• subtraction,
• multiplication and
• divsion

MDK 29
Binary Addition

• Binary addition is very simple.


• This is best shown in an example of adding two binary
numbers…

1 1 1 1 1 1 carries
11 1 1 0 1
+ 1 0 1 1 1
---------------------
1 0 1 0 1 0 0

MDK 30
Binary Addition
• Example: Add the binary numbers 0111 and 1101 and show the
equivalent decimal addition.

1 1 1 1 1
0 1 1 1 7
1 1 0 1 + 1 3 +
1 0 1 0 0 = 2 0

MDK 31
Binary Subtraction
• The rules for binary subtraction are
0-0=0 Difference = 0, borrow = 0
0-1=1 Difference = 1, borrow = 1
1-0=1 Difference = 1, borrow = 0
1-1=0 Difference = 0, borrow = 0
• Example: Subtract the binary numbers 1101 and 0111 and show the
equivalent decimal subtraction.
1 1 0 1 1 3
0 1 1 1 - 7 -
0 1 1 0 = 0 6

MDK 32
Binary Division

1001ten Quotient
Divisor 1000ten | 1001010ten Dividend
-1000
10
101
1010
-1000
10ten Remainder

At every step,
• shift divisor right and compare it with current dividend
• if divisor is larger, shift 0 as the next bit of the quotient
• if divisor is smaller, subtract to get new dividend and shift 1
as the next bit of the quotient
MDK 33
Binary Multiplication

• Binary multiplication is much the same as decimal


multiplication, except that the multiplication
operations are much simpler…
1
0 1 1 1
X 1 0 1 0
-----------------------
0 0 0 0 0
1 0 1 1 1
0 0 0 0 0
1 0 1 1 1
-----------------------
1 1 1 0 0 1 1 0

MDK 34
Why Use Binary Numbers?
° Easy to represent 0 and 1 using
electrical values.
° Possible to tolerate noise.
° Easy to transmit data
° Easy to build binary circuits.

AND Gate

1
0
0

MDK 35
Understanding Octal Numbers
• Octal numbers are made of octal digits: (0,1,2,3,4,5,6,7)
• How many items does an octal number represent?
• (4536)8 = 4x83 + 5x82 + 3x81 + 6x80 = (1362)10
• What about fractions?
• (465.27)8 = 4x82 + 6x81 + 5x80 + 2x8-1 + 7x8-2
• Octal numbers don’t use digits 8 or 9
• Binary number can easily be converted to octal by grouping
bits 3 at a time and writing the equivalent octal character for
each group.
• Octal is also a weighted number system. The column weights
are powers of 8, which increase from right to left.
MDK 36
Understanding Hexadecimal Numbers
• Hexadecimal numbers are made of 16 digits:
• (0,1,2,3,4,5,6,7,8,9,A, B, C, D, E, F)
• How many items does an hex number represent?
• (3A9F)16 = 3x163 + 10x162 + 9x161 + 15x160 = 1499910
• What about fractions?
• (2D3.5)16 = 2x162 + 13x161 + 3x160 + 5x16-1 = 723.312510
• Note that each hexadecimal digit can be represented
with four bits.
• (1110) 2 = (E)16

MDK 37
Putting It All Together
° Binary, octal, and
hexadecimal similar
° Easy to build circuits to
operate on these
representations
° Possible to convert between
the three formats

MDK 38
Converting Between Base 16 and Base 2

3A9F16 = 0011 1010 1001 11112


3 A 9 F

° Conversion is easy!
 Determine 4-bit value for each hex digit
° Note that there are 24 = 16 different values of four bits
° Easier to read and write in hexadecimal.

MDK 39
Converting Between Base 16 and Base 8

3A9F16 = 0011 1010 1001 11112


3 A 9 F

352378 = 011 101 010 011 1112


3 5 2 3 7

1. Convert from Base 16 to Base 2


2. Regroup bits into groups of three starting from right
3. Ignore leading zeros
4. Each group of three bits forms an octal digit.
MDK 40
Class exercise
• Converting decimal numbers to binary
• 53 and 211
• What is 10011010 in decimal?
• What is 00101001 in decimal?
• Convert (1011011011)2 into hexadecimal.
• Convert (01011111011.011111)2 into hexadecimal.
• Convert (4057.06) 8 to decimal
• Convert (756.603)8 to hexadecimal.
• Convert (3A9E.B0D)16 into binary.
• Convert (A0F9.0EB)16 to decimal

MDK 41
Signed Binary Number
• Digital Logic represents numbers as n-bit binary numbers, with fixed n. The number is
fixed
• Plus and minus sign used for decimal numbers: 25 (or +25), -16, etc.
• For computers, desirable to represent everything as bits.
• A signed binary number consists of both sign and magnitude
information.
• The sign indicates whether a number is positive or negative
• In a signed binary number, the left-most bit (MSB) is the sign bit.
• 0 indicates a positive number, and 1 indicates a negative number
• The magnitude is the value of the number.

MDK 42
How To Represent Signed Numbers
• There are three forms in which signed integer (whole) numbers can be represented
in binary:
1. sign-magnitude,
2. 1's complement, Change all 1s to 0s and all 0s to 1s.and
3. 2's complement. Add 1 to the LSB of the 1's complement.
• If the addition produces a result that requires more than n digits, we throw away
the extra digit(s). Of these, the 2's complement is the most important
• If a number D is complemented twice, the result is D.
Consider signed magnitude:

In each case: left-most bit indicates sign: positive (0) or negative (1).

000011002 = 1210
100011002 = -1210

Sign bit Magnitude Sign bit Magnitude

MDK 43
One’s Complement Representation
• The one’s complement of a binary number involves inverting all
bits.
• 1’s comp of 00110011 is 11001100
• 1’s comp of 10101010 is 01010101
• To find negative of 1’s complement number take the 1’s
complement.

000011002 = 1210
111100112 = -1210

Sign bit Magnitude


Sign bit Magnitude

MDK 44
Two’s Complement Representation
• The two’s complement of a binary number involves inverting all bits
and adding 1.
• 2’s comp of 00110011 is 11001101
• 2’s comp of 10101010 is 01010110
• To find negative of 2’s complement number take the 2’s complement.

000011002 = 1210
111101002 = -1210
Sign bit Magnitude
Sign bit Magnitude

MDK 45
Representation of Negative Numbers
• Example
The 1’s complement of 11001010 is 00110101
To form the 2’s complement, add 1:
1 1 0 0 1 0 1 0
0 0 1 1 0 1 0 1 1’s complement
1 +
0 0 1 1 0 1 1 0 2’s complement

MDK 46
Convert an Integer from Decimal to Another Base
For each digit position:
1. Divide decimal number by the base (e.g. 2)
2. The remainder is the lowest-order digit
3. Repeat first two steps until no divisor remains.

Example for (13)10:


Integer Remainder Coefficient
Quotient
13/2 = 6 + ½ a0 = 1
6/2 = 3 + 0 a1 = 0
3/2 = 1 + ½ a2 = 1
1/2 = 0 + ½ a3 = 1

Answer (13)10 = (a3 a2 a1 a0)2 = (1101)2

MDK 47
Convert an Fraction from Decimal to Another Base
For each digit position:
1. Multiply decimal number by the base (e.g. 2)
2. The integer is the highest-order digit
3. Repeat first two steps until fraction becomes zero.

Example for (0.625)10:


Integer Fraction Coefficient

0.625 x 2 = 1 + 0.25 a -1 = 1
0.250 x 2 = 0 + 0.50 a-2 = 0
0.500 x 2 = 1 + 0 a-3 = 1

Answer (0.625)10 = (0.a-1 a-2 a-3 )2 = (0.101)2

MDK 48
Summary
• Binary numbers are made of binary digits (bits)
• Binary and octal number systems
• Conversion between number systems
• Addition, subtraction, and multiplication in binary
• Binary numbers can also be represented in octal and hexadecimal
• Easy to convert between binary, octal, and hexadecimal
• Signed numbers represented in signed magnitude, 1’s complement, and 2’s
complement

MDK 49

You might also like