0% found this document useful (0 votes)
36 views101 pages

ECCE 210-Lect-2-3-NumberSystem

The document discusses different number systems including decimal, binary, octal, and hexadecimal. It covers how to represent quantities in each system using positional notation and weighted values. Examples are provided for converting between decimal, binary, octal, and hexadecimal numbers. Techniques like dividing by powers of the base or multiplying bit positions by the weighted values are explained. The goal is to review representing and performing operations on data in different digital formats.

Uploaded by

sultan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views101 pages

ECCE 210-Lect-2-3-NumberSystem

The document discusses different number systems including decimal, binary, octal, and hexadecimal. It covers how to represent quantities in each system using positional notation and weighted values. Examples are provided for converting between decimal, binary, octal, and hexadecimal numbers. Techniques like dividing by powers of the base or multiplying bit positions by the weighted values are explained. The goal is to review representing and performing operations on data in different digital formats.

Uploaded by

sultan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 101

Lecture 2-3: Number Systems

DIGITAL LOGIC DESIGN


(ECCE 210)
Number Systems
Dr. Baker Mohammad
Location in course textbook

Chapter 1 section 1.5 and CH 3 section 3.1-3.3


Some slides were adapted from: S. Brown and Z. Vranesic , Fundamentals of Digital Logic with Verilog Design, and S. MacKenzie, York University

ECCE 210 Digital Logic Design Slide 1


Lecture 2-3: Number Systems

Learning objectives
• Review material covered mostly in computer
organization class
– Represent data in different digital formats:
• Positional number system
• Binary coded decimal (BCD)
• Hexadecimal systems
– Negative number representation
– Convert from one format to another
• Perform basic mathematical operations on data
represented in different format.
• Alphanumeric codes.

ECCE 210 Digital Logic Design Slide 2


Lecture 2-3: Number Systems

Weighted Positional Notation


• Use the position of the symbol to indicate the value
• By assigning each position the appropriate power
of the base, we can get a unique representation of
numbers in that base
• People are comfortable with a Decimal System
(Base 10) numbers from 0 to 9
Given a sequence of n digits D  d n 1d n  2  d1d 0

V ( D)  d n 1 10 n 1  d n  2 10 n  2    d1 101  d 0  10 0

Ten of thousands tens ones


Thousands

ECCE 210 Digital Logic Design Slide 3


Lecture 2-3: Number Systems

Weighted Positional Notation (cont.)


• Binary integer: base-2 or radix-2
B  bn 1bn  2  b1b0
n 1
V ( B)  bn 1  2 n 1
 bn  2  2 n2
   b1  2  b0  2   bi 2i
1 0

i 0
• Octal and Hex
K  k n 1k n  2  k1k 0
n 1
V ( K )   ki r i
i 0

• Octal (r=8), Hex (r=16)

ECCE 210 Digital Logic Design Slide 4


Lecture 2-3: Number Systems

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
Hexa- 16 0, 1, … 9, No No
decimal A, B, … F

ECCE 210 Digital Logic Design Slide 5


Lecture 2-3: Number Systems

Quantities/Counting (1 of 3)
Hexa-
Decimal Binary Octal decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
p. 233

ECCE 210 Digital Logic Design Slide 6


Lecture 2-3: Number Systems

Quantities/Counting (2 of 3)
Hexa-
Decimal Binary Octal decimal
8 1000 10 8
9 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

ECCE 210 Digital Logic Design Slide 7


Lecture 2-3: Number Systems

Quantities/Counting (3 of 3)
Hexa-
Decimal Binary Octal decimal
16 10000 20 10
17 10001 21 11
18 10010 22 12
19 10011 23 13
20 10100 24 14
21 10101 25 15
22 10110 26 16
23 10111 27 17 Etc.

ECCE 210 Digital Logic Design Slide 8


Lecture 2-3: Number Systems

Conversion Among Bases


• The possibilities:

Decimal Octal

Binary Hexadecimal

pp. 230-234

ECCE 210 Digital Logic Design Slide 9


Lecture 2-3: Number Systems

Quick Example

2510 = 110012 = 318 = 1916

Base

ECCE 210 Digital Logic Design Slide 10


Lecture 2-3: Number Systems

Decimal to Decimal (just for fun)

Decimal Octal

Binary Hexadecimal

Next slide…

ECCE 210 Digital Logic Design Slide 11


Lecture 2-3: Number Systems

Weight

