SlideShare una empresa de Scribd logo
1 de 66
Chapter 2:
DATA REPRESENTATION
IN COMPUTER MEMORY
SUMMARY: This topic introduces the numbering systems: decimal, binary, octal
and hexadecimal. The topic covers the conversion between numbering systems,
binary arithmetic, one's complement, two's complement, signed number and
coding system. This topic also covers the digital logic components.
CLO 2:apply appropriate method to solve arithmetic problem in numbering
system (C3).
RTA: (08 : 08)
2.1 Understand data representation
on CPU.
2.1.1 Define decimal, binary, octal and
hexadecimal number.
2.1.2 Perform arithmetic operation (addition
and subtraction) in different number
bases.
2.1.3 Convert decimal, binary, octal and
hexadecimal numbers to different bases and
vice-versa
INTRODUCTION
 The binary system and decimal system is
most important in digital system.
 Decimal - Universally used to represent
quantities outside a digital system.
 Its means, there will be situations decimal
values must be converted to binary values
before entered to digital system.
 Example : Calculator / Computer
DECIMAL NUMBERING SYSTEM
 Decimal system is composed of 10 numerals
or symbols.
 These 10 sysmbols are 0, 1, 2, 3, 4, 5, 6,
7, 8, 9.
 Using these symbols as digits of a
number, it can express any quantity.
 Base number = 10
 Basic number = 0,1,2,3,4,5,6,7,8,9
23410
Basic number
Base number
Positional Values (weights)
2 7 4 6 . 2
102
103
101
100
10-1
Positional values
(weights)
MSD LSD
2746.210 is from calculation below:
2746.2 = (2x103
) + (7x102
) + (4x101
) + (6x100
) + (2x10-1
)
= 2000 + 700 + 40 +6 +0.2
= 2746.2
Most significant digit Least significant digit
BINARY NUMBERING SYSTEM
 Define Binary numbers
 Binary numbers representing number in which only
digits 0 or 1.
 ADDITION BINARY NUMBERS
Basic binary addition rule :
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10
1 + 1 + 1 = 11
 Example : 101 + 101 = 1010
1011 + 1011 = ?
 Ex 1:
110112 + 100012 = 1011002
 Ex 2:
 101112 + 1112 = ________
Exercise
Subtraction
Four conditions in binary subtraction
 0 - 0 = 0
 0 - 1 = 1 borrow 1
 1 - 0 = 1
 1 - 1 = 0
 10 - 1 = 1
 If a 10 being borrow a 1, what’s left with
that 10 is a 1
 Ex 1:
10012 – 102 = 1112
 Ex 2:
 1010112 – 11112 =__________
Conversions of Binary Numbers
Binary to Decimal conversions
 Example : 1 1 0 1 12
 24
+ 23
+ 22
+ 21
+ 20
= 16 + 8 + 2 + 1
= 2710
Decimal to Binary conversions
 Convert 2510 to binary number
Exercise: Convert 3010 to binary number
OCTAL NUMBERING SYSTEM
 The octal number system has a base of eight,
meaning that it has eight possible digits:
0,1,2,3,4,5,6 and 7.
 The digit positions in an octal number have
weights as follows :
84
83
82
81
80 •. 8-1
8-2
8-3
 Ex:
5248 – 1678 = 3358
1678 – 248 = _________
Octal number - (Subtraction -
Pengurangan)
Octal –to-decimal conversion
Convert 3728 to decimal number
3728 = 3 x (8
2
) + 7 x (8
1
) + 2 x (8
0
)
= (3 x 64) + (7x 8) + (2 x 1)
= 25010
Octal number - Addition (Penambahan)
 Ex:
1238
+ 3218
4448
 Ex:
4578
+ 2458
 Decimal integer can be converted to octal by
using the same repeated-division method
with a division factor of 8.
Decimal-to-Octal Conversion
Octal –to- Binary conversion
Binary to Octal conversion
 The hexadecimal number system uses base
16.
 It has 16 possible digit symbols.
 It uses the digits 0 through 9 plus the letters
A, B, C, D, E and F as the 16 digit symbols.
HEXADECIMAL NUMBERING
SYSTEM
7A16
Basic number
Base number
Hexadecimal number - Addition
(Penambahan)
 Ex:
3 316
 + 4 716
 Ex:
2 0 D 316
+ 1 2 B C16
7 A16
Hexadecimal number - Subtraction
(Pengurangan)
 Ex:
4 416
- 1 716
 Ex:
3 2 5 516
- 3 1 8 216
2 D16
Hexadecimal-To-Decimal Conversion
 A hexadecimal number can be converted to
its decimal equivalent by using the fact that
each hex digit position has a weight that is a
power of 16.
 Ex 1:
1416 = (1 x 161
) + (4 x 160
)
= 16 + 4
= 2010
 Ex 2:
ABC16 = (10 x 162
) + (11 x 161
)
= (12 x 160
)
= 2560 + 176 + 12
= 274810
 Decimal to hex conversion can be done using
repeated division by 16.
 Ex: Convert 2010 to hex
Decimal-To-Hexadecimal Conversion
16 20
16 1 4
2010 = 1416
 Like the octal number system, the
hexadecimal number system is used
primarily as a “shorthand” method for
representing binary numbers.
 It is a relatively simple matter to convert a
hex number to binary .
 Each hex digit is converted to its four-bit
binary equivalent.
Hexadecimal-to-Binary Conversion
 Ex:
111010012 = __________
00101101001111002 =___________
 The binary number is grouped into groups
