0% found this document useful (0 votes)
6 views42 pages

Binary and Hexa (Ch1)

Unit 3 covers data representation, focusing on binary and denary numbering systems, conversion methods between them, and the use of hexadecimal for easier data handling. It explains how computers utilize binary for data storage and processing, and provides examples of converting between binary, denary, and hexadecimal. Additionally, it discusses practical applications of hexadecimal in programming and data representation, such as memory dumps and color codes in HTML.

Uploaded by

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

Binary and Hexa (Ch1)

Unit 3 covers data representation, focusing on binary and denary numbering systems, conversion methods between them, and the use of hexadecimal for easier data handling. It explains how computers utilize binary for data storage and processing, and provides examples of converting between binary, denary, and hexadecimal. Additionally, it discusses practical applications of hexadecimal in programming and data representation, such as memory dumps and color codes in HTML.

Uploaded by

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

Unit 3

Data
Unit 3: Data
 Binary Numbering System
 Data Representation
 Data storage and compression
 Encryption
Binary Numbering System
What is Denary?
 We use Denary ( Decimal) System with digits 0,1,2,3,4,5,6,7,8,9
 Denary system is base 10 system
For example the number 236

200 30 6 Different values


Why?
• Each digit have place value according to its position in the numerical system.
• In Denary system, the place value =10n
where n start from 0 at rightmost and is increased by 1 from right to left.

Eg. 4810

103 102 101 100


Place Value

1000 100 10 1

Number 4 8 1 0
4810 (4*1000) + (8*100)+ (1*10)
+
= (1*0)
Binary System
 Computer use Binary System
 Binary System is a base 2 system with only two digit (bit) 0 or 1.
 For Example : 1011
 In Binary, the place value = (2n) where n is increased from right to left

23 22 21 20
Place Value
8 4 2 1

Number 1 0 1 1
Converting Binary to Denary
 Example1 : Find the equivalent denary number of 10101101
Place value 27 26 25 24 23 22 21 20

128 64 32 16 8 4 2 1
1 0 1 0 1 1 0 1

128 + 32 + 8+ 4+ 1=173
10101101=173
Converting Binary to Denary
 Example1 : Find the equivalent denary number of 01101100
Place value 27 26 25 24 23 22 21 20

128 64 32 16 8 4 2 1
0 1 1 0 1 1 0 0

64 + 32 + 8+ 4=108
01101100=108
Converting Binary to Denary
 Example1 : Find the equivalent Denary number of 1100

8 4 2 1
1 1 0 0

8 + 4 = 12
1100 = 12
Exercise
 What are the denary equivalents of the following binary numbers?
(a) 0 0 1 1 0 0 1 1
(b) 1 0 1 0 1 0 1 0
Homework
Convert the following binary numbers into denary:
a. 0 0 1 1 0 0 1 1
b. 0 1 1 1 1 1 1 1
c. 1 0 0 1 1 0 0 1
d. 0 1 1 1 0 1 0 0
e. 1 1 1 1 1 1 1 1
f. 0 0 0 0 1 1 1 1
g. 1 0 0 0 1 1 1 1
h. 1 0 1 1 0 0 1 1
i. 0 1 1 1 0 0 0 0
j. 1 1 1 0 1 1 1 0
Converting Denary to Binary (Method 1)
 Example1 : Find the equivalent Binary number of 69
27 26 25 24 23 22 21 20

128 64 32 16 8 4 2 1
0 1 0 0 0 1 0 1

69 = 64 + 4 + 1

69 = 01000101
Converting Denary to Binary (Method 1)
 Example1 : Find the equivalent Binary number of 213
27 26 25 24 23 22 21 20

128 64 32 16 8 4 2 1
1 1 0 1 0 1 0 1

213 128 + 64 + 16 + 4 + 1
=

213 = 11010101
Converting Decimal to Binary (Method 2)
For example : Find the equivalent Binary number of 69

2 69 R
2 34 1

2 17 0

2 8 1

2 4 0 Bottom to up
2 2 0

2 1 0
0 1

The denary number 69= 1000101 =01000101(8 bit binary


number)
Converting Decimal to Binary (Method 2)
For example : Find the equivalent Binary number of 213

2 213 R
2 106 1

2 53 0

2 26 1

2 13 0 Bottom to up
2 6 1

2 3 0
2 1 1
0 1

The denary number 213= 11010101


Exercise
 Convert the following denary numbers into binary (using both
methods):
(a)4 1 (c) 193 (e) 255 (g) 107
(b) 74 (d) 127 (f) 97 (h) 232
Usage of Binary Number
Number 15
0000111
Text A 1
0100000
1
Image/graphics 0100000
1110011
11
1000000
0101101 0
Voice 1100111 ….
10
1100000
0
….
 Computer used binary to represent data ( Number, text, graphics and voice) and
program instructions
Why?
Usage of Binary Number
 Binary is needed to represent data and instructions because of the way in which
computers work.
 The processor , which process all data and instruction, contains billions of
transistors which are connected together to form circuit
 The transistor act as switch and have only two states: on or off , these states
are represented by binary number ( 1 and 0 )
Example
 If the download speed for internet is 32 megabit per second, how long
would it take to download a 40 MB file (in second)?

32 megabit= 4MB
4MB = 1 sec

40MB = 10 sec
Usage of Binary number
 Register
 Is a group of bit
1 0 1 1 0 1 0 1
 Can store data, instruction and address.
 When computers (or microprocessors) are used to control devices
(such as robots), registers are used as part of the control system.
Hexadecimal System (Hexa)
 It is difficult for humans to remember and manipulate 8-bit or 32-bit binary
