SlideShare a Scribd company logo
1 of 58
Download to read offline
DATA REPRESENTATION
Prof. K ADISESHA (Ph. D)
Contents-
Introduction
Data Representation
Number System Conversions
Binary Arithmetic
Computer Codes
2
Prof. K. Adisesha (Ph. D)
Classification of Number
systems
INTRODUCTION
Prof. K. Adisesha (Ph. D)
3
DATA REPRESENTATION:
In Digital Computer, data and instructions are stored in computer memory
using binary code (or machine code) represented by Binary digIT’s 1 and 0
called BIT’s.
 The data may contain digits, alphabets or special character, which are
converted to bits, understandable by the computer.
 The number system uses well defined symbols called digits.
DATA REPRESENTATION
Classification:
Number systems are basically classified into two types.
They are:
 Non-positional number system
 Positional number system
Prof. K. Adisesha (Ph. D)
4
DATA REPRESENTATION
Non-Positional Number System:
In olden days people use of this type of number system for simple calculations like
additions and subtractions.
 The non-positional number system consists of different symbols that are used to
represent numbers.
 Roman number system is an example of the non-positional number system i.e. I=1,
V=5, X=10, L=50.
 This number system cannot be used effectively to perform arithmetic operations.
Prof. K. Adisesha (Ph. D)
5
DATA REPRESENTATION
Positional Number System:
This type of number system is used determine the quantity that the number
represents based on the position in which there are placed.
 The total number of digits present in any number system is called its Base or
Radix.
 Every number is represented by a base (or radix) x, which represents x digits.
 The base is written after the number as subscript such as 512(10).It is a Decimal
number as its base is 10.
Prof. K. Adisesha (Ph. D)
6
DATA REPRESENTATION
Positional Number System:
The various types of number system are classified as:
 Decimal number system
 Binary number system
 Octal number system
 Hexadecimal number system
Prof. K. Adisesha (Ph. D)
7
Positional Number System
Decimal Number System:
 It is the most widely used number system.
 The decimal number system consists of 10 digits from 0 to 9.
 It has 10 digits and hence its base or radix is 10.
 These digits can be used to represent any numeric value.
 Example: 123(10), 456(10), 7890(10).
 Consider a decimal number 542.76(10) which can be represented in equivalent
value as:
5x102 + 4x101 + 2x100 + 7x10-1 + 6x10-2
Prof. K. Adisesha (Ph. D)
8
Positional Number System
Binary Number System:
Digital computer represents all kinds of data and information in the binary
system.
 Binary number system consists of two digits 0 (low voltage) and 1 (high
voltage).
 Its base or radix is 2.
 Each digit or bit in binary number system can be 0 or 1.
 The positional values are expressed in power of 2.
Prof. K. Adisesha (Ph. D)
9
Positional Number System
Binary Number System:
Digital computer represents all kinds of data and information in the binary
system.
Prof. K. Adisesha (Ph. D)
10
Positional Number System
Binary Number System:
Each digit or bit in binary number system can be 0 or 1 and the positional
values are expressed in power of 2.
 The left most bit 1 is the highest order bit. It is called as Most Significant Bit
(MSB).
 The right most bit 0 is the lower bit. It is called as Least Significant Bit (LSB).
 Example: 1011(2), 111(2), 100001(2)
 Consider a binary number 11011.10(2) which can be represented in equivalent
value as:
1x24 + 1x23 +0x22 + 1x21 + 1x20 + 1x2-1 + 0x2-2
Prof. K. Adisesha (Ph. D)
11
Positional Number System
Octal Number System:
The octal number system has digits starting from 0 to 7. The base or radix of
this system is 8.
 The positional values are expressed in power of 8.
 Any digit in this system is always less than 8.
 Example: 123(8), 236(8), 564(8)
 The number 6418 is not a valid octal number because 8 is not a valid digit.
 Consider a Octal number 234.56(8) which can be represented in equivalent value
as:
2x82 + 3x81 + 4x80 + 5x8-1 + 6x8-2
Prof. K. Adisesha (Ph. D)
12
Positional Number System
Hexadecimal Number System:
The hexadecimal number system consists of 16 digits from 0 to 9 and A to F.
The letters A to F represent decimal numbers from 10 to 15.
 That is, ‘A’ represents 10, ‘B’ represents 11, ‘C’ represents 12, ‘D’ represents 13, ‘E’
represents 14 and ‘F’ represents 15.
 The base or radix of this number system is 16.
 Example: 1A3(16), BCA(16), 56C(H)
 Consider a Octal number 2AF.D6(16) which can be represented in equivalent
value as:
2x162 + Ax161 + Fx160 + Dx16-1 + 6x16-2
Prof. K. Adisesha (Ph. D)
13
Positional Number System
Number Systems:
Prof. K. Adisesha (Ph. D)
14
DATA CONVERSIONS
Number System Conversions:
The various types of number system are classified as:
 Conversion from Decimal to Binary
 Conversion from Decimal to Octal
 Conversion from Decimal to Hexadecimal
 Conversion from Binary to Octal
 Conversion from Binary to Hexadecimal
 Conversion from Octal to Hexadecimal
Prof. K. Adisesha (Ph. D)
15
DATA CONVERSIONS
Conversion from Decimal to Binary:
Steps to convert decimal number to binary number:
• Step 1: Divide the given decimal number by 2.
• Step 2: Take the remainder and record it on the right side.
• Step 3: Repeat the Step 1 and Step 2 until the decimal number cannot be
divided further.
• Step 4: The first remainder will be the LSB and the last remainder is the
MSB.
 The equivalent binary number is then written from left to right i.e. from MSB to
LSB.
Prof. K. Adisesha (Ph. D)
16
DATA CONVERSIONS
Conversion from Decimal to Binary:
 The equivalent binary number is then written from left to right i.e. from MSB to LSB.
Thus 458(10)= 11001010(2)Prof. K. Adisesha (Ph. D)
17
DATA CONVERSIONS
Conversion from Decimal to Binary:
Steps to convert decimal fraction number to binary number:
• Step 1: Multiply the given decimal fraction number by 2.
• Step 2: Note the carry and the product.
• Step 3: Repeat the Step 1 and Step 2 until the decimal number cannot be
divided further.
• Step 4: The first carry will be the MSB and the last carry is the LSB.
 The equivalent binary fraction number is written from MSB to LSB.