12510 => 5 x 100 = 5


2 x 101 = 20
1 x 102 = 100
125

Base

ECCE 210 Digital Logic Design Slide 12


Lecture 2-3: Number Systems

Binary to Decimal

Decimal Octal

Binary Hexadecimal

ECCE 210 Digital Logic Design Slide 13


Lecture 2-3: Number Systems

Binary to Decimal
• Technique
– Multiply each bit by 2n, where n is the “weight”
of the bit
– The weight is the position of the bit, starting
from 0 on the right
– Add the results

ECCE 210 Digital Logic Design Slide 14


Lecture 2-3: Number Systems

Example
Bit “0”

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

ECCE 210 Digital Logic Design Slide 15


Lecture 2-3: Number Systems

Octal to Decimal

Decimal Octal

Binary Hexadecimal

ECCE 210 Digital Logic Design Slide 16


Lecture 2-3: Number Systems

Octal to Decimal
• Technique
– Multiply each bit by 8n, where n is the “weight”
of the bit
– The weight is the position of the bit, starting
from 0 on the right
– Add the results

ECCE 210 Digital Logic Design Slide 17


Lecture 2-3: Number Systems

Example

7248 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810

ECCE 210 Digital Logic Design Slide 18


Lecture 2-3: Number Systems

Hexadecimal to Decimal

Decimal Octal

Binary Hexadecimal

ECCE 210 Digital Logic Design Slide 19


Lecture 2-3: Number Systems

Hexadecimal to Decimal
• Technique
– Multiply each bit by 16n, where n is the
“weight” of the bit
– The weight is the position of the bit, starting
from 0 on the right
– Add the results

ECCE 210 Digital Logic Design Slide 20


Lecture 2-3: Number Systems

Example

ABC16 => C x 160 = 12 x 1 = 12


B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810

ECCE 210 Digital Logic Design Slide 21


Lecture 2-3: Number Systems

Decimal to Binary

Decimal Octal

Binary Hexadecimal

ECCE 210 Digital Logic Design Slide 22


Lecture 2-3: Number Systems

Decimal to Binary
• Technique
– Divide by two, keep track of the remainder
– First remainder is bit 0 (LSB, least-significant
bit)
– Second remainder is bit 1
– Etc.

ECCE 210 Digital Logic Design Slide 23


Lecture 2-3: Number Systems

Example
12510 = ?2 2 125
2 62 1
2 31 0
2 15 1
2 7 1
2 3 1
2 1 1
0 1

12510 = 11111012

ECCE 210 Digital Logic Design Slide 24


Lecture 2-3: Number Systems

Octal to Binary

Decimal Octal

Binary Hexadecimal

ECCE 210 Digital Logic Design Slide 25


Lecture 2-3: Number Systems

Octal to Binary
• Technique
– Convert each octal digit to a 3-bit equivalent
binary representation

ECCE 210 Digital Logic Design Slide 26


Lecture 2-3: Number Systems

Example
7058 = ?2

7 0 5

111 000 101

7058 = 1110001012

ECCE 210 Digital Logic Design Slide 27


Lecture 2-3: Number Systems

Hexadecimal to Binary

Decimal Octal

Binary Hexadecimal

ECCE 210 Digital Logic Design Slide 28


Lecture 2-3: Number Systems

Hexadecimal to Binary
• Technique
– Convert each hexadecimal digit to a 4-bit
equivalent binary representation

ECCE 210 Digital Logic Design Slide 29


Lecture 2-3: Number Systems

Example
10AF16 = ?2

1 0 A F

0001 0000 1010 1111

10AF16 = 00010000101011112

ECCE 210 Digital Logic Design Slide 30


Lecture 2-3: Number Systems

Decimal to Octal

Decimal Octal

Binary Hexadecimal

ECCE 210 Digital Logic Design Slide 31


Lecture 2-3: Number Systems

Decimal to Octal
• Technique
– Divide by 8
– Keep track of the remainder

ECCE 210 Digital Logic Design Slide 32


Lecture 2-3: Number Systems

Example
123410 = ?8

8 1234
8 154 2
8 19 2
8 2 3
0 2

123410 = 23228

ECCE 210 Digital Logic Design Slide 33


Lecture 2-3: Number Systems

Decimal to Hexadecimal

Decimal Octal

Binary Hexadecimal

ECCE 210 Digital Logic Design Slide 34


Lecture 2-3: Number Systems