of four bits, and each group is converted
to its equivalent hex digit.
 Zero are added, as needed to complete a
four-bit group.
 Ex:
1012 = 0101
= 516
Binary-to-Hexadecimal Conversion
Summary
Hexadecimal Decimal Binary
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
Summary
Hexadecimal Decimal Binary
8 8 1000
9 9 1001
A 10 1010
B 11 1011
C 12 1100
D 13 1101
E 14 1110
F 15 1111
2.1.4 Describe the coding system
a. Sign and magnitude
b. 1’s Complement and 2’s Complement
c. Binary Coded Decimal (BCD system)
d. ASCII and EBCDIC
Describe the coding system
Sign and Magnitude
Positive sign, ( 0 )
or
Negative sign ( 1 )
Magnitude =
Size
Or value
Describe the coding system
Sign and Magnitude
Example 1 : Represent -9 in sign
and magnitude.
-9
sign magnitude
1 1001
11001
-9 in sign &magnitude value is 11001
Describe the coding system
Sign and Magnitude
Example 2 : Represent 25 in sign
and magnitude.
+25
sign magnitude
0 11001
011001
25 in sign & magnitude value is 011001
One’s Complements and Two’s
Complements
 One’s Complements
 One’s complements is used in binary number.
 The one’s complement of a binary number is
obtained by changing each 0 to 1 and 1 to a 0.
 Only change negative number
 In other words, change each bit in the number to
its complement.
 Exp:
 10011001 – original binary number
 01100110 – complement each bit to
form 1’s complement
 Thus, we say that the 1’s complement of
10011001 is 01100110.
 Exp:
 Convert -2710 to 1’s complement
a) -2710 = 001002
 Convert -4510 to 1’s complement
-------------
 Two’s Complement
 The 2’s complement of a binary number is formed
by taking the 1’s complement of the number and
adding 1 to the least-significant-bit (LSB)
position.
 Exp:
101101 binary equivalent of 45
010010 complement each bit to form 1’s
complement
+ 1 add 1
010011 2’s complement of original binary
number
Two’s complement = One’s Complement + 1
Exercise
1. Convert the number below to
1’s complement 2’s
complement
------------------- -------------------
-101110012 0100 0110 0100 0111
-5768 01000 0001 01000 0010
-124516
-45
Addition in 1’s complement
 Exp 1 : 810 + (-310)
1000 8 change to binary number
+ 1100 -3 change to 1’s complement
10100
1 add carry to LSB
0101
 Exercise 2 : 510 + (-210)
----------------
 Exp 1: 810 + (-310)
1100 -3 change to 1’s complement
+ 1
1101 -3 change to 2’s complement
+ 1000 8 change to binary number
10101
Addition in 2’s complement
This carry is disregarded, the result is 0101 (sum=5)
 Exp 2: -810 + 310
0111 -8 change to 1’s complement
+ 1
1000 -8 change to 2’s complement
+ 0011 3 change to binary number
1011 negative sign bit
 Only binary number which have –ve sign need to
change to 1’s complement. If the number is decimal
number, change the number to binary number.
 The –ve number that already change to 1’s
complement, means that the number already
change to +ve. So that, the subtraction process
have change to addition process.
 Overflow bit in addition process need to carry to LSB
and add with the number.
Subtraction in 1’s complement
 Exp 1: 2510 – 1310
Step 1 : Convert 2510 and -1310 to binary number.
2510 = 110012 1310 = 11012
Step 2 : Change 1310 = 1101 to 1’s complement
1310 = 11012 change to 1’s complement = 10010
11001 25 change to binary number
+ 10010 -13 change to 1’s complement
101011
+ 1 add 1
01100 total=12
 Change the number are given to binary
number.
 For each –ve binary number, we must change
to 1’s complement (change 0 to 1 and 1 to 0).
 Then, add the number with 1.
Subtraction in 2’s complement
 Exp 1: 2510 – 1310
Step 1 : Convert 2510 and -1310 to binary number.
2510 = 110012 1310 = 11012
Step 2 : Change -1310 to 2’s complement
-1310 = 011012 change to 1’s complement = 10010
10010 change to 2’s complement = 10011
11001 25 change to binary
+ 10010 -13 change to 2’s complement
101100 total=12
Carry disregard
 Solve this arithmetic with 2’s complement.
i. 428 – 158
ii. 101110 - 56910
Exercise
Signed Number
 Addition of Signed Number
 Addition number same sign
 Exp: +4 + (+8) = +12
+4 00000100
+8 00001000
+12 00001100
 Addition number different sign
 Exp 1:
(-4) + (+8) = +4
-4 11111100
+ (+8) 00001000
+4 1 00000100
This carry is disregarded
00000100 +4
11111011 1’s complements
+ 1
11111100 2’s complements
 Exp 1:
(-12) + (+5) = -7
-12 11110100
+ +5 00000101
-7 11111001
00001100 +12
11110011 1’s complements
+ 1
11110100 2’s complements
Negatif sign bit
Subtraction of Signed Number
Positive Number (-) Negative Number
 Exp:
+10 – (-5) = +10 + (+5)
= + 15
+10 00001010
+ 5 00000101
+15 00001111
Negative Number (-) Positive Number
 Exp:
-10 – (+5) = - 15
- 10 11110110 11110110
- (+5) 00000101 + 11111011
-15 111110001
Negative Number (-) Negative Number
 Exp:
-10 – (-5) = -10 + (5)
= - 5
-10 11110110
- (- 5) + 00000101
- 5 11111011
BCD Code
 BCD – Binary Coded Decimal
 It’s contain BCD 8421, 2421, 3321, 5421, 5311,
