0% found this document useful (0 votes)
17 views26 pages

Introduction To Number Systems & Codes: Dr. Sampad Ghosh

The document is a course outline for EEE-351: Digital Electronics at Chittagong University of Engineering and Technology, covering topics such as number systems, binary and decimal conversions, and various coding methods like BCD and Gray code. It includes detailed explanations of digital number systems, their conversions, and applications in digital circuits. Additionally, it provides self-study recommendations and references for further reading.

Uploaded by

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

Introduction To Number Systems & Codes: Dr. Sampad Ghosh

The document is a course outline for EEE-351: Digital Electronics at Chittagong University of Engineering and Technology, covering topics such as number systems, binary and decimal conversions, and various coding methods like BCD and Gray code. It includes detailed explanations of digital number systems, their conversions, and applications in digital circuits. Additionally, it provides self-study recommendations and references for further reading.

Uploaded by

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

Level-3, Term-1 (‘19th Batch)

EEE-351: Digital Electronics


Introduction to number systems & codes
Dr. Sampad Ghosh
Associate Professor
Department of Electrical and Electronic Engineering
Faculty of Electrical and Computer Engineering
Chittagong University of Engineering and Technology (CUET)

May 10, 2023


CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET)
KYUSHU UNIVERSITY
Topics Reference
Introduction to number systems & codes
Numerical representation, Digital & Analog systems,
Digital number systems, Binary to Decimal
conversions, Decimal to Binary conversions, Hexa-
Tocci
decimal number systems, BCD code, The Gray code,
Alphanumeric codes, Parity method for error
detection
Octal & Hexa-decimal numbers, Complements Mano

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 2


Digital Number Systems
 Understanding digital systems requires an understanding of decimal,
binary, octal, and hexadecimal numbering systems.
o Decimal – 10 symbols (base 10)
o Hexadecimal – 16 symbols (base 16)
o Octal – 8 symbols (base 8)
o Binary – 2 symbols (base 2)

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 3


Digital Number Systems …
 Decimal System (base 10)
o 10 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
 Each number is a digit (from Latin for finger [10 fingers]).
Positional values (weights)

Most significant digit Least significant digit

Positional value stated as a digit multiplied by a power of 10.

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 4


Digital Number Systems …
 Decimal Counting

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 5


Digital Number Systems …
 Binary System (base 2)
o 2 symbols: 0, 1.
 Lends itself to electronic circuit design since only two different
voltage levels are required.
Positional
values

Binary digit referred as bit.

Positional value stated as a digit


multiplied by a power of 2.
Most significant bit Least significant bit

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 6


Digital Number Systems …
 Binary Counting Weights

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 7


Representing Binary Quantities
 Typical representation of two states of a digital signal.

 A higher range of voltages represent


a valid 1 and a lower range of
voltages represent a valid 0.
 HIGH and LOW are often used to
describe the states of a digital
system — instead of “1” and “0”.

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 8


Digital Circuits/Logic Circuits
 Digital circuits - produce & respond to predefined voltage ranges.
 The term logic circuits is used interchangeably.

 A digital circuit responds to


an input’s binary level of 0 or
1 — not to its actual voltage.

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 9


Binary to Decimal Conversion
 Convert binary to decimal by summing the positions that contain a 1.
MSB LSB

MSB
 The double-dabble method avoids
addition of large numbers:
1. Write down the left-most (MSB) 1 in the
binary number.
2. Double it and add the next bit to the right.
3. Write down the result under the next bit.
4. Continue with steps 2 and 3 until finished
with the binary number.
CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 10
Decimal to Binary Conversion
 Reverse process described in section 2.1. (All positions must be accounted for)

45-32=13
64 32 16 8 4 2 1
13-8=5
1 0 1 1 0 1 5-4=1
1-1=0

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 11


Decimal to Binary Conversion …

 Repeated Division:
1. Divide the decimal number by 2.
2. Write the remainder after each division
until a quotient of zero is obtained.
3. The first remainder is the LSB.
4. The last is the MSB.

Test: (37)10 = (100101)2

Ans.: (37)10 = (100101)2

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 12


Hexadecimal Number System
 Hexadecimal allows convenient handling of long binary strings, using
groups of 4 bits (base 16)
o 16 symbols: 0, 1, 2, 3, 4, 5, 6 , 7, 8, 9, A, B, C, D, E, F.