Decimal to Hexadecimal
• Technique
– Divide by 16
– Keep track of the remainder

ECCE 210 Digital Logic Design Slide 35


Lecture 2-3: Number Systems

Example
123410 = ?16

16 1234
16 77 2
16 4 13 = D
0 4

123410 = 4D216

ECCE 210 Digital Logic Design Slide 36


Lecture 2-3: Number Systems

Binary to Octal

Decimal Octal

Binary Hexadecimal

ECCE 210 Digital Logic Design Slide 37


Lecture 2-3: Number Systems

Binary to Octal
• Technique
– Group bits in threes, starting on right
– Convert to octal digits

ECCE 210 Digital Logic Design Slide 38


Lecture 2-3: Number Systems

Example
10110101112 = ?8

1 011 010 111

1 3 2 7

10110101112 = 13278

ECCE 210 Digital Logic Design Slide 39


Lecture 2-3: Number Systems

Binary to Hexadecimal

Decimal Octal

Binary Hexadecimal

ECCE 210 Digital Logic Design Slide 40


Lecture 2-3: Number Systems

Binary to Hexadecimal
• Technique
– Group bits in fours, starting on right
– Convert to hexadecimal digits

ECCE 210 Digital Logic Design Slide 41


Lecture 2-3: Number Systems

Example
10101110112 = ?16

10 1011 1011

2 B B

10101110112 = 2BB16

ECCE 210 Digital Logic Design Slide 42


Lecture 2-3: Number Systems

Octal to Hexadecimal

Decimal Octal

Binary Hexadecimal

ECCE 210 Digital Logic Design Slide 43


Lecture 2-3: Number Systems

Octal to Hexadecimal
• Technique
– Use binary as an intermediary

ECCE 210 Digital Logic Design Slide 44


Lecture 2-3: Number Systems

Example
10768 = ?16

1 0 7 6

001 000 111 110

2 3 E

10768 = 23E16

ECCE 210 Digital Logic Design Slide 45


Lecture 2-3: Number Systems

Hexadecimal to Octal

Decimal Octal

Binary Hexadecimal

ECCE 210 Digital Logic Design Slide 46


Lecture 2-3: Number Systems

Hexadecimal to Octal
• Technique
– Use binary as an intermediary

ECCE 210 Digital Logic Design Slide 47


Lecture 2-3: Number Systems

Example
1F0C16 = ?8

1 F 0 C

0001 1111 0000 1100

1 7 4 1 4

1F0C16 = 174148

ECCE 210 Digital Logic Design Slide 48


Lecture 2-3: Number Systems

Exercise – Convert ...


Hexa-
Decimal Binary Octal decimal
33
1110101
703
1AF

Don’t use a calculator!

Skip answer Answer

ECCE 210 Digital Logic Design Slide 49


Lecture 2-3: Number Systems

Exercise –Answer
Convert …
Hexa-
Decimal Binary Octal decimal
33 100001 41 21
117 1110101 165 75
451 111000011 703 1C3
431 110101111 657 1AF

ECCE 210 Digital Logic Design Slide 50


Lecture 2-3: Number Systems

Binary Addition (1 of 2)
• Two 1-bit values

A B A+ B
0 0 0
0 1 1
1 0 1
1 1 10
“two”

pp. 234-
240
ECCE 210 Digital Logic Design Slide 51
Lecture 2-3: Number Systems

Binary Addition (2 of 2)
• Two n-bit values
– Add individual bits
– Propagate carries
– E.g.,
1 1
10101 21
+ 11001 + 25
101110 46

ECCE 210 Digital Logic Design Slide 52


Lecture 2-3: Number Systems

Multiplication (1 of 3)
• Decimal (just for fun)

35
x 105
175
000
35
3675

ECCE 210 Digital Logic Design Slide 53


Lecture 2-3: Number Systems

Multiplication (2 of 3)
• Binary, two 1-bit values

A B AB
0 0 0
0 1 0
1 0 0
1 1 1

ECCE 210 Digital Logic Design Slide 54


Lecture 2-3: Number Systems

Multiplication (3 of 3)
• Binary, two n-bit values
– As with decimal values
– E.g.,
1110
x 1011
1110
1110
0000
1110
10011010

ECCE 210 Digital Logic Design Slide 55


Lecture 2-3: Number Systems

Fractions
• Decimal to decimal (just for fun)

3.14 => 4 x 10-2 = 0.04


