0% found this document useful (0 votes)
21 views46 pages

Encoding Schemes

Chapter 2 discusses encoding schemes and number systems used in computers, highlighting the importance of character representation through numeric codes such as ASCII, ISCII, and Unicode. It also explains various number systems including decimal, binary, octal, and hexadecimal, along with methods for converting between these systems. The chapter emphasizes the significance of binary in digital systems and provides guidelines for binary addition and conversions.

Uploaded by

thrilochan.neo
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)
21 views46 pages

Encoding Schemes

Chapter 2 discusses encoding schemes and number systems used in computers, highlighting the importance of character representation through numeric codes such as ASCII, ISCII, and Unicode. It also explains various number systems including decimal, binary, octal, and hexadecimal, along with methods for converting between these systems. The chapter emphasizes the significance of binary in digital systems and provides guidelines for binary addition and conversions.

Uploaded by

thrilochan.neo
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/ 46

Chapter – 2

Encoding Schemes
& Number system
2.1
Introduction
• Computer is a system of
hardware that performs
arithmetic operations,
manipulates data.
• In digital systems like
computers, the quantities are
represented by symbols called
Digits.
•A set of values used to
represent different quantities
is known as Number System.
• The digital computer
represents all kinds of data
When key A is pressed it is internally
mapped to a decimal value 65 which in turn
is converted into its equivalent binary value
for the computer to understand.

Encoding:
converting data into equivalent cipher
(encryption) using specific code.

Why code value “A” is 65