4221 and etc.
 The common used is BCD 8421 and BCD 2421.
4 bit BCD Code
Desimal 5421 5311 4221 3321 2421 8421 7421
0 0000 0000 0000 0000 0000 0000 0000
1 0001 0001 0001 0001 0001 0001 0001
2 0010 0011 0010 0010 0010 0010 0010
3 0011 0100 0011 0011 0011 0011 0011
4 0100 0101 1000 0101 0100 0100 0100
5 1000 1000 0111 1010 1011 0101 0101
6 1001 1001 1100 1100 1100 0110 0110
7 1010 1011 1101 1101 1101 0111 1000
8 1011 1100 1110 1110 1110 1000 1001
9 1100 1101 1111 1111 1111 1001 1010
Binary-Coded-Decimal Code
 If each digit of a decimal number is represented by
its binary equivalent, the result is a code called
binary-coded-decimal.
 Decimal digit can be as large as 9, four bits are
required to code each digit (the binary code for 9 is
1001)
 Exp: 87410
8 7 4 (decimal)
1000 0111 0100 (BCD)
BCD 8421 Code – to – Binary Number
 Exp:
Convert 1001 0110BCD 8421 to binary number.
Step 1: Change BCD 8421 code to decimal
number.
1001 0110
9 6
Step 2 : Change decimal number to binary
number.
1001 0110BCD 8421 = 11000002
 Exp:
Convert 10010102 to BCD 8421
code.
Step 1: Change binary number to decimal
number.
10010102 = 7410
Step 2: Change decimal number to BCD
8421 code.
10010102 = 01110111BCD 8421
Binary Number – to – BCD 8421 Code
 The most widely used alphanumeric code is the
American Standard Code for Information
Interchange (ASCII).
 The ASCII code is a seven-bit code and so it has 27
= 128 possible code groups.
ASCII Code
MSB
LSB
Binary 000 001 010 011 100 101 110 111
Binary Hex 0 1 2 3 4 5 6 7
0000 0 Nul Del sp 0 @ P p
0001 1 Soh Dc1 1 1 A Q a q
0010 2 Stx Dc2 “ 2 B R b r
0011 3 Etx Dc3 # 3 C S c s
0100 4 Eot Dc4 $ 4 D T d t
0101 5 End Nak % 5 E U e u
0110 6 Ack Syn & 6 F V f v
0111 7 Bel Etb ‘ 7 G W g w
1000 8 Bs Can ( 8 H X h x
1001 9 HT Em ) 9 I Y i y
1010 A LF Sub . : J Z j z
1011 B VT Esc + ; K k
1100 C FF FS , < L l
1101 D CR GS - = M m
1110 E SO RS . > N n
1111 F SI US / ? O o
ASCII code
 Exp:
An operator is typing in a BASIC program
at the keyboard of a certain
microcomputer. The computer converts
each keystroke into its ASCII code and
stores the code as a byte in memory.
Determine the binary strings that will be
entered into memory when operator types
in the following BASIC statement:
GOTO 25
 Solution:
Locate each character (including the
space) and record ASCII code.
G 01000111
O 01001111
T 01010100
O 01001111
(space) 00100000
2 00110010
5 00110101
*0 was added to the leftmost bit of each ASCII code because the
Codes must be stored as bytes (eight bits).
Exercise :
1.The following message encode in ASCII
code. What the meaning of this code ?
 a) 54 4F 4C 4F 45 47
 b) 48 45 4C 4C 4F
 c) 41 50 41 4B 48 41 42 41 52
EBCDIC
 Stand for Extended Binary Coded Decimal
Interchange Code.
 was first used on the IBM 360 computer,
which was presented to the market in 1964.
 Used with large computer such as
mainframe.

Más contenido relacionado

La actualidad más candente

Chapter 2.1 introduction to number system
Chapter 2.1 introduction to number systemChapter 2.1 introduction to number system
Chapter 2.1 introduction to number systemISMT College
 
Number system and codes
Number system and codesNumber system and codes
Number system and codesAbhiraj Bohra
 
multiplexers and demultiplexers
 multiplexers and demultiplexers multiplexers and demultiplexers
multiplexers and demultiplexersUnsa Shakir
 
Lecture 5 Synchronous Sequential Logic
Lecture 5 Synchronous Sequential LogicLecture 5 Synchronous Sequential Logic
Lecture 5 Synchronous Sequential LogicJames Evangelos
 
EC Binary Substraction using 1's Complement,2's Complement
EC Binary Substraction using 1's Complement,2's ComplementEC Binary Substraction using 1's Complement,2's Complement
EC Binary Substraction using 1's Complement,2's ComplementAmberSinghal1
 
1's and 2's complement
1's and 2's complement 1's and 2's complement
1's and 2's complement Shiraz Azeem
 
New error-detection (2)
New error-detection (2)New error-detection (2)
New error-detection (2)Nitesh Singh
 
Modulo n counter
Modulo n counterModulo n counter
Modulo n counterManoj Guha
 
Binary number system
Binary number systemBinary number system
Binary number systemNadeem Uddin
 
Digital Electronics- Number systems & codes
Digital Electronics- Number systems & codes Digital Electronics- Number systems & codes
Digital Electronics- Number systems & codes VandanaPagar1
 
Binaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesBinaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesDr. Anita Goel
 

La actualidad más candente (20)

Chapter 2.1 introduction to number system
Chapter 2.1 introduction to number systemChapter 2.1 introduction to number system
Chapter 2.1 introduction to number system
 