1 x 10-1 = 0.1
3 x 100 = 3
3.14

ECCE 210 Digital Logic Design Slide 56


Lecture 2-3: Number Systems

Fractions
• Binary to decimal
10.1011 => 1 x 2-4 = 0.0625
b1b0 .b1b2 b31
b4 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

ECCE 210 Digital Logic Design Slide 57


Lecture 2-3: Number Systems

Fractions
• Decimal to binary x
.14579
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.

ECCE 210 Digital Logic Design Slide 58


Lecture 2-3: Number Systems

Exercise – Convert ...


Hexa-
Decimal Binary Octal decimal
29.8
101.1101
3.07
C.82
Don’t use a calculator!

Skip answer Answer

ECCE 210 Digital Logic Design Slide 59


Lecture 2-3: Number Systems

Exercise –Answer
Convert …
Hexa-
Decimal Binary Octal decimal
29.8 11101.110011… 35.63… 1D.CC…
5.8125 101.1101 5.64 5.D
3.109375 11.000111 3.07 3.1C
12.5078125 1100.10000010 14.404 C.82

ECCE 210 Digital Logic Design Slide 60


Lecture 2-3: Number Systems

Representing Integer Data

ECCE 210 Digital Logic Design Slide 61


Lecture 2-3: Number Systems

Signed Integers
• Previous examples were for “unsigned
integers” (positive values only!)
• Must also have a mechanism to represent
“signed integers” (positive and negative
values!)
• E.g., -510 = ?2
• Two common schemes: sign-magnitude
and twos complement

ECCE 210 Digital Logic Design Slide 62


Lecture 2-3: Number Systems

Sign-Magnitude
• Extra bit on left to represent sign
– 0 = positive value
– 1 = negative value
• E.g., 6-bit sign-magnitude representation
of +5 and –5:
+5: 0 0 0 1 0 1 -5: 1 0 0 1 0 1

+ve 5 -ve 5

ECCE 210 Digital Logic Design Slide 63


Lecture 2-3: Number Systems

Ranges (revisited)
Binary
Unsigned Sign-magnitude
No. of bits Min Max Min Max

1 0 1
2 0 3 -1 1
3 0 7 -3 3
4 0 15 -7 7
5 0 31 -15 15
6 0 63 -31 31
Etc.
ECCE 210 Digital Logic Design Slide 64
Lecture 2-3: Number Systems

In General (revisited)
Binary
Unsigned Sign-magnitude
No. of bits
Min Max Min Max

n 0 n n-1
2 - 1 -(2 - 1) 2 - 1
n-1

ECCE 210 Digital Logic Design Slide 65


Lecture 2-3: Number Systems

Difficulties with Sign-Magnitude


• Two representations of zero
– Using 6-bit sign-magnitude…
• 0: 000000
• 0: 100000
• Arithmetic is awkward!

ECCE 210 Digital Logic Design Slide 66


Lecture 2-3: Number Systems

Complementary
Representations
• 1’s complement
• 2’s complement Next slides

ECCE 210 Digital Logic Design Slide 67


Lecture 2-3: Number Systems

Twos Complement
• Most common scheme of representing negative
numbers in computers
• Affords natural arithmetic (no special rules!)
• To represent a negative number in 2’s
complement notation…
1. Decide upon the number of bits (n)
2. Find the binary representation of the +ve value in n-bits
3. Flip all the bits (change 1’s to 0’s and vice versa)
4. Add 1

ECCE 210 Digital Logic Design Slide 68


Lecture 2-3: Number Systems

Twos Complement Example


• Represent -5 in binary using 2’s
complement notation 6 (for example)
1. Decide on the number of bits

2. Find the binary representation of the +ve value in


6 bits 000101 +5
111010
3. Flip all the bits 111010
+ 1 -5
4. Add 1 111011

ECCE 210 Digital Logic Design Slide 69


Lecture 2-3: Number Systems

Sign Bit
• In 2’s complement notation, the MSB is
the sign bit (as with sign-magnitude
notation)
 0 = positive value
 1 = negative value
+5: 0 0 0 1 0 1 -5: 1 1 1 0 1 1

+ve 5 -ve ? (previous slide)

ECCE 210 Digital Logic Design Slide 70


Lecture 2-3: Number Systems

“Complementary” Notation
• Conversions between positive and
negative numbers are easy
• For binary (base 2)…
2’s C

+ve -ve

2’s C