Prof. K. Adisesha (Ph. D)
18
DATA CONVERSIONS
Conversion from Decimal to Binary:
 The equivalent binary number is then written from left to right i.e. from MSB to LSB.
Thus 458(10)= 11001010.1011(2)Prof. K. Adisesha (Ph. D)
19
DATA CONVERSIONS
Conversion from Binary to Decimal :
Steps to convert binary number to decimal number:
• Step 1: Start at the rightmost bit.
• Step 2: Take that bit and multiply by 2n, when n is the current position
beginning at 0 and increasing by 1 each time. This represents a power of
two.
• Step 3: Then, add all the products.
• Step 4: After addition, the resultant is equal to the decimal value of the
binary number
Prof. K. Adisesha (Ph. D)
20
DATA CONVERSIONS
Conversion from Binary to Decimal :
Prof. K. Adisesha (Ph. D)
21
DATA CONVERSIONS
Conversion from Decimal to Octal:
Steps to convert decimal number to octal number:
• Step 1: Divide the given decimal number by 8.
• Step 2: Take the remainder and record it on the right side.
• Step 3: Repeat the Step 1 and Step 2 until the decimal number cannot be
divided further.
• Step 4: The first remainder will be the LS-Digit and the last remainder is
the MS-Digit.
 The equivalent binary number is then written from left to right i.e. from MS-
Digit to LS-Digit.
Prof. K. Adisesha (Ph. D)
22
DATA CONVERSIONS
Conversion from Decimal to Octal:
Prof. K. Adisesha (Ph. D)
23
DATA CONVERSIONS
Conversion from octal to decimal number:
Steps to convert octal number to decimal number:
• Step 1: Start at the rightmost bit.
• Step 2: Take that bit and multiply by 8n, when n is the current position
beginning at 0 and increasing by 1 each time. This represents the power of 8.
• Step 3: Then, add all the products.
• Step 4: After addition, the resultant is equal to the decimal value of the octal
number.
Prof. K. Adisesha (Ph. D)
24
DATA CONVERSIONS
Conversion from octal to decimal number:
Prof. K. Adisesha (Ph. D)
25
DATA CONVERSIONS
Conversion from Decimal to Hexadecimal:
Steps to convert decimal number to hexadecimal number:
• Step 1: Divide the given decimal number by 16.
• Step 2: Take the remainder and record it on the right side.
• Step 3: Repeat the Step 1 and Step 2 until the decimal number cannot be
divided further.
• Step 4: The first remainder will be the LS-Digit and the last remainder is
the MS-Digit.
 The equivalent binary number is then written from left to right i.e. from MS-
Digit to LS-Digit.
Prof. K. Adisesha (Ph. D)
26
DATA CONVERSIONS
Conversion from Decimal to Hexadecimal:
Example: to convert decimal number 38010 to hexadecimal number:
 The equivalent binary number is then written from left to right i.e. from MS-
Digit to LS-Digit.
Prof. K. Adisesha (Ph. D)
27
DATA CONVERSIONS
Conversion from hexadecimal to decimal number:
Steps to convert hexadecimal number to decimal number:
• Step 1: Start at the rightmost bit.
• Step 2: Take that bit and multiply by 16n, when n is the current position
beginning at 0 and increasing by 1 each time. This represents the power of
16.
• Step 3: Then, add all the products.
• Step 4: After addition, the resultant is equal to the decimal value of the
hexadecimal number.
Prof. K. Adisesha (Ph. D)
28
DATA CONVERSIONS
Conversion from hexadecimal to decimal number:
Prof. K. Adisesha (Ph. D)
29
DATA CONVERSIONS
Conversion from Binary to Octal:
Steps to convert Binary to octal:
• Step 1: Take a binary number in groups of 3 and use the appropriate octal digit in
its place.
• Step 2: Begin at the rightmost 3 bits. If we are not able to form a group of three,
insert 0s to the left until we get all groups of 3 bits each.
• Step 3: Write the octal equivalent of each group.
• Step 4: Repeat the steps until all groups have been converted.
 It may be necessary to add a 0’s to the left of MSB and when representing fractions, it
may be necessary to add a 0’s to right of LSB.
Prof. K. Adisesha (Ph. D)
30
DATA CONVERSIONS
Conversion from Binary to Octal:
Prof. K. Adisesha (Ph. D)
31
DATA CONVERSIONS
Conversion from Octal to Binary:
Steps to convert octal to binary:
• Step 1: Take the each digit from octal number.
• Step 2: Convert each digit to 3-bit binary number. (Each octal digit is represented
by a three- bit binary number as shown in Numbering System Table).
• Step 3: Write the Binary equivalent of each group.
Prof. K. Adisesha (Ph. D)
32
DATA CONVERSIONS
Conversion from Binary to Hexadecimal:
Steps to convert Binary to Hexadecimal:
• Step 1: Take a binary number in groups of 4 and use the appropriate hexadecimal
digit in its place.
• Step 2: Begin at the rightmost 4 bits. If we are not able to form a group of four,
insert 0s to the left until we get all groups of 4 bits each.
• Step 3: Write the hexadecimal equivalent of each group.
• Step 4: Repeat the steps until all groups have been converted.
 It may be necessary to add a 0’s to the left of MSB and when representing fractions, it
may be necessary to add a 0’s to right of LSB.
Prof. K. Adisesha (Ph. D)
33
DATA CONVERSIONS
Conversion from Hexadecimal to Binary:
Steps to convert hexadecimal to binary:
• Step 1: Take the each digit from hexadecimal number.
• Step 2: Convert each digit to 4-bit binary number. (Each hexadecimal digit is
represented by a four- bit binary number as shown in Numbering System Table).
• Step 3: Write the Binary equivalent of each group.
Prof. K. Adisesha (Ph. D)
34
DATA CONVERSIONS
Conversion from Octal to Hexadecimal:
Steps to convert Octal to Hexadecimal:
• Step 1: write the binary equivalent of each octal digit.
• Step 2: Regroup them into 4 bits from the right side with zeros added, if necessary.
• Step 3: Convert each group into its equivalent hexadecimal digit.
 Using Binary system, we can easily convert octal numbers to hexadecimal numbers and
vice-versa.
Prof. K. Adisesha (Ph. D)
35
Binary Arithmetic
Binary Addition:
The addition of two binary numbers is performed in same manner as the
addition of decimal number.
 It adds only two bits and gives sum and carry. If a carry is generated, it should be
carried over to the addition of next two bits.
 The basic rules of binary addition are:
Prof. K. Adisesha (Ph. D)
36
Addend1 Addend2 Sum Carry
0 0 0 0
O 1 1 0
1 0 1 0
1 1 0 1
Binary Arithmetic
Binary Subtraction:
This operation is same as the one performed in the decimal number system.
 This operation is consists of two steps:
 Determine whether it is necessary for us to borrow. If the subtrahend (the lower digit) is
larger than the minuend (the upper digit), it is necessary to borrow from the column to the
left. In binary two is borrowed.
 Subtract the lower value from the upper value
 The basic rules of binary subtraction are:
 When we subtract 1 from 0, it is necessary
to borrow 1 from the next left column
i.e. from the next higher order position.
Prof. K. Adisesha (Ph. D)
37
Minuend Subtrahend Difference Barrow
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
Binary Arithmetic
Binary Addition & Subtraction:
This operation is same as the one performed in the decimal number system.
Prof. K. Adisesha (Ph. D)
38
Binary Arithmetic
Binary Subtraction:
Example: Subtract the following numbers
a) 10 from 14 b) 9 from 29 c) 3 from 5.
Prof. K. Adisesha (Ph. D)
39
Binary Arithmetic
Representation of signed Integers:
The digital computer handle both positive and negative integer.
 It means, is required for representing the sign of the number (- or +), but cannot use the
sign (-) to denote the negative number or sign (+) to denote the positive number.
 So, this is done by adding the leftmost bit to the number called sign bit.
 A positive number has a sign bit 0, while the negative has a sign bit 1.
Prof. K. Adisesha (Ph. D)
40
Binary Arithmetic
Representation of signed Integers:
It is also called as fixed point representation.
 A negative signed integer can be represented in one of the following:
 Sign and magnitude method
 One’s complement method
 Two’s complement method
Prof. K. Adisesha (Ph. D)
41
Binary Arithmetic
Sign and magnitude method:
An integer containing a sign bit followed by magnitude bits are called sign-
magnitude integer.
 In this method, first bit (MSB) is considered as a sign bit and the remaining bits stand
for magnitude.
 Here positive number starts with 0 and negative number starts with 1.
 Example: The binary number is 11001(2). If we take the size of the word is 1 byte ( 8
bits), then the number 25 will be represented as
Prof. K. Adisesha (Ph. D)
42
Binary Arithmetic
1’s Complement representation:
The 1’s complement of a binary number is obtained by changing each 0 to 1
and each 1 to 0.
 This is the simplest method of representing negative binary number.
 In this method, change each bit in the number to its complement.
 Example: Find the 1’s complement of 101000.
Original binary number : 1 0 1 0 0 0
Find 1’s Complement : 0 1 0 1 1 1
Thus 1’s complement of: 101000 is 010111.
Prof. K. Adisesha (Ph. D)
43
Binary Arithmetic
2’s Complement representation:
The 2’s complement of a binary number is obtained by taking 1’s complement of
the number and adding 1 to the Least Significant Bit (LSB) position.
 The general procedure to find 2’s complement is given by:
2’s Complement = 1’s Complement + 1
 Example 1: Find the 2’s complement of: 101000.
 Original binary number : 1 0 1 0 0 0
 Find 1’s Complement : 0 1 0 1 1 1
 Add 1 to LSB + 1
 Hence 2’s Complement of 101000 is: 0 1 1 0 0 0
Prof. K. Adisesha (Ph. D)
44
Binary Arithmetic
Subtraction of Binary Number using Complement:
Most of the computers perform subtraction using complemented number.
 This is less expensive because the same addition circuit is used for subtraction with
slight changes in the circuit.
 In the binary number system we can perform subtraction operation using two methods
of complements:
 Subtraction using 1’s Complement
 Subtraction using 2’s Complement
Prof. K. Adisesha (Ph. D)
45
Binary Arithmetic
Subtraction using 1’s Complement:
Subtraction using 1’s Complement is performed using two cases.
 Case 1: Subtracting a larger number from a smaller number (Minuend is less than
Subtrahend)
o Step 1: Find the 1’s complement of the subtrahend.
o Step 2: Add this to the minuend.
o Step 3: There will be no carry, Re complement the answer to get the difference
Prof. K. Adisesha (Ph. D)
46
Binary Arithmetic
Subtraction using 1’s Complement:
 Example : Subtract 52 from 25 using 1’s complement.
Decimal Binary
Decimal Binary Minuend 25 : 011001
Subtrahend -52 : 110100
1’s complement of subtrahend is : 001011
Minuend : 0 1 1 0 0 1
1’s Complement of subtrahend : + 0 0 1 0 1 1
: 1 0 0 1 0 0
 Since there is no carry take 1’s complement : 0 1 1 0 1 1 attach a negative sign Hence,
the result = - 011011 i.e. - 27
Prof. K. Adisesha (Ph. D)
47
Binary Arithmetic
Subtraction using 1’s Complement:
Subtraction using 1’s Complement is performed using two cases.
 Case 2: Subtracting a smaller number from a larger number (Minuend is greater than
Subtrahend)
o Step 1: Find the 1’s complement of the subtrahend.
o Step 2: Add this to the minuend.
o Step 3: Carry is generated, this carry is called as the end around carry
o Step 4: Add the end around carry back to the LSB to get the final difference
Prof. K. Adisesha (Ph. D)
48
Binary Arithmetic
Subtraction using 1’s Complement:
 Example : Subtract 15 from 25 using 1’s complement.
Decimal Binary
Minuend 25 : 11001
Subtrahend -15 : 01111
1’s complement of subtrahend is : 10000
Minuend : 1 1 0 0 1
1’s Complement of subtrahend : + 1 0 0 0 0
Since there is carry add carry to LSB : 1 0 1 0 0 1
+1
 MSB is zero : 0 1 0 1 0 attach a Positive sign Hence, the result = + 01010 i.e. +10
Prof. K. Adisesha (Ph. D)
49
Computer Codes
Computer Codes:
Computer code helps us to represent characters in a coded form in the memory of
the computer.
 These codes represent specific formats which are used to record data.
 Some of the commonly used computer codes are:
 Binary Coded Decimal (BCD)
 Extended Binary Coded Decimal Interchange Code (EBCDIC)
 American Standard Code for Information Interchange (ASCII)
 Excess-3 Code.
Prof. K. Adisesha (Ph. D)
50
Computer Codes
BCD code (or Weighted BCD Code or 8421 Code):
BCD stands for Binary Coded Decimal.
 It is one of the early computer codes.
 In this coding system, the bits are given from left to right, the weights 8,4,2,1