Number system and codes
Number system and codesNumber system and codes
Number system and codes
 
multiplexers and demultiplexers
 multiplexers and demultiplexers multiplexers and demultiplexers
multiplexers and demultiplexers
 
Lecture 5 Synchronous Sequential Logic
Lecture 5 Synchronous Sequential LogicLecture 5 Synchronous Sequential Logic
Lecture 5 Synchronous Sequential Logic
 
EC Binary Substraction using 1's Complement,2's Complement
EC Binary Substraction using 1's Complement,2's ComplementEC Binary Substraction using 1's Complement,2's Complement
EC Binary Substraction using 1's Complement,2's Complement
 
1's and 2's complement
1's and 2's complement 1's and 2's complement
1's and 2's complement
 
Demultiplexer
DemultiplexerDemultiplexer
Demultiplexer
 
Digital logic design part1
Digital logic design part1Digital logic design part1
Digital logic design part1
 
1.ppi 8255
1.ppi 8255 1.ppi 8255
1.ppi 8255
 
New error-detection (2)
New error-detection (2)New error-detection (2)
New error-detection (2)
 
Modulo n counter
Modulo n counterModulo n counter
Modulo n counter
 
Bcd
BcdBcd
Bcd
 
Counters
CountersCounters
Counters
 
Binary number system
Binary number systemBinary number system
Binary number system
 
Binary to Decimal Conversion
Binary to Decimal ConversionBinary to Decimal Conversion
Binary to Decimal Conversion
 
Number system
Number systemNumber system
Number system
 
Subtractor
SubtractorSubtractor
Subtractor
 
Multiplexers & Demultiplexers
Multiplexers & DemultiplexersMultiplexers & Demultiplexers
Multiplexers & Demultiplexers
 
Digital Electronics- Number systems & codes
Digital Electronics- Number systems & codes Digital Electronics- Number systems & codes
Digital Electronics- Number systems & codes
 
Binaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesBinaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemes
 

Destacado

Chapter 1 computer hardware and flow of information
Chapter 1 computer hardware and flow of informationChapter 1 computer hardware and flow of information
Chapter 1 computer hardware and flow of informationFrankie Jones
 
Chapter 3 Computer Organization
Chapter 3 Computer OrganizationChapter 3 Computer Organization
Chapter 3 Computer OrganizationFrankie Jones
 
Basics of Nuclear physics
Basics of Nuclear physicsBasics of Nuclear physics
Basics of Nuclear physicsJaya Yadav
 
Number system utm notes
Number system utm notesNumber system utm notes
Number system utm notesKurenai Ryu
 
08 Numeral systems
08 Numeral systems08 Numeral systems
08 Numeral systemsmaznabili
 
Chapter 04 computer codes
Chapter 04 computer codesChapter 04 computer codes
Chapter 04 computer codesHareem Aslam
 
Basic Computer Organization and Design
Basic Computer Organization and DesignBasic Computer Organization and Design
Basic Computer Organization and Designmekind
 
Computer Architecture – An Introduction
Computer Architecture – An IntroductionComputer Architecture – An Introduction
Computer Architecture – An IntroductionDilum Bandara
 
Computer architecture and organization
Computer architecture and organizationComputer architecture and organization
Computer architecture and organizationTushar B Kute
 
Form 4 Chapter 5 Part 1
Form 4 Chapter 5 Part 1Form 4 Chapter 5 Part 1
Form 4 Chapter 5 Part 1DSO
 
Types and components of computer system
Types and components of computer systemTypes and components of computer system
Types and components of computer systemmkhisalg
 
Block diagram of a computer
Block diagram of a computerBlock diagram of a computer
Block diagram of a computerZTE Nepal
 
Computer hardware component. ppt
Computer hardware component. pptComputer hardware component. ppt
Computer hardware component. pptNaveen Sihag
 
Components of a computer system
Components of a computer systemComponents of a computer system
Components of a computer systemlistergc
 
Computer architecture
Computer architectureComputer architecture
Computer architectureRishabha Garg
 
BCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codesBCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codesstudent
 

Destacado (19)

Chapter 1 computer hardware and flow of information
Chapter 1 computer hardware and flow of informationChapter 1 computer hardware and flow of information
Chapter 1 computer hardware and flow of information
 
Rgb &amp; cmy(k) color model
Rgb &amp; cmy(k) color modelRgb &amp; cmy(k) color model
Rgb &amp; cmy(k) color model
 
Rgb and cmy color model
Rgb and cmy color modelRgb and cmy color model
Rgb and cmy color model
 
Chapter 3 Computer Organization
Chapter 3 Computer OrganizationChapter 3 Computer Organization
Chapter 3 Computer Organization
 
Basics of Nuclear physics
Basics of Nuclear physicsBasics of Nuclear physics
Basics of Nuclear physics
 
Number system utm notes
Number system utm notesNumber system utm notes
Number system utm notes
 
08 Numeral systems
08 Numeral systems08 Numeral systems
08 Numeral systems
 
Chapter 04 computer codes
Chapter 04 computer codesChapter 04 computer codes
Chapter 04 computer codes
 
Basic Computer Organization and Design
Basic Computer Organization and DesignBasic Computer Organization and Design
Basic Computer Organization and Design
 
Computer Architecture – An Introduction
Computer Architecture – An IntroductionComputer Architecture – An Introduction
Computer Architecture – An Introduction
 
Computer architecture and organization
Computer architecture and organizationComputer architecture and organization
Computer architecture and organization
 
