Binary and Hexa (Ch1) - 1
Binary and Hexa (Ch1) - 1
Computer systems
1. Data representation
2. Data transmission
3. Hardware
4. Software
5. The internet and its uses
6. Automated and emerging technologies
Algorithms, programming and logic
7. Algorithm design and problem-solving
8. Programming
9. Databases
10.Boolean logic
Chapter 1
Data Representation
Numbering System
Text, Sound and images
Data storage and compression
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
Eg. 4810
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 or
heading 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
(a) 103
(b) 135
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
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
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.
Converting binary to Hexadecimal
For Example 1:
101111100001
Split this into 4 bit group
B E 1
I01I11100001=
BE1
Converting binary to Hexadecimal
For Example 2: 10000111111101
Exercise
(1)19FE
(2) 8DCE
Hw Pg 10 – Act 1.4
Pg 11- Act 1.5
Converting Hexadecimal to Denary
For Example : 45A
162 161 160
4 5 A
Ex1
(a) A01
(b)19
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 Denary to Hexadecimal
16 162 R Hex
2 a
16 10 2
Bottom to up
0 10 A
16 2004 R Hex
4 a
16 125 4
16 7 13 D Bottom to up
0 7 7
The denary number 2004= 7D4
Ex 255
127
Hw hexa
pg 9 – Act 1.3
Pg 10 – Act 1.4
Pg 11- Act 1.5
pg 12- Act 1.6
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, copy and understand
than binary.
Hexadecimal is a much shorter way of representing binary data.
There are four uses of hexa system
Error code
MAC address
IPV6 address
HTML color codes
Usage of HexaDecimal
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