respectively
 In 4-bit BCD only 24=16 configurations are possible which is insufficient to represent
the various characters.
 Hence 6-bit BCD code was developed by adding two zone positions with which it is
possible to represent 26=64 characters
Prof. K. Adisesha (Ph. D)
51
Computer Codes
BCD code (or Weighted BCD Code or 8421 Code):
The BCD equivalent of each decimal digit is shown in table.
Prof. K. Adisesha (Ph. D)
52
Decimal BCD Code Decimal BCD Code
0 0000 5 0101
1 0001 6 0110
2 0010 7 0111
3 0011 8 1000
4 0100 9 1001
Computer Codes
Excess-3 BCD code (or XS-3 Code):
BCD stands for Binary Coded Decimal.
 The Excess-3 BCD code is a non-weighted code used to express decimal number.
 The name Excess-3 code derived from the fact that each binary code is the
corresponding BCD code plus 0011(2)(i.e. Decimal 3).
 This code is used in some old computers.
 The Excess-3 code equivalent of decimal (0-9)
Prof. K. Adisesha (Ph. D)
53
Computer Codes
Excess-3 code (or Non-Weighted Code):
The following table gives the Excess-3 code equivalent of decimal (0-9)..
Prof. K. Adisesha (Ph. D)
54
Decimal XS-3 Code Decimal XS-3 Code
0 0011 5 1000
1 0100 6 1001
2 0101 7 1010
3 0110 8 1011
4 0111 9 1100
Computer Codes
ASCII Code:
It stands for the American Standard Code for Information Interchange.
 It is a 7-bit code, which is possible to represent 27=128 characters.
 It is used in most microcomputers and minicomputers and in mainframes.
 The ASCII code (Pronounced ask-ee) is of two types – ASCII-7 and ASCII-8.
 ASCII-7 is 7-bit code for representing English characters as numbers, with each letter
assigned a number from 0 to 127.
Prof. K. Adisesha (Ph. D)
55
Computer Codes
EBCDIC:
It stand for Extended Binary Coded Decimal Interchange Code.
 This was developed by IBM.
 It uses an 8-bit code and hence possible to represent 256 different characters or bit
combinations. EBCDIC is used on most computers and computer equipment today.
 It is a coding method generally used by larger computers (mainframes) to present
letters, numbers or other symbols in a binary language the computer can understand.
 EBCDIC is an 8-bit code; therefore, it is divided into two 4-bit groups, where each
4-bit can be represented as 1 hexadecimal digit.
Prof. K. Adisesha (Ph. D)
56
Computer Codes
UNICODE:
Unicode is a universal character encoding standard that assigns a code to every
character and symbol in every language in the world.
 Unicode is the only encoding standard that ensures that you can retrieve or combine
data using any combination of languages.
 Unicode may be 8-bit, 16-bit, or 32-bit.
 The two common Unicode implementations for computer systems are:
 UTF-8, a variable length encoding scheme in which each written symbol is represented by a one- to
four-byte code
 UTF-16, a fixed width encoding scheme in which each written symbol is represented by a two-byte
code
Prof. K. Adisesha (Ph. D)
57
Discussion
Prof. K. Adisesha (Ph. D)
58
Queries ?
Prof. K. Adisesha

More Related Content

What's hot

What's hot (20)

Introduction to computing
Introduction to computingIntroduction to computing
Introduction to computing
 
Chapter 1 computer fundamentals
Chapter 1 computer  fundamentalsChapter 1 computer  fundamentals
Chapter 1 computer fundamentals
 
Data representation
 Data representation Data representation
Data representation
 
BINARY NUMBER SYSTEM
BINARY NUMBER SYSTEMBINARY NUMBER SYSTEM
BINARY NUMBER SYSTEM
 
Classification of computer
Classification of computerClassification of computer
Classification of computer
 
Binary number system
Binary number systemBinary number system
Binary number system
 
Number system
Number systemNumber system
Number system
 
Analog and digital
Analog and digitalAnalog and digital
Analog and digital
 
Decimal, Binary, Octal, And Hexadecimal number systems.
Decimal, Binary, Octal, And Hexadecimal number systems.Decimal, Binary, Octal, And Hexadecimal number systems.
Decimal, Binary, Octal, And Hexadecimal number systems.
 
Introduction to Computers
Introduction to ComputersIntroduction to Computers
Introduction to Computers
 
Computer Organization and Architecture.
Computer Organization and Architecture.Computer Organization and Architecture.
Computer Organization and Architecture.
 
Number system conversion
Number system conversionNumber system conversion
Number system conversion
 
System Software vs.Application Software
System Software vs.Application SoftwareSystem Software vs.Application Software
System Software vs.Application Software
 
Functional units of computer
Functional units of computerFunctional units of computer
Functional units of computer
 
Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)
 
Number system and codes
Number system and codesNumber system and codes
Number system and codes
 
Number Systems
Number SystemsNumber Systems
Number Systems
 
1.1.1 BINARY SYSTEM
1.1.1 BINARY SYSTEM1.1.1 BINARY SYSTEM
1.1.1 BINARY SYSTEM
 
Data Representation
Data RepresentationData Representation
Data Representation
 
Number System
Number SystemNumber System
Number System
 

Similar to Data representation

Week 4-Number Systems.pptx
Week 4-Number Systems.pptxWeek 4-Number Systems.pptx
Week 4-Number Systems.pptx
HamnaKhalid25
 
Numbersystem 130621192712-phpapp02
Numbersystem 130621192712-phpapp02Numbersystem 130621192712-phpapp02
Numbersystem 130621192712-phpapp02
muhammadsarab
 

Similar to Data representation (20)

Data representation in computers
Data representation in computersData representation in computers
Data representation in computers
 
digital-180612132737.pdf
digital-180612132737.pdfdigital-180612132737.pdf
digital-180612132737.pdf
 
DIGITAL DESIGN
DIGITAL DESIGNDIGITAL DESIGN
DIGITAL DESIGN
 
Data repersentation.
Data repersentation.Data repersentation.
Data repersentation.
 
Digital Electronics- Number systems & codes
Digital Electronics- Number systems & codes Digital Electronics- Number systems & codes
Digital Electronics- Number systems & codes
 
Number-Systems presentation of the mathematics
Number-Systems presentation of the mathematicsNumber-Systems presentation of the mathematics
Number-Systems presentation of the mathematics
 