ECCE 210 Digital Logic Design Slide 71


Lecture 2-3: Number Systems

Example
+5 0 0 0 1 0 1

1 1 1 0 1 0
2’s C
+ 1

-5 1 1 1 0 1 1

0 0 0 1 0 0
2’s C
+ 1

+5 0 0 0 1 0 1

ECCE 210 Digital Logic Design Slide 72


Lecture 2-3: Number Systems

Exercise – 2’s C conversions


• What is -20 expressed as an 8-bit binary
number in 2’s complement notation?
– Answer:

• 1100011 is a 7-bit binary number in 2’s


complement notation. What is the decimal
value?
– Answer:
Skip answer Answer

ECCE 210 Digital Logic Design Slide 73


Lecture 2-3: Number Systems

Exercise – 2’sAnswer
C conversions
• What is -20 expressed as an 8-bit binary
number in 2’s complement notation?
– Answer: 1101100

• 1100011 is a 7-bit binary number in 2’s


complement notation. What is the decimal
value?
– Answer: -29

ECCE 210 Digital Logic Design Slide 74


Lecture 2-3: Number Systems

Range for 2’s Complement


• For example, 6-bit 2’s complement
notation
100000 100001 111111 000000 000001 011111

-32 -31 ... -1 0 1 ... 31

Negative, sign bit = 1 Zero or positive, sign bit = 0

ECCE 210 Digital Logic Design Slide 75


Lecture 2-3: Number Systems

Ranges (revisited)
Binary
No. of Unsigned Sign-magnitude 2’s complement
bits
Min Max Min Max Min Max

1 0 1
2 0 3 -1 1 -2 1
3 0 7 -3 3 -4 3
4 0 15 -7 7 -8 7
5 0 31 -15 15 -16 15
6 0 63 -31 31 -32 31
Etc.
ECCE 210 Digital Logic Design Slide 76
Lecture 2-3: Number Systems

In General (revisited)
Binary
No. of Unsigned Sign-magnitude 2’s complement
bits
Min Max Min Max Min Max

n 0 n n-1
2 - 1 -(2 - 1) 2 -1 -2
n-1 n-1
2
n-1
-1

ECCE 210 Digital Logic Design Slide 77


Lecture 2-3: Number Systems

2’s Complement Addition


• Easy
• No special rules
• Just add

ECCE 210 Digital Logic Design Slide 78


Lecture 2-3: Number Systems

What is -5 plus +5?


• Zero, of course, but let’s see

Sign-magnitude Twos-complement

11 1 1 1 1 11
-5: 10000101 -5: 11111011
+5: +00000101 +5: +00000101
10001010 00000000

ECCE 210 Digital Logic Design Slide 79


Lecture 2-3: Number Systems

2’s Complement Subtraction


• Easy
• No special rules
• Just subtract, well … actually … just add!

A – B = A + (-B)

add 2’s complement of B

ECCE 210 Digital Logic Design Slide 80


Lecture 2-3: Number Systems

What is 10 subtract 3?
• 7, of course, but…
• Let’s do it (we’ll use 6-bit values)
10 – 3 = 10 + (-3) = 7

+3: 000011
1s C: 111100
+1: 1 001010
-3: 111101 +111101
000111

ECCE 210 Digital Logic Design Slide 81


Lecture 2-3: Number Systems

What is 10 subtract -3?


(-(-3)) = 3
• 13, of course, but…
• Let’s do it (we’ll use 6-bit values)
10 – (-3) = 10 + (-(-3)) = 13

-3: 111101
1s C: 000010
+1: 1 001010
+3: 000011 +000011
001101

ECCE 210 Digital Logic Design Slide 82


Lecture 2-3: Number Systems

Twos Complement Examples


( + 5) 0101 ( –5 ) 1011
+ ( + 2) + 0010 + ( + 2) + 0010
( + 7) 0111 ( –3 ) 1101

( + 5) 0101 ( –5 ) 1011
+ ( –2 ) + 1110 + ( –2 ) + 1110
( + 3) 1 0011 ( –7 ) 1 1001

ignore ignore

The result is always correct since a carry from the sign-bit can be simply ignored.
This is not true for 1’s complement.

ECCE 210 Digital Logic Design Slide 83


Lecture 2-3: Number Systems

Alphanumeric Data
• There are four standards for representing
letters (alpha) and numbers
– BCD – Binary-coded decimal Next 2 slides
– ASCII – American standard code for information
interchange
– EBCDIC – Extended binary-coded decimal
interchange code
– Unicode

