EE203 01 Digital and Number Systems

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 34

EE203 Digital Design

1. Digital & Number Systems

• Instructor: Dr. Abdulkadir Köse

EE203 Digital Design


Digital System
• Takes a set of discrete information inputs and discrete internal
information (system state) and generates a set of discrete
information outputs.

Discrete Discrete
Inputs Information
Processing Discrete
System Outputs

System State

EE203 Digital Design


Signal
• An information variable represented by physical
quantity.
• For digital systems, the variable takes on discrete
values.
• Two level, or binary values are the most prevalent
values in digital systems.
• Binary values are represented abstractly by:
• digits 0 and 1
• words (symbols) False (F) and True (T)
• words (symbols) Low (L) and High (H)
• and words On and Off.
• Binary values are represented by values or ranges of
values of physical quantities
EE203 Digital Design Chapter 1 3
Analog and Digital Signal
• Analog system
• The physical quantities or signals may vary continuously over a
specified range.
• Digital system
• The physical quantities or signals can assume only discrete values.
• Greater accuracy

X(t) X(t)

t t
EE203 Digital Design Analog signal Digital signal
Evolution of Electronic Devices

EE203 Digital Design


MOORE’S LAW

EE203 Digital Design


Number Systems

Digital world

011000100100111
00010010010101
01000101001101

2,452,748,179
“Print this slides.”

EE203 Digital Design 7


• All information in a computer: binary form.
Numbers, letters, controls, images, etc.
• Decimal numbers

578.23

 5  10 2  7  101  8  10 0  2  10 1  3  10 2
• Weighted system (base-ten or radix 10)

… 105104103102101100.10-110-210-3 …

Decimal point or radix point

EE203 Digital Design 8


Binary Numbers
• Only two digits (bits): 0 and 1
• Base-two system

Least Significant Bit (LSB)


Most Significant Bit (MSB)

2N…252423222120.2-12-22-3 …2-M

1 0.5 0.25 0.125


32 2
16
8 4
Binary point

EE203 Digital Design 9


Decimal Numbers and Binary Numbers

EE203 Digital Design 10


• N bits: from zero to 2N-1
• E.g.,
– 8 bits: from 0 to 255
– (00000000)2 = (0)10
– (11111111)2 = (255)10

• 210 = 1 024  1 k (kilo)


• 220 = 1 048 576  1 M (mega)
• 230 = 1 073 741 824  1 G (giga)
• 240 = 1 099 511 627 776  1 T (tera)

EE203 Digital Design 11


Binary to Decimal

• Convert the binary number 1101101 to decimal.

(1011101)2 = ?

EE203 Digital Design 12


• Convert the fractional binary number 0.1011 to decimal.

EE203 Digital Design 13


Decimal to Binary

(12)10 = (1100)2

(245)10 = ?
EE203 Digital Design 14
(0.3125)10 = (.0101)2

Continue to the desired decimal places


Or stop when the fractional part is all 0.
(0.1875)10 = ?

EE203 Digital Design 15


Octal and Hexadecimal Systems

• Numbers get too long with the


binary system.
– Difficult to be read and
written by human.
– For human reading and
writing, octal and
hexadecimal systems are
often used.
• Three bits  one digit in octal
system.
• Four bits  one digit in
hexadecimal system.

EE203 Digital Design 16


Conversion Between Binary and
Hexadecimal Numbers

(10A4)16

000

(1001 1111 0011 1101)2 = ? (B37E)16 = ?


EE203 Digital Design 17
Binary Arithmetic Operations

EE203 Digital Design 18


Complements of Binary Numbers
• Needed for negative numbers.
• 1’s complement: change all 1s to 0s and all 0s to 1s.

• 2’s complement = (1’s complement) + 1

EE203 Digital Design 19


Signed Numbers
• To represent both positive and negative numbers.
• Sign bit + magnitude
– Left-most bit: sign, 0 for positive and 1 for negative.
• 2’s complement, 1’s complement, sign-magnitude
• 2’s complement
8 bit example
−24 = 11101000 (24 = 00011000)
• 1’s complement
−24 = 11100111
• Sign-magnitude
−24 = 10011000

EE203 Digital Design 20


Arithmetic Operations with Signed Numbers
• Addition
 Both numbers positive

 Positive number with magnitude larger than negative number

EE203 Digital Design 21


 Negative number with magnitude larger than positive number

 Both numbers negative

 Summary: just add the two numbers and discard carry.

EE203 Digital Design 22


 Overflow conditions
• When two positive or negative numbers with large
magnitude are added.

• Subtraction
 Take the 2’s complement of the subtrahend and add.
 Discard any final carry bit.
• Multiplication
 Multiple addition.

EE203 Digital Design 23


Display in decimal

Conversion
necessary

Computation in binary

EE203 Digital Design 24


Binary Coded Decimal (BCD)
• Expression of each digit in decimal with a binary code.

For example,
35  0011 0101 98 1001 1000
170  0001 0111 0000 2469  0010 0100 0110 1001

• Invalid codes: 1010, 1011, 1100, 1101, 1110, and 1111


• Provide excellent interface. E.g. keypads and digital readouts.

EE203 Digital Design 25


Gray Code
• Unweighted and non-arithmetic.
• Only a single bit change from one code word to the next in
sequence.

EE203 Digital Design 26


Binary to Gray Code Conversion
• MSB of gray code is equal to MSB of binary code.
• Other gray code bits obtained by XORing binary bits
at each index with the previous index.

EE203 Digital Design 27


Gray to Binary Code Conversion
• The MSB of the binary code is always same with the MSB of the
gray code.
• Other binary code bits are determined by checking the gray
code bit at that index. If the gray code bit is 0, copy the
previous binary bit; otherwise, copy the inverted previous
binary bit.

EE203 Digital Design 28


Gray Code Application Example
― Shaft Position Encoder

If there is a slight
misalignment,…

EE203 Digital Design 29


Gray Code Application Example
― Shaft Position Encoder

Even if there is a slight


misalignment,…

EE203 Digital Design 30


Alphanumeric Codes
• Computers should handle,
– Numbers: 0 to 9
– Letters: Roman alphabets, lowercase and uppercase
– Special characters: ! @ # $ % ^ & * …
• ASCII codes – American Standard Code for Information Interchange
– Standard binary code
– Seven bits  128 characters
– Control characters: routing data and arranging printed text
– Extended ASCII: additional 8-bit for foreign alphabetic
letters, Greek letters, mathematical symbols, etc.
• Unicode (ASCII is for English.)
– Industry standard for common representation of symbols
and ideographs for the most of the world’s languages.

EE203 Digital Design 31


ASCII Code

EE203 Digital Design 32


Error in Communication

Error
0101 0111
Error
01010 01110

Parity bit
Even no. 1s Odd no. 1s

 There is an error.

EE203 Digital Design 33


Parity Bit
• Bit error detection
• Attached to a group of bits to
make the total number of 1s in
a group always even or odd.
– Even parity: more common.
• Either at the beginning or at the
end of the word.
• Can detect a single bit (or odd
numbers of) error.
• Cannot detect even numbers of
error.

EE203 Digital Design 34

You might also like