Positional values (weights)

Positional value stated as a digit multiplied by a power of 16.

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 13


Hexadecimal Number System …
 Relationships between hexadecimal,
decimal, and binary numbers

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 14


Hex to Decimal Conversion and vice versa
 Convert from hex to decimal by multiplying each hex digit by its
positional weight.

 Convert from decimal to hex by


using the repeated division method
used for decimal to binary
conversion.
Test: (214)10 = (DB)16
Ans.: (214)10 = (D6)16

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 15


Hex to Binary Conversion and vice versa
 Leading zeros can be added to the left of the MSB to fill out the last
group.

 Convert from binary to hex by


(1110100110)2 = 0011 1010 0110
grouping bits in four starting with
= (3A6)16
the LSB.
o Each group is then converted to the
hex equivalent.

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 16


BCD Code
 Binary Coded Decimal (BCD) is a widely used way to present decimal
numbers in binary form.
o Combines features of both decimal and binary systems.
o Each digit is converted to a binary equivalent.
o A decimal digit can be as large as 9, four bits are required to code each
digit.

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 17


BCD Code …
 Convert the number (874)10 to BCD:
o Each decimal digit is
represented using 4 bits.
o Each 4-bit group can never be
greater than 9.

 BCD includes 0000 – 1001 (0-9)


 BCD does not use 1010, 1011, 1100, 1101, 1110, 1111 (A-F)

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 18


Comparison of BCD and Binary
 BCD is not a number system!
o It is a decimal number with each digit encoded to its binary equivalent.

128 64 32 16 8 4 2 1
(137)10 = (10001001)2
1 0 0 0 1 0 0 1

(137)10 = 0001 0011 0111 (BCD)

 A BCD number is not the same as a straight binary number.


 The primary advantage of BCD is the relative ease of converting to and
from decimal. Only 4-bit code groups for decimal digits 0-9 to be
remembered.

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 19


Gray Code
 The Gray code is used in applications where numbers change rapidly.
o Only 1-bit changes from each value to the next.
Binary to Gray
3-bit Binary and Gray code equivalent

Same bit 0
Different 1
Gray to Binary

 Application in shaft position encoders

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 20


Putting It All Together

 1 Byte = 8 bits
 1 Word = 2 Bytes
= 16 bits
 Nibble = 4 bits

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 21


Octal Number
 Each octal digit corresponds to three binary digits (23 = 8)

 Binary to Octal

(10110001101011.111100000110)2 = (26153.7406)8
010 110 001 101 011. 111 100 000 110
2 6 1 5 3. 7 4 0 6

 Octal to Binary

(673.124)8 = (110 111 011.001 010 100)2

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 22


Number base Conversions
 Any r-base conversion to Decimal

(an.rn + an-1.rn-1 +......... +a2.r2 + a1.r1 + a0.r0 + a-1.r-1 + a-2.r-2 +.....+ a-m.r-m)10
n = position (before ., if any)
r = 2 (Binary), 8 (Octal), 16 (decimal)
m = position (after ., if any)

(1010.011)2 = (10.375)10 (1010.011)2 = (10.375)10


Test (630.4)8 = (408.5)10 Ans. (630.4)8 = (408.5)10
(B65F)16 = (46687)10 (B65F)16 = (46687)10

 What happened for reverse cases?

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 23


Number base Conversions …
Integer remainder
 Conversion of Integer
41÷2= 20 1 LSB
(41)10=(101001)2 20÷2= 10 0
Divided by the desired base 10÷2= 5 0
5÷2= 2 1
2÷2= 1 0
1÷2= 0 1 MSB
 Conversion of Fraction
(0.6875)10=(0.1011)2 Integer fraction
0.6875×2= 1 .375
Multiplied by the desired base
0.375×2= 0 .75
0.75×2= 1 .5
Test: (41.6875)10=(101001.1011)2 0.5×2= 1 .0
Ans.: (41.6875)10=(101001.1011)2

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 24


Self Study

 Alphanumeric codes
 Parity method for error detection
 Problems from Tocci and Mano

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 25


Summary
 Introduce with binary representation
 BCD Code
 Gray Code
 Base conversion

CHITTAGONG UNIVERSITY OF ENGINEERING AND TECHNOLOGY (CUET) 26

You might also like