(It’s unique and same for all the


Some well-known encoding schemes
are as fallows

 ASCII (American Standard code for Information


interchange)

 ISCII(Indian Script code for Information


interchange)

 UNICODE
2.1 Character / String
Representation
• Computer must understand the character entered by the
user. For this purpose numeric code is assigned to each
character used in computer.
• For example:
A – assigned with code 65 –
Z 90
a – z assigned with code 97 –
0–
 Special 122
 characters
9 assigned with code 48 –
• There are various encoding scheme
57
available:
ASCII
ISCII
UNICODE
2.1.1
ASCII
• American Standard
Code for
Information
Interchange
• It is most widely used
alphanumeric code for
microcomputers and
mini-computers.
• It is 7-Bit code, so it
can
27
= 128 coderepresent
i.e.groups of possibl
maximum
character
128 e
s.
ASCII
• The ASCII code is used Few ASCII code and
to transfer alpha- characters
numeric information
between a computer
and Input / Output
device.
• A computer is also uses
it internally to store
information that an
operator types in a
computer keyboard.
• Extended ASCII uses
8 Bits i.e. 256
characters to
represent various
characters.
ASCII
Conversion of ASCII code in original message
The following is a message encodedin ASCII code. What is
messag
the
e? 100100 100010 100110 101000
0 1 0 0
Solution:

Convert each 7-bit code to its decimal


equivalent
1001000 1000101 1001100 1010000
72 69 76 80
H E L P
HELP
ASCII
Conversion of messgae into ASCII code
An operator is typing in a basic program at the keyboard of a certain
micro computer. The computer converts each keystroke into ASCII code
and stores in memory. Determine the codes that will be entered into
memory?
G O T O (space) 2 5

Solution:

G O T O (space) 2 5
71 79 84 79 32 50 53
1000111 1001111 1010100 1001111 0100000 0110010 0110101
1000111 10011111010100100111101000000110010
0110101
2.1.2
ISCII
• Indian Standard Code for
Information Interchange
• ISCII was adopted in 1991,
by Bureau of Indian
standards to have common
standard for Indian scripts
• Itis 8-Bit code, so it
can 28
=
represent maximum of
256 code groups
• It retains first 128
for ASCII
• ISCII code.
is able to represent
Indian language characters
like Tamil, Telugu, Kannada,
Oriya, Bengali, Hindi, etc.
2.1.3
• ASCII and ISCII represent characters belonging
Unicode
to different language by assigned unique code
to each characters.
• Need arises to have encoding scheme which can
represent all the known language around the
world. The result is UNICODE.
• It is the standard used worldwide.
• Its variants are UTF-8, UTF-16, UTF-32.
• Unicode 13.0 represent 143000 characters.
• Supported by most OS.
• Allows data to be transported between
different system without changes.

• UTF- Unicode Transformation Format


2.2 Number System
• The most common number systems used
are:
Decimal Number System

Binary Number System

Octal Number System

Hexadecimal Number System


2.5 Binary
Addition
• To perform binary addition, we have to follow
the simple rule as below:
 0+0=0
 0+1=1
 1+1= (0 with 1 carry to
10 left)
1+1+1
• Ifnumber (1in
of 1’s is with 1 carry
even, thetoresult will be
‘0’
= 11and ‘n’ numberleft)
of 1 will carry to left where n
is the number of pair.
• If number of 1’s is in odd, the result will be
‘1’ and ‘n’ number of 1 will carry to left where n
is the number of pair.
2.5 Binary
Addition

Carry Carry

1 1 1 1 1 1 1 1
1 1 0 0 1 1 1 0 1 1 0 1
1 1 1 0 1 1 1 1 0 1 1 0
0 0 0 0 0 0 1 0 0 0 1 1

Addition Addition Answer :


Answer :
Result Result (1100011)2
(1000000)2
2.5 Binary
Addition
Just a Minute …………… ????????????

(1011)2 (11.01)2
+ +
(110 (101.11
)2 )2
Answer : (10001)2 Answer : (1001.00)2
2.2.1 Decimal Number
System
• The decimalnumber systemuses 10 symbols,and thereforehas
a radix or base of 10.
• Symbols are [ 0 to 9 ]
• Every digit in Decimal number system is identified from its
position
i.e. from right to left as (for example 532) :-
Number 5 3 2
Position Value 102 101 100

• It means: 5 X 102 + 3 X 101 + 2 X 100


= 532
5 X 100 + 3 X 10 +
2 X 1 = 532
2.2.1 Decimal Number
System
• Left most digit which carries most weight will be MSD
(Most Significant Digit)
• Right most digit which carries least weight will be LSD
(Least Significant Digit)
2.2.2 Binary Number
System
• The binary number system uses 2 symbols, and therefore has
a radix or base of 2.
• Symbols are [ 0 and 1 ], also known as Bits or Binary Digit.
• Every bit in Binary number system is identified from its position
i.e. from right to left as (for example 110) :-

Number 1 1 0
Position Value 22 21 20

• It means: 1 X 22 + 1 X 21 + 0 X 20 will give its decimal


equivalent 1 X 4 + 1 X 2 + 0 X 1 = 6, so (110)2 = (6)10
2.2.2 Binary Number
System
• Left most digit which carries most weight will be MSB
(Most Significant Bit)
• Right most digit which carries least weight will be LSB
(Least Significant Bit)
2.2.3 Octal Number
System
• The Octal number system uses 8 symbols, and therefore has a
radix or base of 8.
• Symbols are [ 0 to 7 ]
• Every bit in Octal number system is identified from its position
i.e. from right to left as (for example 132) :-

Number 1 3 2
Position Value 82 81 80

• It means: 1 X 82 + 3 X 81 + 2 X 80 will give its decimal


equivalent 1 X 64 + 3 X 8 + 2 X 1 = 90, so (132)8 = (90)10
2.2.4 Hexadecimal Number
System
• The Hex number system uses 16 symbols, and therefore has a
radix or base of 16.
• Symbols are [ 0 to 9 and A to F ]
• 10 is represented as A and so on
• Every bit in Hex number systemis identified from its position
i.e. from right to left as (for example A2B) :-

Number A 2 B
Position Value 162 161 160

• It A X 162 + 2 X 161 + B X 160 will give its decimal


means: equivalent 10 X 256 + 2 X 16 + 11 X 1 = 2603, so
(A2B)16 = (2603)10
2.2.4 Relationships between Number
Systems
2.3 Number
Conversions
• Binary number system is
the most important one in
digital systems as it is easy
to implement in circuitry.
• Decimal system is
important as it is
universally used to
represent quantities
• outside
Octal a anddigital system.
systems
Hexadecimal provide
number
efficien an mean fo
trepresentin s r
g larg binar
numbers. e y
2.3.1 Decimal-to-Binary
Conversion
• The method of converting
decimal to binary is repeated
division method.
• For conversion follow the rules
below:
1. Divide the given decimal
number with base 2.
2. Write down the
remainder and divide the
quotient by 2.
3. Repeat Step-2 until the
quotient
is 0.
2.3.1 Decimal-to-Binary
Conversion
Just a Minute …………… ????????????

(43)10 (200)1
to 0
( )2 to
( )2
2.3.3 Decimal-to-Octal
Conversion
• A decimal integer can be
converted to octal by using the
same repeated division
method that was used for
decimal to binary conversion,
but with division factor of 8
instead of 2.
2.3.3 Decimal-to-Octal
Conversion
Just a Minute …………… ????????????

(569)1 (266)1
0 0
to to
( )8 ( )8
Answer : Answer : (412)8
(1071)8
2.3.7 Decimal-to-Hexadecimal
Conversion
• A decimal integer can be
converted to octal by using the
same repeated division
method that was used for
decimal to binary conversion,
but with division factor of
16 instead of 2.
2.3.7 Decimal-to-Hexadecimal
Conversion
Just a Minute …………… ????????????

(423) (214)
10 10
( to ( to
) 1 ) 1
6 6
Answer : Answer : (D6)16
(1A7)16
2.3.2 Binary-to-Decimal
Conversion
• Multiply each bit of binary number by its place value
i.e. 2n
(10101101)2 to ( )10

Number 1 0 1 0 1 1 0 1
Position Value 27 26 25 24 23 22 21 20

128x 64x 32x 16x0 4x 2x 1x


1 0 1 8x1 1 0 1

128 0 32 0 4 0 1
8

Answer : (173)10
2.3.2 Binary-to-Decimal
Conversion
Just a Minute …………… ????????????

(11011 (1011010
)2 1)2
( to ( to
) 1 ) 1
0 0
Answer : (27)10 Answer : (181)10
2.3.4 Octal-to-Decimal
Conversion
• Multiply each bit of binary number by its place value
i.e. 8n
(372)8 to ( )10

Number 3 7 2
Position Value 82 81 80

64x3 2x
7x8 1

19 5 2
2 6

Answer : (250)10
2.3.4 Octal-to-Decimal
Conversion
Just a Minute …………… ????????????

(263 (2001
)8 )8
( to ( to
) 1 ) 1
0 0
Answer : Answer : (1025)10
(179)10
2.3.8 Hexadecimal-to-Decimal
Conversion
• Multiply each bit of binary number by its place value
i.e. 16n
(A2B)16 to ( )10

Number A 2 B
Position Value 162 161 160

256x1 16x 11x


0 2 1

256 3 1
0 2 1

Answer : (2603)10
2.3.8 Hexadecimal-to-Decimal
Conversion
Just a Minute …………… ????????????

(2A5)1 (A37E)1
6 6
( to ( to
) 1 ) 1
0 0
Answer : (677)10 Answer : (41854)10
2.3.5 Octal-to-Binary
Conversion
• As number of bits
increases, a need arises
for grouping of bits.
• Octal number comprises of
3 bits i.e. 3 binary bits are
used to represent a octal
number.
2.3.5 Octal-to-Binary
Conversion
Just a Minute …………… ????????????

(472)8 (5431)8
to to
( )2 ( )2

Answer : (100111010)2 Answer : (101100011001)2


2.3.6 Binary-to-Octal
Conversion
• It requires grouping of 3 bits from right hand
side.
• If last group doesn’t consist 3 bits, then add
“0” to
the front(11010110110)
to make it group of 23 to
bit. ( )8

Make group of “3” 11 010 110


bits
110
Extra “0” is
added in the front
011 010 110 110
to make it group
of 3 bit. 3 2 6 6

Answer : (3266)8
2.3.6 Binary-to-Octal
Conversion
• If last group after decimal point doesn’t
consist 3 bits then add “0” to the end to
make it group of 3 bit.

(11011.0101)2 to ( )8

Make group of “3”


bits
11 011 . 010 1 Make group of “3”
bits

Extra “0” is After decimal


added in 011 011 010 100 point extra
the front to “0” is added
make
group of 3
it 3 3 2 4 to the end to
make it group
bit. of 3 bit.

Answer : (33.24)8
2.3.6 Binary-to-Octal
Conversion
Just a Minute …………… ????????????

(11010110 (10110.0101
)2 )2
to to
( )8 ( )8
Answer : (326)8 Answer : (26.24)8
2.3.9 Binary-to-Hexa
Conversion
• It requires grouping of 4 bits from right hand
side.
• If last group doesn’t consist 4 bits, then add
“0” to
(11010110110)
the front to make it group of2 4to ( ) 16
bits.

Make group of “4” 110 1011


bits
0110
Extra “0” is
added in the front
0110 1011 0110
to make it group
of 4 bits. 6 B 6

Answer : (6B6)16
2.3.9 Binary-to-Hexa
Conversion
• If last group after decimal point doesn’t
consist 4 bits then add “0” to the end to
make it group of 4 bits.

(1110111.010111)2 to ( )16

Make group of “4”


bits
111 0111 . 0101 Make group of “4”
bits
11
Extra “0” is After decimal
added in 0111 0111 0101 1100 point extra
the front to “0” is added
make
group of 4
it 7 7 5 C to the end to
make it group
bits. of 4 bits.

Answer : (77.5C)16
2.3.9 Binary-to-Hexa
Conversion
Just a Minute …………… ????????????

(101011101 (10101110.0101
0)2 11)2
( to ( to
) 1 ) 1
6 6

Answer : (2BA)16 Answer : (AE.5C)16


2.3.10 Hexa-to-Binary
Conversion
• Hexadecimal number
comprises of 4 bits i.e. 4
binary bits are used to
represent hexadecimal
number.

(9AF)16 to ( )2

9 – 1001, A – 1010, F -
1111
Answer :
(100110101111)2
2.3.10 Hexa-to-Binary
Conversion
Just a Minute …………… ????????????

(9F2)16 (3BC.5C)16
to to
( )2 ( )2

Answer : Answer :
(100111110010)2 (001110111111.01011100)2
Converting from any base to any other
base
(1948.B6)16 to ( )8

1 – 0001 9 – 1001 4 – 0100 8 – 1000 . B – 1011


Step-1 :
6 – 0110 Convert Hexa
(1948.B6)16 = (0001100101001000 . 10110110)2 to Binary

Step-2 :
Make group of “3” bits Convert
Binary to
Octa
Extra “0” is After decimal
added in 000 001 100 101 001 000 . 101 101 100 point extra
the front to “0” is added
make
group of 3
it 0 1 4 5 1 0 . 5 5 4 to the end to
make it group
bit. of 3 bit.

Answer : (14510.554)8

You might also like