Form 4 Chapter 5 Part 1
Form 4 Chapter 5 Part 1Form 4 Chapter 5 Part 1
Form 4 Chapter 5 Part 1
 
Types and components of computer system
Types and components of computer systemTypes and components of computer system
Types and components of computer system
 
Block diagram of a computer
Block diagram of a computerBlock diagram of a computer
Block diagram of a computer
 
Computer hardware component. ppt
Computer hardware component. pptComputer hardware component. ppt
Computer hardware component. ppt
 
Computer presentation
Computer presentationComputer presentation
Computer presentation
 
Components of a computer system
Components of a computer systemComponents of a computer system
Components of a computer system
 
Computer architecture
Computer architectureComputer architecture
Computer architecture
 
BCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codesBCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codes
 

Similar a Chapter 2 Data Representation on CPU (part 1)

Data representation
Data representationData representation
Data representationChew Hoong
 
Number system
Number systemNumber system
Number systemaviban
 
1. NUMBER SYSTEM.pptx Computer Applications in Pharmacy
1. NUMBER SYSTEM.pptx Computer Applications in Pharmacy1. NUMBER SYSTEM.pptx Computer Applications in Pharmacy
1. NUMBER SYSTEM.pptx Computer Applications in PharmacyVedika Narvekar
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital ElectronicsJanki Shah
 
About the computer of the important field
About the computer               of the important fieldAbout the computer               of the important field
About the computer of the important fieldshubhamgupta7133
 
Ncp computer appls num sys2 pramod
Ncp computer appls  num sys2 pramodNcp computer appls  num sys2 pramod
Ncp computer appls num sys2 pramodNCP
 
Logic Design - Chapter 1: Number Systems and Codes
Logic Design - Chapter 1: Number Systems and CodesLogic Design - Chapter 1: Number Systems and Codes
Logic Design - Chapter 1: Number Systems and CodesGouda Mando
 
Integer Representation
Integer RepresentationInteger Representation
Integer Representationgavhays
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptxamudhak10
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptxamudhak10
 

Similar a Chapter 2 Data Representation on CPU (part 1) (20)

Okkkkk
OkkkkkOkkkkk
Okkkkk
 
Number_Systems (2).ppt
Number_Systems (2).pptNumber_Systems (2).ppt
Number_Systems (2).ppt
 
Data representation
Data representationData representation
Data representation
 
ch2.pdf
ch2.pdfch2.pdf
ch2.pdf
 
Number system
Number systemNumber system
Number system
 
1. NUMBER SYSTEM.pptx Computer Applications in Pharmacy
1. NUMBER SYSTEM.pptx Computer Applications in Pharmacy1. NUMBER SYSTEM.pptx Computer Applications in Pharmacy
1. NUMBER SYSTEM.pptx Computer Applications in Pharmacy
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital Electronics
 
uyuyuy.pdf
uyuyuy.pdfuyuyuy.pdf
uyuyuy.pdf
 
NUMBER BASE SYSTEM.pptx
NUMBER BASE SYSTEM.pptxNUMBER BASE SYSTEM.pptx
NUMBER BASE SYSTEM.pptx
 
NumberSystems.ppt
NumberSystems.pptNumberSystems.ppt
NumberSystems.ppt
 
Lec2_NumberSystems.ppt
Lec2_NumberSystems.pptLec2_NumberSystems.ppt
Lec2_NumberSystems.ppt
 
About the computer of the important field
About the computer               of the important fieldAbout the computer               of the important field
About the computer of the important field
 
Ncp computer appls num sys2 pramod
Ncp computer appls  num sys2 pramodNcp computer appls  num sys2 pramod
Ncp computer appls num sys2 pramod
 
Logic Design - Chapter 1: Number Systems and Codes
Logic Design - Chapter 1: Number Systems and CodesLogic Design - Chapter 1: Number Systems and Codes
Logic Design - Chapter 1: Number Systems and Codes
 
Integer Representation
Integer RepresentationInteger Representation
Integer Representation
 
Number Systems
Number SystemsNumber Systems
Number Systems
 
Number system
Number systemNumber system
Number system
 
Number system
Number systemNumber system
Number system
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptx
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptx
 

Más de Frankie Jones

Dbm2013 engineering mathematics 3 june 2017
Dbm2013  engineering mathematics 3 june 2017Dbm2013  engineering mathematics 3 june 2017
Dbm2013 engineering mathematics 3 june 2017Frankie Jones
 
Basic concepts of information technology and the internet
Basic concepts of information technology and the internetBasic concepts of information technology and the internet
Basic concepts of information technology and the internetFrankie Jones
 
2.1 Understand problem solving concept
2.1 Understand problem solving concept2.1 Understand problem solving concept
2.1 Understand problem solving conceptFrankie Jones
 
2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problemFrankie Jones
 
2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life CycleFrankie Jones
 
Introduction to programming principles languages
Introduction to programming principles languagesIntroduction to programming principles languages
Introduction to programming principles languagesFrankie Jones
 
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGChapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGFrankie Jones
 
Chapter 2 Boolean Algebra (part 2)
Chapter 2 Boolean Algebra (part 2)Chapter 2 Boolean Algebra (part 2)
Chapter 2 Boolean Algebra (part 2)Frankie Jones
 
Type header file in c++ and its function
Type header file in c++ and its functionType header file in c++ and its function
Type header file in c++ and its functionFrankie Jones
 
Multimedia storyboard template
Multimedia storyboard templateMultimedia storyboard template
Multimedia storyboard templateFrankie Jones
 
