Lecture 3
5A-2
How Computers Represent Data
Clocks have 24 hours
Each hour 60 minutes
5A-3
How Computers Represent Data
Computers use electronic switches called transistors
A switch can either be ON or OFF
=1 =0
5A-4
How Computers Represent Data
Binary number system
Used by computers to count
Two distinct digits, 0 and 1
Do you know
0 and 1 combine to make numbers
the bit pattern
representing
H?
The answer
is 01001000
How Computers Represent Data
Bits and bytes
Binary numbers are made of bits
A byte is 8 bits
5A-6
How Computers Represent Data
Any number from the decimal number system can also be
written using binary number system
24 23 22 21 20
=1x 24 + 1x 23 + 0x 22 + 0x 21 + 1x 20
= 1x16 + 1x8+ 0x4+ 0x2 + 1x1
= 16 + 8 + 0 + 0 + 1 = 2510
Other Number Systems
Hexa-Decimal Number System
16 possible values
0,1,2,…9,A,B,..F
Base 16
0,1,2,..7
Base 8
Conversion between Binary and Hexadecimal
Binary to Hexadecimal Hexadecimal to Binary
Make groups of 4 bits Write down binary equivalent
Start from right code of every hexadecimal digit.
Add zeroes to right if required.
Quotient Remainder
3AC16 = 3x162 + 10x161 + 12x160
999/16 62 7
= 768 + 160 + 12
62/16 3 14
= 94010
3/16 0 3
Boolean Algebra
Truth Table for AND operator Truth Table for OR operator
A B Y = A.B A B Y = A+B
0 0 0 0 0 0
0 1 0 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1
5A-17