ECCE 210 Digital Logic Design Slide 84


Lecture 2-3: Number Systems

Binary-Coded Decimal (BCD)


• Four bits per digit Digit Bit pattern
0 0000
Note: the following bit 1 0001
patterns are not used: 2 0010
1010
3 0011
1011
1100 4 0100
1101 5 0101
1110
1111 6 0110
7 0111
8 1000
9 1001

ECCE 210 Digital Logic Design Slide 85


Lecture 2-3: Number Systems

Example
• 709310 = ? (in BCD)

7 0 9 3

0111 0000 1001 0011

ECCE 210 Digital Logic Design Slide 86


Lecture 2-3: Number Systems

The Problem
• Representing text strings, such as
“Hello, world”, in a computer

ECCE 210 Digital Logic Design Slide 87


Lecture 2-3: Number Systems

Codes and Characters


• Each character is coded as a byte
• Most common coding system is ASCII
(Pronounced ass-key)
• ASCII = American National Standard
Code for Information Interchange
• Defined in ANSI document X3.4-1977

ECCE 210 Digital Logic Design Slide 88


Lecture 2-3: Number Systems

ASCII Features
• 7-bit code
• 8th bit is unused (or used for a parity bit)
• 27 = 128 codes
• Two general types of codes:
– 95 are “Graphic” codes (displayable on a
console)
– 33 are “Control” codes (control features of
the console or communications channel)

ECCE 210 Digital Logic Design Slide 89


Lecture 2-3: Number Systems

ASCII Chart

000 001 010 011 100 101 110 111


0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL

ECCE 210 Digital Logic Design Slide 90


Lecture 2-3: Number Systems

000 001 010 011 100 101 110 111


0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL

ECCE 210 Digital Logic Design Slide 91


Lecture 2-3: Number Systems

000 001 010 011 100 101 110 111


0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 Most
$ significant
4 bit D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011Least significant
VT ESC
bit + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL

ECCE 210 Digital Logic Design Slide 92


Lecture 2-3: Number Systems
e.g., ‘a’ = 1100001

000 001 010 011 100 101 110 111


0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL

ECCE 210 Digital Logic Design Slide 93


Lecture 2-3: Number Systems
95 Graphic codes

000 001 010 011 100 101 110 111


0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL

ECCE 210 Digital Logic Design Slide 94


Lecture 2-3: Number Systems
33 Control codes

000 001 010 011 100 101 110 111


0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL

ECCE 210 Digital Logic Design Slide 95


Lecture 2-3: Number Systems
Alphabetic codes

000 001 010 011 100 101 110 111


0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL

ECCE 210 Digital Logic Design Slide 96


Lecture 2-3: Number Systems
Numeric codes

000 001 010 011 100 101 110 111


0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL

ECCE 210 Digital Logic Design Slide 97


Lecture 2-3: Number Systems
Punctuation, etc.

000 001 010 011 100 101 110 111


0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL

ECCE 210 Digital Logic Design Slide 98


Lecture 2-3: Number Systems

“Hello, world” Example


Binary Hexadecimal Decimal
H = 01001000 = 48 = 72
e = 01100101 = 65 = 101
l = 01101100 = 6C = 108
l = 01101100 = 6C = 108
o = 01101111 = 6F = 111
, = 00101100 = 2C = 44
= 00100000 = 20 = 32
w = 01110111 = 77 = 119
o = 01100111 = 67 = 103
r = 01110010 = 72 = 114
l = 01101100 = 6C = 108
d = 01100100 = 64 = 100

ECCE 210 Digital Logic Design Slide 99


Lecture 2-3: Number Systems

Ranges for Data Formats


No. of bits Binary BCD ASCII
1 0–1
2 0–3
3 0–7
4 0 – 15 0–9
5 0 – 31
6 0 – 63
7 0 – 127
8 0 – 255 0 – 99 0–9
9 0 – 511
16 0 - 65,535 0 – 9999 0 – 99
24 0 – 16,777,215 0 – 999999 0 – 999
Etc.

BCD -> Binary Coded Decimal


ECCE 210 Digital Logic Design Slide 100
Lecture 2-3: Number Systems

In General (binary)

Binary
No. of bits
Min Max

n 0 2n - 1

ECCE 210 Digital Logic Design Slide 101

You might also like