Occupancy calculation form
Occupancy calculation formOccupancy calculation form
Occupancy calculation formFrankie Jones
 

Más de Frankie Jones (12)

Dbm2013 engineering mathematics 3 june 2017
Dbm2013  engineering mathematics 3 june 2017Dbm2013  engineering mathematics 3 june 2017
Dbm2013 engineering mathematics 3 june 2017
 
Basic concepts of information technology and the internet
Basic concepts of information technology and the internetBasic concepts of information technology and the internet
Basic concepts of information technology and the internet
 
2.1 Understand problem solving concept
2.1 Understand problem solving concept2.1 Understand problem solving concept
2.1 Understand problem solving concept
 
2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem
 
2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle
 
Introduction to programming principles languages
Introduction to programming principles languagesIntroduction to programming principles languages
Introduction to programming principles languages
 
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGChapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
 
Chapter 2 Boolean Algebra (part 2)
Chapter 2 Boolean Algebra (part 2)Chapter 2 Boolean Algebra (part 2)
Chapter 2 Boolean Algebra (part 2)
 
Operator precedence
Operator precedenceOperator precedence
Operator precedence
 
Type header file in c++ and its function
Type header file in c++ and its functionType header file in c++ and its function
Type header file in c++ and its function
 
Multimedia storyboard template
Multimedia storyboard templateMultimedia storyboard template
Multimedia storyboard template
 
Occupancy calculation form
Occupancy calculation formOccupancy calculation form
Occupancy calculation form
 