Cse 112 number system-[id_142-15-3472]
Cse 112 number system-[id_142-15-3472]Cse 112 number system-[id_142-15-3472]
Cse 112 number system-[id_142-15-3472]
 
Week 4-Number Systems.pptx
Week 4-Number Systems.pptxWeek 4-Number Systems.pptx
Week 4-Number Systems.pptx
 
Introduction to number system
Introduction to number systemIntroduction to number system
Introduction to number system
 
Data Representation
Data RepresentationData Representation
Data Representation
 
NUMBER SYSTEM.pptx
NUMBER  SYSTEM.pptxNUMBER  SYSTEM.pptx
NUMBER SYSTEM.pptx
 
Csc 2313 (lecture 3)
Csc 2313 (lecture 3)Csc 2313 (lecture 3)
Csc 2313 (lecture 3)
 
Csc 2313 (lecture 3)
Csc 2313 (lecture 3)Csc 2313 (lecture 3)
Csc 2313 (lecture 3)
 
DATA REPRESENTATION.pptx
DATA REPRESENTATION.pptxDATA REPRESENTATION.pptx
DATA REPRESENTATION.pptx
 
Numbersystem 130621192712-phpapp02
Numbersystem 130621192712-phpapp02Numbersystem 130621192712-phpapp02
Numbersystem 130621192712-phpapp02
 
Anup Barman number system electronicdevice ECE.pptx
Anup Barman number system electronicdevice ECE.pptxAnup Barman number system electronicdevice ECE.pptx
Anup Barman number system electronicdevice ECE.pptx
 
Data representation
Data representationData representation
Data representation
 
chap1.pdf
chap1.pdfchap1.pdf
chap1.pdf
 
chap1.pdf
chap1.pdfchap1.pdf
chap1.pdf
 
chap1.pdf
chap1.pdfchap1.pdf
chap1.pdf
 

More from Prof. Dr. K. Adisesha

More from Prof. Dr. K. Adisesha (20)

Software Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfSoftware Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdf
 
Software Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfSoftware Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdf
 
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfSoftware Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
 
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfSoftware Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
 
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfSoftware Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
 
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfSoftware Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
 
Computer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaComputer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. Adisesha
 
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaCCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
 
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. AdiseshaCCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
 
CCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. AdiseshaCCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. Adisesha
 
CCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdfCCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdf
 
Introduction to Computers.pdf
Introduction to Computers.pdfIntroduction to Computers.pdf
Introduction to Computers.pdf
 
R_Programming.pdf
R_Programming.pdfR_Programming.pdf
R_Programming.pdf
 
Scholarship.pdf
Scholarship.pdfScholarship.pdf
Scholarship.pdf
 
Operating System-2 by Adi.pdf
Operating System-2 by Adi.pdfOperating System-2 by Adi.pdf
Operating System-2 by Adi.pdf
 
Operating System-1 by Adi.pdf
Operating System-1 by Adi.pdfOperating System-1 by Adi.pdf
Operating System-1 by Adi.pdf
 
Operating System-adi.pdf
Operating System-adi.pdfOperating System-adi.pdf
Operating System-adi.pdf
 
Data_structure using C-Adi.pdf
Data_structure using C-Adi.pdfData_structure using C-Adi.pdf
Data_structure using C-Adi.pdf
 
JAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdfJAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdf
 
JAVA PPT -5 BY ADI.pdf
JAVA PPT -5 BY ADI.pdfJAVA PPT -5 BY ADI.pdf
JAVA PPT -5 BY ADI.pdf
 

Recently uploaded

Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 