number
 Thus, Hexadecimal is used to represent binary number.
 Computer never use hexadecimal number.
 Hexadecimal is a base 16 system with digits
0,1,2,3,4,5,6,7,8,9, A(=10), B (=11), C (=12), D (=13), E
(=14),
F (=15)
 In Hexadecimal, the place value is power of 16 (16n) in which the
power(n) is increased from right to left
 For Example : 1A9
Place 162 161 160
Value 256 16 1

Number 1 A 9
Hexadecimal
 It is fast and simple to convert between hexadecimal numbers and
binary.
 How many number of bits are used to represent hexa digit.
F=15=?
8 4 2 1

1 1 1 1

F=15=1111
 Binary used 4 bit to represent hexadecimal
 Hexadecimal can be used to represent large binary number is just a
few digit which makes it easier to read, write and understand.
Hexadecimal
HEXA Denar Binary HEXA Denar Binary
y y
0 0 0000 A 10 1010

1 1 8
0402
011 B 11 1011

2 2 0010 C 12 1100

3 3 8
0402
111 D 13 8
1412
01

4 4 0100 E 14 1110

5 5 0101 F 15 1111

6 6 0110

7 7 0111

8 8 1000

9 9 1010
Converting binary to Hexadecimal
 For Example 1:
 101111100001
 Split this into 4 bit group

1011 1110 0001

842 842 842


1
101 1
111 1
000
1 0 1
11 14 1

B E 1

I01I11100001=
BE1
Converting binary to Hexadecimal
 For Example 2: 10000111111101

10 0001 1111 1101

10 000 111 110


842 1
842 1842 1
842
1
001 1
000 1
111 1
110
0 1 1 1
2 1 F D

100 0 0 I 111111 0 l= 21FD


Converting Hexadecimal to Binary
 For Example 1:
 45A
4 5 A
842 842 842
1
010 1
010 1
101
0 1 0
45A=01000101101
0
Converting Hexadecimal to Binary
 For Example 1:
 2BF
2 B F
842 842 842
1
001 1
101 1
111
0 1 1
2BF=00101011111
1
Converting Hexadecimal to Decimal
 For Example : 45A
162 161 160
4 5 A

(4 * + (5 * 16=80 ) +(10* 1=10) = 1114


256=1024)
45A= 1114
 multiply each digit by its place
value
 Add the totals together
Converting Hexadecimal to Decimal
 For Example : 2BF
162 161 160
2 B F

(2* 256=512) + (11 * +(15* 1=15) = 703


16=176 )
2BF= 703
 multiply each digit by its place
value
 Add the totals together
Exercise
1. Find the hexadecimal number of 1 1 0 0 0 0 1 1
2. Find the binary number of B F 0
Converting Decimal to Hexadecimal

For example : Convert denary number 162 to Hexa decimal

16 162 R Hex
2 a
16 10 2
Bottom to up
0 10 A

The denary number 162 = A2  Successive division by 16

 The remainders are read from


BOTTOM to TOP to give the
hexadecimal value.
Converting Decimal to Hexadecimal
For example : Convert denary number 2004 to Hexa decimal

16 2004 R Hex
4 a
16 125 4

16 7 13 D Bottom to up
0 7 7

The denary number 2004= 7D4


Usage of Hexadecimal
 Computer do not actually process hexadecimal, they convert it into binary before
processing
 Programmers work with hexadecimal as it is easier to read than binary.
 Hexadecimal is a much shorter way of representing binary data.
Usage of HexaDecimal
 Memory Dump
 is the process in which contents of a memory are displayed and stored if
application or system crashes.
 Memory dump helps software developers and system administrators to
diagnose, identify and resolve the problem that led to application or system
failure.
00990F60 54 68 69 73 …………..
 Color code in HTML
 Used in HTML
 Three primary colors (red, green, blue) is determined by its hexadecimal
 Red : FF 00 00 1111 1111 0000 0000 0000 0000
 Green: 00 FF 00
 Blue: 00 00 FF
Eg. <body bgcolor=FF0000>
Usage of HexaDecimal
 ASCII CODE
 Can be represented using hexadecimal values or decimal values.
Eg A = 65(decimal) = 41(hexa)
 Assembly code and machine code
 Using hexadecimal makes it much easier, faster and less error prone
to write code compared to binary.
 A5E4 FFA4 (machine code using hexadecimal)
Usage of Hexadecimal
Media Access Control Address (MAC)
 Is a unique number which identifies a device on the internet .
 Is assigned by manufacture company.
 A MAC address is usually made up of 48 bits which are shown as six groups of
hexadecimal digits (although 64-bit addresses are also known):
 NN - NN - NN - DD - DD – DD or
 NN:NN:NN:DD:DD:DD
 where the first half (NN - NN - NN) is the identity number of the manufacturer of
the device
 the second half (DD- DD - DD) is the serial number of the device.
 eg 00 – 1C – B3 – 4F – 25 – FE
Use of the Hexadecimal Number
Internet Protocol (IP) address
 Each devices to a network is given an address known as the internet protocol (IP)
address.
 Eg. A8fb:7a88:0fff:3d21:2085:66fb:f0fa (IPv6)
Advantages of Hexa Decimal
 Easier to read, understand and remember
 Short way to represent binary
 Fewer errors made
 Easier to debug error.
Six binary or hexadecimal numbers and six denary conversions are given.
Draw a line to connect each binary or hexadecimal number to the correct denary
conversion.
[email protected]
09969343359
[email protected]

You might also like