Último

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Último (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Chapter 2 Data Representation on CPU (part 1)

  • 1. Chapter 2: DATA REPRESENTATION IN COMPUTER MEMORY SUMMARY: This topic introduces the numbering systems: decimal, binary, octal and hexadecimal. The topic covers the conversion between numbering systems, binary arithmetic, one's complement, two's complement, signed number and coding system. This topic also covers the digital logic components. CLO 2:apply appropriate method to solve arithmetic problem in numbering system (C3). RTA: (08 : 08)
  • 2. 2.1 Understand data representation on CPU. 2.1.1 Define decimal, binary, octal and hexadecimal number. 2.1.2 Perform arithmetic operation (addition and subtraction) in different number bases. 2.1.3 Convert decimal, binary, octal and hexadecimal numbers to different bases and vice-versa
  • 3. INTRODUCTION  The binary system and decimal system is most important in digital system.  Decimal - Universally used to represent quantities outside a digital system.  Its means, there will be situations decimal values must be converted to binary values before entered to digital system.  Example : Calculator / Computer
  • 4. DECIMAL NUMBERING SYSTEM  Decimal system is composed of 10 numerals or symbols.  These 10 sysmbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.  Using these symbols as digits of a number, it can express any quantity.
  • 5.  Base number = 10  Basic number = 0,1,2,3,4,5,6,7,8,9 23410 Basic number Base number
  • 6. Positional Values (weights) 2 7 4 6 . 2 102 103 101 100 10-1 Positional values (weights) MSD LSD 2746.210 is from calculation below: 2746.2 = (2x103 ) + (7x102 ) + (4x101 ) + (6x100 ) + (2x10-1 ) = 2000 + 700 + 40 +6 +0.2 = 2746.2 Most significant digit Least significant digit
  • 7. BINARY NUMBERING SYSTEM  Define Binary numbers  Binary numbers representing number in which only digits 0 or 1.  ADDITION BINARY NUMBERS Basic binary addition rule : 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 10 1 + 1 + 1 = 11  Example : 101 + 101 = 1010 1011 + 1011 = ?
  • 8.  Ex 1: 110112 + 100012 = 1011002  Ex 2:  101112 + 1112 = ________ Exercise
  • 9. Subtraction Four conditions in binary subtraction  0 - 0 = 0  0 - 1 = 1 borrow 1  1 - 0 = 1  1 - 1 = 0  10 - 1 = 1  If a 10 being borrow a 1, what’s left with that 10 is a 1
  • 10.  Ex 1: 10012 – 102 = 1112  Ex 2:  1010112 – 11112 =__________
  • 11. Conversions of Binary Numbers Binary to Decimal conversions  Example : 1 1 0 1 12  24 + 23 + 22 + 21 + 20 = 16 + 8 + 2 + 1 = 2710
  • 12. Decimal to Binary conversions  Convert 2510 to binary number Exercise: Convert 3010 to binary number
  • 13. OCTAL NUMBERING SYSTEM  The octal number system has a base of eight, meaning that it has eight possible digits: 0,1,2,3,4,5,6 and 7.  The digit positions in an octal number have weights as follows : 84 83 82 81 80 •. 8-1 8-2 8-3
  • 14.  Ex: 5248 – 1678 = 3358 1678 – 248 = _________ Octal number - (Subtraction - Pengurangan)
  • 15. Octal –to-decimal conversion Convert 3728 to decimal number 3728 = 3 x (8 2 ) + 7 x (8 1 ) + 2 x (8 0 ) = (3 x 64) + (7x 8) + (2 x 1) = 25010
  • 16. Octal number - Addition (Penambahan)  Ex: 1238 + 3218 4448  Ex: 4578 + 2458
  • 17.  Decimal integer can be converted to octal by using the same repeated-division method with a division factor of 8. Decimal-to-Octal Conversion
  • 18. Octal –to- Binary conversion
  • 19. Binary to Octal conversion
  • 20.  The hexadecimal number system uses base 16.  It has 16 possible digit symbols.  It uses the digits 0 through 9 plus the letters A, B, C, D, E and F as the 16 digit symbols. HEXADECIMAL NUMBERING SYSTEM 7A16 Basic number Base number
  • 21. Hexadecimal number - Addition (Penambahan)  Ex: 3 316  + 4 716  Ex: 2 0 D 316 + 1 2 B C16 7 A16
  • 22. Hexadecimal number - Subtraction (Pengurangan)  Ex: 4 416 - 1 716  Ex: 3 2 5 516 - 3 1 8 216 2 D16
  • 23. Hexadecimal-To-Decimal Conversion  A hexadecimal number can be converted to its decimal equivalent by using the fact that each hex digit position has a weight that is a power of 16.
  • 24.  Ex 1: 1416 = (1 x 161 ) + (4 x 160 ) = 16 + 4 = 2010
  • 25.  Ex 2: ABC16 = (10 x 162 ) + (11 x 161 ) = (12 x 160 ) = 2560 + 176 + 12 = 274810
  • 26.  Decimal to hex conversion can be done using repeated division by 16.  Ex: Convert 2010 to hex Decimal-To-Hexadecimal Conversion 16 20 16 1 4 2010 = 1416
  • 27.  Like the octal number system, the hexadecimal number system is used primarily as a “shorthand” method for representing binary numbers.  It is a relatively simple matter to convert a hex number to binary .  Each hex digit is converted to its four-bit binary equivalent. Hexadecimal-to-Binary Conversion
  • 28.  Ex: 111010012 = __________ 00101101001111002 =___________
  • 29.  The binary number is grouped into groups of four bits, and each group is converted to its equivalent hex digit.  Zero are added, as needed to complete a four-bit group.  Ex: 1012 = 0101 = 516 Binary-to-Hexadecimal Conversion
  • 30. Summary Hexadecimal Decimal Binary 0 0 0000 1 1 0001 2 2 0010 3 3 0011 4 4 0100 5 5 0101 6 6 0110 7 7 0111
  • 31. Summary Hexadecimal Decimal Binary 8 8 1000 9 9 1001 A 10 1010 B 11 1011 C 12 1100 D 13 1101 E 14 1110 F 15 1111
  • 32. 2.1.4 Describe the coding system a. Sign and magnitude b. 1’s Complement and 2’s Complement c. Binary Coded Decimal (BCD system) d. ASCII and EBCDIC
  • 33. Describe the coding system Sign and Magnitude Positive sign, ( 0 ) or Negative sign ( 1 ) Magnitude = Size Or value
  • 34. Describe the coding system Sign and Magnitude Example 1 : Represent -9 in sign and magnitude. -9 sign magnitude 1 1001 11001 -9 in sign &magnitude value is 11001
  • 35. Describe the coding system Sign and Magnitude Example 2 : Represent 25 in sign and magnitude. +25 sign magnitude 0 11001 011001 25 in sign & magnitude value is 011001
  • 36. One’s Complements and Two’s Complements  One’s Complements  One’s complements is used in binary number.  The one’s complement of a binary number is obtained by changing each 0 to 1 and 1 to a 0.  Only change negative number  In other words, change each bit in the number to its complement.
  • 37.  Exp:  10011001 – original binary number  01100110 – complement each bit to form 1’s complement  Thus, we say that the 1’s complement of 10011001 is 01100110.
  • 38.  Exp:  Convert -2710 to 1’s complement a) -2710 = 001002  Convert -4510 to 1’s complement -------------
  • 39.  Two’s Complement  The 2’s complement of a binary number is formed by taking the 1’s complement of the number and adding 1 to the least-significant-bit (LSB) position.  Exp: 101101 binary equivalent of 45 010010 complement each bit to form 1’s complement + 1 add 1 010011 2’s complement of original binary number Two’s complement = One’s Complement + 1
  • 40. Exercise 1. Convert the number below to 1’s complement 2’s complement ------------------- ------------------- -101110012 0100 0110 0100 0111 -5768 01000 0001 01000 0010 -124516 -45
  • 41. Addition in 1’s complement  Exp 1 : 810 + (-310) 1000 8 change to binary number + 1100 -3 change to 1’s complement 10100 1 add carry to LSB 0101  Exercise 2 : 510 + (-210) ----------------
  • 42.  Exp 1: 810 + (-310) 1100 -3 change to 1’s complement + 1 1101 -3 change to 2’s complement + 1000 8 change to binary number 10101 Addition in 2’s complement This carry is disregarded, the result is 0101 (sum=5)
  • 43.  Exp 2: -810 + 310 0111 -8 change to 1’s complement + 1 1000 -8 change to 2’s complement + 0011 3 change to binary number 1011 negative sign bit
  • 44.  Only binary number which have –ve sign need to change to 1’s complement. If the number is decimal number, change the number to binary number.  The –ve number that already change to 1’s complement, means that the number already change to +ve. So that, the subtraction process have change to addition process.  Overflow bit in addition process need to carry to LSB and add with the number. Subtraction in 1’s complement
  • 45.  Exp 1: 2510 – 1310 Step 1 : Convert 2510 and -1310 to binary number. 2510 = 110012 1310 = 11012 Step 2 : Change 1310 = 1101 to 1’s complement 1310 = 11012 change to 1’s complement = 10010 11001 25 change to binary number + 10010 -13 change to 1’s complement 101011 + 1 add 1 01100 total=12
  • 46.  Change the number are given to binary number.  For each –ve binary number, we must change to 1’s complement (change 0 to 1 and 1 to 0).  Then, add the number with 1. Subtraction in 2’s complement
  • 47.  Exp 1: 2510 – 1310 Step 1 : Convert 2510 and -1310 to binary number. 2510 = 110012 1310 = 11012 Step 2 : Change -1310 to 2’s complement -1310 = 011012 change to 1’s complement = 10010 10010 change to 2’s complement = 10011 11001 25 change to binary + 10010 -13 change to 2’s complement 101100 total=12 Carry disregard
  • 48.  Solve this arithmetic with 2’s complement. i. 428 – 158 ii. 101110 - 56910 Exercise
  • 49. Signed Number  Addition of Signed Number  Addition number same sign  Exp: +4 + (+8) = +12 +4 00000100 +8 00001000 +12 00001100
  • 50.  Addition number different sign  Exp 1: (-4) + (+8) = +4 -4 11111100 + (+8) 00001000 +4 1 00000100 This carry is disregarded 00000100 +4 11111011 1’s complements + 1 11111100 2’s complements
  • 51.  Exp 1: (-12) + (+5) = -7 -12 11110100 + +5 00000101 -7 11111001 00001100 +12 11110011 1’s complements + 1 11110100 2’s complements Negatif sign bit
  • 52. Subtraction of Signed Number Positive Number (-) Negative Number  Exp: +10 – (-5) = +10 + (+5) = + 15 +10 00001010 + 5 00000101 +15 00001111
  • 53. Negative Number (-) Positive Number  Exp: -10 – (+5) = - 15 - 10 11110110 11110110 - (+5) 00000101 + 11111011 -15 111110001
  • 54. Negative Number (-) Negative Number  Exp: -10 – (-5) = -10 + (5) = - 5 -10 11110110 - (- 5) + 00000101 - 5 11111011
  • 55. BCD Code  BCD – Binary Coded Decimal  It’s contain BCD 8421, 2421, 3321, 5421, 5311, 4221 and etc.  The common used is BCD 8421 and BCD 2421.
  • 56. 4 bit BCD Code Desimal 5421 5311 4221 3321 2421 8421 7421 0 0000 0000 0000 0000 0000 0000 0000 1 0001 0001 0001 0001 0001 0001 0001 2 0010 0011 0010 0010 0010 0010 0010 3 0011 0100 0011 0011 0011 0011 0011 4 0100 0101 1000 0101 0100 0100 0100 5 1000 1000 0111 1010 1011 0101 0101 6 1001 1001 1100 1100 1100 0110 0110 7 1010 1011 1101 1101 1101 0111 1000 8 1011 1100 1110 1110 1110 1000 1001 9 1100 1101 1111 1111 1111 1001 1010
  • 57. Binary-Coded-Decimal Code  If each digit of a decimal number is represented by its binary equivalent, the result is a code called binary-coded-decimal.  Decimal digit can be as large as 9, four bits are required to code each digit (the binary code for 9 is 1001)
  • 58.  Exp: 87410 8 7 4 (decimal) 1000 0111 0100 (BCD)
  • 59. BCD 8421 Code – to – Binary Number  Exp: Convert 1001 0110BCD 8421 to binary number. Step 1: Change BCD 8421 code to decimal number. 1001 0110 9 6 Step 2 : Change decimal number to binary number. 1001 0110BCD 8421 = 11000002
  • 60.  Exp: Convert 10010102 to BCD 8421 code. Step 1: Change binary number to decimal number. 10010102 = 7410 Step 2: Change decimal number to BCD 8421 code. 10010102 = 01110111BCD 8421 Binary Number – to – BCD 8421 Code
  • 61.  The most widely used alphanumeric code is the American Standard Code for Information Interchange (ASCII).  The ASCII code is a seven-bit code and so it has 27 = 128 possible code groups. ASCII Code
  • 62. MSB LSB Binary 000 001 010 011 100 101 110 111 Binary Hex 0 1 2 3 4 5 6 7 0000 0 Nul Del sp 0 @ P p 0001 1 Soh Dc1 1 1 A Q a q 0010 2 Stx Dc2 “ 2 B R b r 0011 3 Etx Dc3 # 3 C S c s 0100 4 Eot Dc4 $ 4 D T d t 0101 5 End Nak % 5 E U e u 0110 6 Ack Syn & 6 F V f v 0111 7 Bel Etb ‘ 7 G W g w 1000 8 Bs Can ( 8 H X h x 1001 9 HT Em ) 9 I Y i y 1010 A LF Sub . : J Z j z 1011 B VT Esc + ; K k 1100 C FF FS , < L l 1101 D CR GS - = M m 1110 E SO RS . > N n 1111 F SI US / ? O o ASCII code
  • 63.  Exp: An operator is typing in a BASIC program at the keyboard of a certain microcomputer. The computer converts each keystroke into its ASCII code and stores the code as a byte in memory. Determine the binary strings that will be entered into memory when operator types in the following BASIC statement: GOTO 25
  • 64.  Solution: Locate each character (including the space) and record ASCII code. G 01000111 O 01001111 T 01010100 O 01001111 (space) 00100000 2 00110010 5 00110101 *0 was added to the leftmost bit of each ASCII code because the Codes must be stored as bytes (eight bits).
  • 65. Exercise : 1.The following message encode in ASCII code. What the meaning of this code ?  a) 54 4F 4C 4F 45 47  b) 48 45 4C 4C 4F  c) 41 50 41 4B 48 41 42 41 52
  • 66. EBCDIC  Stand for Extended Binary Coded Decimal Interchange Code.  was first used on the IBM 360 computer, which was presented to the market in 1964.  Used with large computer such as mainframe.