Data representation

  • 1. DATA REPRESENTATION Prof. K ADISESHA (Ph. D)
  • 2. Contents- Introduction Data Representation Number System Conversions Binary Arithmetic Computer Codes 2 Prof. K. Adisesha (Ph. D) Classification of Number systems
  • 3. INTRODUCTION Prof. K. Adisesha (Ph. D) 3 DATA REPRESENTATION: In Digital Computer, data and instructions are stored in computer memory using binary code (or machine code) represented by Binary digIT’s 1 and 0 called BIT’s.  The data may contain digits, alphabets or special character, which are converted to bits, understandable by the computer.  The number system uses well defined symbols called digits.
  • 4. DATA REPRESENTATION Classification: Number systems are basically classified into two types. They are:  Non-positional number system  Positional number system Prof. K. Adisesha (Ph. D) 4
  • 5. DATA REPRESENTATION Non-Positional Number System: In olden days people use of this type of number system for simple calculations like additions and subtractions.  The non-positional number system consists of different symbols that are used to represent numbers.  Roman number system is an example of the non-positional number system i.e. I=1, V=5, X=10, L=50.  This number system cannot be used effectively to perform arithmetic operations. Prof. K. Adisesha (Ph. D) 5
  • 6. DATA REPRESENTATION Positional Number System: This type of number system is used determine the quantity that the number represents based on the position in which there are placed.  The total number of digits present in any number system is called its Base or Radix.  Every number is represented by a base (or radix) x, which represents x digits.  The base is written after the number as subscript such as 512(10).It is a Decimal number as its base is 10. Prof. K. Adisesha (Ph. D) 6
  • 7. DATA REPRESENTATION Positional Number System: The various types of number system are classified as:  Decimal number system  Binary number system  Octal number system  Hexadecimal number system Prof. K. Adisesha (Ph. D) 7
  • 8. Positional Number System Decimal Number System:  It is the most widely used number system.  The decimal number system consists of 10 digits from 0 to 9.  It has 10 digits and hence its base or radix is 10.  These digits can be used to represent any numeric value.  Example: 123(10), 456(10), 7890(10).  Consider a decimal number 542.76(10) which can be represented in equivalent value as: 5x102 + 4x101 + 2x100 + 7x10-1 + 6x10-2 Prof. K. Adisesha (Ph. D) 8
  • 9. Positional Number System Binary Number System: Digital computer represents all kinds of data and information in the binary system.  Binary number system consists of two digits 0 (low voltage) and 1 (high voltage).  Its base or radix is 2.  Each digit or bit in binary number system can be 0 or 1.  The positional values are expressed in power of 2. Prof. K. Adisesha (Ph. D) 9
  • 10. Positional Number System Binary Number System: Digital computer represents all kinds of data and information in the binary system. Prof. K. Adisesha (Ph. D) 10
  • 11. Positional Number System Binary Number System: Each digit or bit in binary number system can be 0 or 1 and the positional values are expressed in power of 2.  The left most bit 1 is the highest order bit. It is called as Most Significant Bit (MSB).  The right most bit 0 is the lower bit. It is called as Least Significant Bit (LSB).  Example: 1011(2), 111(2), 100001(2)  Consider a binary number 11011.10(2) which can be represented in equivalent value as: 1x24 + 1x23 +0x22 + 1x21 + 1x20 + 1x2-1 + 0x2-2 Prof. K. Adisesha (Ph. D) 11
  • 12. Positional Number System Octal Number System: The octal number system has digits starting from 0 to 7. The base or radix of this system is 8.  The positional values are expressed in power of 8.  Any digit in this system is always less than 8.  Example: 123(8), 236(8), 564(8)  The number 6418 is not a valid octal number because 8 is not a valid digit.  Consider a Octal number 234.56(8) which can be represented in equivalent value as: 2x82 + 3x81 + 4x80 + 5x8-1 + 6x8-2 Prof. K. Adisesha (Ph. D) 12
  • 13. Positional Number System Hexadecimal Number System: The hexadecimal number system consists of 16 digits from 0 to 9 and A to F. The letters A to F represent decimal numbers from 10 to 15.  That is, ‘A’ represents 10, ‘B’ represents 11, ‘C’ represents 12, ‘D’ represents 13, ‘E’ represents 14 and ‘F’ represents 15.  The base or radix of this number system is 16.  Example: 1A3(16), BCA(16), 56C(H)  Consider a Octal number 2AF.D6(16) which can be represented in equivalent value as: 2x162 + Ax161 + Fx160 + Dx16-1 + 6x16-2 Prof. K. Adisesha (Ph. D) 13
  • 14. Positional Number System Number Systems: Prof. K. Adisesha (Ph. D) 14
  • 15. DATA CONVERSIONS Number System Conversions: The various types of number system are classified as:  Conversion from Decimal to Binary  Conversion from Decimal to Octal  Conversion from Decimal to Hexadecimal  Conversion from Binary to Octal  Conversion from Binary to Hexadecimal  Conversion from Octal to Hexadecimal Prof. K. Adisesha (Ph. D) 15
  • 16. DATA CONVERSIONS Conversion from Decimal to Binary: Steps to convert decimal number to binary number: • Step 1: Divide the given decimal number by 2. • Step 2: Take the remainder and record it on the right side. • Step 3: Repeat the Step 1 and Step 2 until the decimal number cannot be divided further. • Step 4: The first remainder will be the LSB and the last remainder is the MSB.  The equivalent binary number is then written from left to right i.e. from MSB to LSB. Prof. K. Adisesha (Ph. D) 16
  • 17. DATA CONVERSIONS Conversion from Decimal to Binary:  The equivalent binary number is then written from left to right i.e. from MSB to LSB. Thus 458(10)= 11001010(2)Prof. K. Adisesha (Ph. D) 17
  • 18. DATA CONVERSIONS Conversion from Decimal to Binary: Steps to convert decimal fraction number to binary number: • Step 1: Multiply the given decimal fraction number by 2. • Step 2: Note the carry and the product. • Step 3: Repeat the Step 1 and Step 2 until the decimal number cannot be divided further. • Step 4: The first carry will be the MSB and the last carry is the LSB.  The equivalent binary fraction number is written from MSB to LSB. Prof. K. Adisesha (Ph. D) 18
  • 19. DATA CONVERSIONS Conversion from Decimal to Binary:  The equivalent binary number is then written from left to right i.e. from MSB to LSB. Thus 458(10)= 11001010.1011(2)Prof. K. Adisesha (Ph. D) 19
  • 20. DATA CONVERSIONS Conversion from Binary to Decimal : Steps to convert binary number to decimal number: • Step 1: Start at the rightmost bit. • Step 2: Take that bit and multiply by 2n, when n is the current position beginning at 0 and increasing by 1 each time. This represents a power of two. • Step 3: Then, add all the products. • Step 4: After addition, the resultant is equal to the decimal value of the binary number Prof. K. Adisesha (Ph. D) 20
  • 21. DATA CONVERSIONS Conversion from Binary to Decimal : Prof. K. Adisesha (Ph. D) 21
  • 22. DATA CONVERSIONS Conversion from Decimal to Octal: Steps to convert decimal number to octal number: • Step 1: Divide the given decimal number by 8. • Step 2: Take the remainder and record it on the right side. • Step 3: Repeat the Step 1 and Step 2 until the decimal number cannot be divided further. • Step 4: The first remainder will be the LS-Digit and the last remainder is the MS-Digit.  The equivalent binary number is then written from left to right i.e. from MS- Digit to LS-Digit. Prof. K. Adisesha (Ph. D) 22
  • 23. DATA CONVERSIONS Conversion from Decimal to Octal: Prof. K. Adisesha (Ph. D) 23
  • 24. DATA CONVERSIONS Conversion from octal to decimal number: Steps to convert octal number to decimal number: • Step 1: Start at the rightmost bit. • Step 2: Take that bit and multiply by 8n, when n is the current position beginning at 0 and increasing by 1 each time. This represents the power of 8. • Step 3: Then, add all the products. • Step 4: After addition, the resultant is equal to the decimal value of the octal number. Prof. K. Adisesha (Ph. D) 24
  • 25. DATA CONVERSIONS Conversion from octal to decimal number: Prof. K. Adisesha (Ph. D) 25
  • 26. DATA CONVERSIONS Conversion from Decimal to Hexadecimal: Steps to convert decimal number to hexadecimal number: • Step 1: Divide the given decimal number by 16. • Step 2: Take the remainder and record it on the right side. • Step 3: Repeat the Step 1 and Step 2 until the decimal number cannot be divided further. • Step 4: The first remainder will be the LS-Digit and the last remainder is the MS-Digit.  The equivalent binary number is then written from left to right i.e. from MS- Digit to LS-Digit. Prof. K. Adisesha (Ph. D) 26
  • 27. DATA CONVERSIONS Conversion from Decimal to Hexadecimal: Example: to convert decimal number 38010 to hexadecimal number:  The equivalent binary number is then written from left to right i.e. from MS- Digit to LS-Digit. Prof. K. Adisesha (Ph. D) 27
  • 28. DATA CONVERSIONS Conversion from hexadecimal to decimal number: Steps to convert hexadecimal number to decimal number: • Step 1: Start at the rightmost bit. • Step 2: Take that bit and multiply by 16n, when n is the current position beginning at 0 and increasing by 1 each time. This represents the power of 16. • Step 3: Then, add all the products. • Step 4: After addition, the resultant is equal to the decimal value of the hexadecimal number. Prof. K. Adisesha (Ph. D) 28
  • 29. DATA CONVERSIONS Conversion from hexadecimal to decimal number: Prof. K. Adisesha (Ph. D) 29
  • 30. DATA CONVERSIONS Conversion from Binary to Octal: Steps to convert Binary to octal: • Step 1: Take a binary number in groups of 3 and use the appropriate octal digit in its place. • Step 2: Begin at the rightmost 3 bits. If we are not able to form a group of three, insert 0s to the left until we get all groups of 3 bits each. • Step 3: Write the octal equivalent of each group. • Step 4: Repeat the steps until all groups have been converted.  It may be necessary to add a 0’s to the left of MSB and when representing fractions, it may be necessary to add a 0’s to right of LSB. Prof. K. Adisesha (Ph. D) 30
  • 31. DATA CONVERSIONS Conversion from Binary to Octal: Prof. K. Adisesha (Ph. D) 31
  • 32. DATA CONVERSIONS Conversion from Octal to Binary: Steps to convert octal to binary: • Step 1: Take the each digit from octal number. • Step 2: Convert each digit to 3-bit binary number. (Each octal digit is represented by a three- bit binary number as shown in Numbering System Table). • Step 3: Write the Binary equivalent of each group. Prof. K. Adisesha (Ph. D) 32
  • 33. DATA CONVERSIONS Conversion from Binary to Hexadecimal: Steps to convert Binary to Hexadecimal: • Step 1: Take a binary number in groups of 4 and use the appropriate hexadecimal digit in its place. • Step 2: Begin at the rightmost 4 bits. If we are not able to form a group of four, insert 0s to the left until we get all groups of 4 bits each. • Step 3: Write the hexadecimal equivalent of each group. • Step 4: Repeat the steps until all groups have been converted.  It may be necessary to add a 0’s to the left of MSB and when representing fractions, it may be necessary to add a 0’s to right of LSB. Prof. K. Adisesha (Ph. D) 33
  • 34. DATA CONVERSIONS Conversion from Hexadecimal to Binary: Steps to convert hexadecimal to binary: • Step 1: Take the each digit from hexadecimal number. • Step 2: Convert each digit to 4-bit binary number. (Each hexadecimal digit is represented by a four- bit binary number as shown in Numbering System Table). • Step 3: Write the Binary equivalent of each group. Prof. K. Adisesha (Ph. D) 34
  • 35. DATA CONVERSIONS Conversion from Octal to Hexadecimal: Steps to convert Octal to Hexadecimal: • Step 1: write the binary equivalent of each octal digit. • Step 2: Regroup them into 4 bits from the right side with zeros added, if necessary. • Step 3: Convert each group into its equivalent hexadecimal digit.  Using Binary system, we can easily convert octal numbers to hexadecimal numbers and vice-versa. Prof. K. Adisesha (Ph. D) 35
  • 36. Binary Arithmetic Binary Addition: The addition of two binary numbers is performed in same manner as the addition of decimal number.  It adds only two bits and gives sum and carry. If a carry is generated, it should be carried over to the addition of next two bits.  The basic rules of binary addition are: Prof. K. Adisesha (Ph. D) 36 Addend1 Addend2 Sum Carry 0 0 0 0 O 1 1 0 1 0 1 0 1 1 0 1
  • 37. Binary Arithmetic Binary Subtraction: This operation is same as the one performed in the decimal number system.  This operation is consists of two steps:  Determine whether it is necessary for us to borrow. If the subtrahend (the lower digit) is larger than the minuend (the upper digit), it is necessary to borrow from the column to the left. In binary two is borrowed.  Subtract the lower value from the upper value  The basic rules of binary subtraction are:  When we subtract 1 from 0, it is necessary to borrow 1 from the next left column i.e. from the next higher order position. Prof. K. Adisesha (Ph. D) 37 Minuend Subtrahend Difference Barrow 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0 0
  • 38. Binary Arithmetic Binary Addition & Subtraction: This operation is same as the one performed in the decimal number system. Prof. K. Adisesha (Ph. D) 38
  • 39. Binary Arithmetic Binary Subtraction: Example: Subtract the following numbers a) 10 from 14 b) 9 from 29 c) 3 from 5. Prof. K. Adisesha (Ph. D) 39
  • 40. Binary Arithmetic Representation of signed Integers: The digital computer handle both positive and negative integer.  It means, is required for representing the sign of the number (- or +), but cannot use the sign (-) to denote the negative number or sign (+) to denote the positive number.  So, this is done by adding the leftmost bit to the number called sign bit.  A positive number has a sign bit 0, while the negative has a sign bit 1. Prof. K. Adisesha (Ph. D) 40
  • 41. Binary Arithmetic Representation of signed Integers: It is also called as fixed point representation.  A negative signed integer can be represented in one of the following:  Sign and magnitude method  One’s complement method  Two’s complement method Prof. K. Adisesha (Ph. D) 41
  • 42. Binary Arithmetic Sign and magnitude method: An integer containing a sign bit followed by magnitude bits are called sign- magnitude integer.  In this method, first bit (MSB) is considered as a sign bit and the remaining bits stand for magnitude.  Here positive number starts with 0 and negative number starts with 1.  Example: The binary number is 11001(2). If we take the size of the word is 1 byte ( 8 bits), then the number 25 will be represented as Prof. K. Adisesha (Ph. D) 42
  • 43. Binary Arithmetic 1’s Complement representation: The 1’s complement of a binary number is obtained by changing each 0 to 1 and each 1 to 0.  This is the simplest method of representing negative binary number.  In this method, change each bit in the number to its complement.  Example: Find the 1’s complement of 101000. Original binary number : 1 0 1 0 0 0 Find 1’s Complement : 0 1 0 1 1 1 Thus 1’s complement of: 101000 is 010111. Prof. K. Adisesha (Ph. D) 43
  • 44. Binary Arithmetic 2’s Complement representation: The 2’s complement of a binary number is obtained by taking 1’s complement of the number and adding 1 to the Least Significant Bit (LSB) position.  The general procedure to find 2’s complement is given by: 2’s Complement = 1’s Complement + 1  Example 1: Find the 2’s complement of: 101000.  Original binary number : 1 0 1 0 0 0  Find 1’s Complement : 0 1 0 1 1 1  Add 1 to LSB + 1  Hence 2’s Complement of 101000 is: 0 1 1 0 0 0 Prof. K. Adisesha (Ph. D) 44
  • 45. Binary Arithmetic Subtraction of Binary Number using Complement: Most of the computers perform subtraction using complemented number.  This is less expensive because the same addition circuit is used for subtraction with slight changes in the circuit.  In the binary number system we can perform subtraction operation using two methods of complements:  Subtraction using 1’s Complement  Subtraction using 2’s Complement Prof. K. Adisesha (Ph. D) 45
  • 46. Binary Arithmetic Subtraction using 1’s Complement: Subtraction using 1’s Complement is performed using two cases.  Case 1: Subtracting a larger number from a smaller number (Minuend is less than Subtrahend) o Step 1: Find the 1’s complement of the subtrahend. o Step 2: Add this to the minuend. o Step 3: There will be no carry, Re complement the answer to get the difference Prof. K. Adisesha (Ph. D) 46
  • 47. Binary Arithmetic Subtraction using 1’s Complement:  Example : Subtract 52 from 25 using 1’s complement. Decimal Binary Decimal Binary Minuend 25 : 011001 Subtrahend -52 : 110100 1’s complement of subtrahend is : 001011 Minuend : 0 1 1 0 0 1 1’s Complement of subtrahend : + 0 0 1 0 1 1 : 1 0 0 1 0 0  Since there is no carry take 1’s complement : 0 1 1 0 1 1 attach a negative sign Hence, the result = - 011011 i.e. - 27 Prof. K. Adisesha (Ph. D) 47
  • 48. Binary Arithmetic Subtraction using 1’s Complement: Subtraction using 1’s Complement is performed using two cases.  Case 2: Subtracting a smaller number from a larger number (Minuend is greater than Subtrahend) o Step 1: Find the 1’s complement of the subtrahend. o Step 2: Add this to the minuend. o Step 3: Carry is generated, this carry is called as the end around carry o Step 4: Add the end around carry back to the LSB to get the final difference Prof. K. Adisesha (Ph. D) 48
  • 49. Binary Arithmetic Subtraction using 1’s Complement:  Example : Subtract 15 from 25 using 1’s complement. Decimal Binary Minuend 25 : 11001 Subtrahend -15 : 01111 1’s complement of subtrahend is : 10000 Minuend : 1 1 0 0 1 1’s Complement of subtrahend : + 1 0 0 0 0 Since there is carry add carry to LSB : 1 0 1 0 0 1 +1  MSB is zero : 0 1 0 1 0 attach a Positive sign Hence, the result = + 01010 i.e. +10 Prof. K. Adisesha (Ph. D) 49
  • 50. Computer Codes Computer Codes: Computer code helps us to represent characters in a coded form in the memory of the computer.  These codes represent specific formats which are used to record data.  Some of the commonly used computer codes are:  Binary Coded Decimal (BCD)  Extended Binary Coded Decimal Interchange Code (EBCDIC)  American Standard Code for Information Interchange (ASCII)  Excess-3 Code. Prof. K. Adisesha (Ph. D) 50
  • 51. Computer Codes BCD code (or Weighted BCD Code or 8421 Code): BCD stands for Binary Coded Decimal.  It is one of the early computer codes.  In this coding system, the bits are given from left to right, the weights 8,4,2,1 respectively  In 4-bit BCD only 24=16 configurations are possible which is insufficient to represent the various characters.  Hence 6-bit BCD code was developed by adding two zone positions with which it is possible to represent 26=64 characters Prof. K. Adisesha (Ph. D) 51
  • 52. Computer Codes BCD code (or Weighted BCD Code or 8421 Code): The BCD equivalent of each decimal digit is shown in table. Prof. K. Adisesha (Ph. D) 52 Decimal BCD Code Decimal BCD Code 0 0000 5 0101 1 0001 6 0110 2 0010 7 0111 3 0011 8 1000 4 0100 9 1001
  • 53. Computer Codes Excess-3 BCD code (or XS-3 Code): BCD stands for Binary Coded Decimal.  The Excess-3 BCD code is a non-weighted code used to express decimal number.  The name Excess-3 code derived from the fact that each binary code is the corresponding BCD code plus 0011(2)(i.e. Decimal 3).  This code is used in some old computers.  The Excess-3 code equivalent of decimal (0-9) Prof. K. Adisesha (Ph. D) 53
  • 54. Computer Codes Excess-3 code (or Non-Weighted Code): The following table gives the Excess-3 code equivalent of decimal (0-9).. Prof. K. Adisesha (Ph. D) 54 Decimal XS-3 Code Decimal XS-3 Code 0 0011 5 1000 1 0100 6 1001 2 0101 7 1010 3 0110 8 1011 4 0111 9 1100
  • 55. Computer Codes ASCII Code: It stands for the American Standard Code for Information Interchange.  It is a 7-bit code, which is possible to represent 27=128 characters.  It is used in most microcomputers and minicomputers and in mainframes.  The ASCII code (Pronounced ask-ee) is of two types – ASCII-7 and ASCII-8.  ASCII-7 is 7-bit code for representing English characters as numbers, with each letter assigned a number from 0 to 127. Prof. K. Adisesha (Ph. D) 55
  • 56. Computer Codes EBCDIC: It stand for Extended Binary Coded Decimal Interchange Code.  This was developed by IBM.  It uses an 8-bit code and hence possible to represent 256 different characters or bit combinations. EBCDIC is used on most computers and computer equipment today.  It is a coding method generally used by larger computers (mainframes) to present letters, numbers or other symbols in a binary language the computer can understand.  EBCDIC is an 8-bit code; therefore, it is divided into two 4-bit groups, where each 4-bit can be represented as 1 hexadecimal digit. Prof. K. Adisesha (Ph. D) 56
  • 57. Computer Codes UNICODE: Unicode is a universal character encoding standard that assigns a code to every character and symbol in every language in the world.  Unicode is the only encoding standard that ensures that you can retrieve or combine data using any combination of languages.  Unicode may be 8-bit, 16-bit, or 32-bit.  The two common Unicode implementations for computer systems are:  UTF-8, a variable length encoding scheme in which each written symbol is represented by a one- to four-byte code  UTF-16, a fixed width encoding scheme in which each written symbol is represented by a two-byte code Prof. K. Adisesha (Ph. D) 57
  • 58. Discussion Prof. K. Adisesha (Ph. D) 58 Queries ? Prof. K. Adisesha