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

Binary Number System

this is the first part of mathematic for computing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views52 pages

Binary Number System

this is the first part of mathematic for computing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

BINARY NUMBER SYSTEM CHAPTER 01

MEMORY DEVICES
A memory device is a gadget that helps you
record information and recall the information at
some later time.
MEMORY DEVICES
• Requirement of a memory device:
A memory device must have more than 1 states
(Otherwise, we can't tell the difference)

Memory device in state 0 Memory device in state 1


THE SWITCH IS A MEMORY DEVICE

The electrical switch is a memory device:

The electrical switch can be in one of these 2 states:

OFF (we will call this state 0)


ON (we will call this state 1)
MEMORY CELL USED BY A
COMPUTER
One switch can be in one of 2 states
A row of n switches:

can be in one of 2n states !


MEMORY CELL USED BY A COMPUTER
Example: row of 3 switches

The electrical switch can be in one of these 2 states:

A row of 3 switches can be in one of 23 = 8 states.


The 8 possible states are given in the figure above.
REPRESENTING NUMBERS USING A
ROW OF SWITCHES
We saw how information can be represented by number
by using a code (agreement)
Recall: we can use numbers to represent marital status
information:

0 = single
1 = married
2 = divorced
3 = in relationship
REPRESENTING NUMBERS USING A ROW OF
SWITCHES

We can represent each number using a different state of the


switches.

Example:
THE BINARY NUMBER SYSTEM
The binary number system uses 2 digits to encode a number:

• 0 = represents no value
• 1 = represents a unit value

That means that you can only use the digits 0 and 1 to write a
binary number

 Example: some binary numbers •0


•1
• 10
• 1010
• and so on.
REPRESENTING NUMBERS USING A ROW OF
SWITCHES

To complete the knowledge on how information is represented


inside the computer, we will now study:

• How to use the different states of the


switches to represent different numbers

The representation scheme has a chic name:

• the Binary Number System


THE BINARY NUMBER SYSTEM

What is bit?

A bit is a binary digit, the smallest increment of


data on a machine.
A bit can hold only one of two values:
0 or 1
Because bits are so small, you rarely work with
information one bit at a time
THE BINARY NUMBER SYSTEM

What is byte?

Byte is an abbreviation for "binary term". A single byte is


composed of 8 consecutive bits capable of storing a
single character
THE BINARY NUMBER SYSTEM
Now you should understand how the different states of these 3
switches represent the numbers 0-7 using the binary number
system:
WHAT DOES ALL THIS HAVE TO DO WITH A
COMPUTER ?

Recall what we have learned about the Computer RAM


memory:
WHAT DOES ALL THIS HAVE TO DO WITH A
COMPUTER ?
The connection between the computer memory and the binary
number system is:

• The computer system uses the binary number encoding to


store the number

2016 15
BRIDGING THE DIGITAL DIVIDE
Decimal-to-
Binary
Conversion

Binary-to-Decimal
Conversion

16
WHY USE BINARY?
At the lowest level, computers are based on billions of electrical
elements that have only two states, (usually low and high voltage). By
interpreting these as 0 and 1, it’s very easy to build circuits for storing
binary numbers and doing calculations with them. While it’s possible to
simulate the behavior of decimal numbers with binary circuits as well,
it’s less efficient. If computers used decimal numbers internally, they’d
have less memory and be slower at the same level of technology.
COMMON NUMBER SYSTEMS
Used by Used in
System Base Symbols humans? computers?
Decimal 10 0, 1, … 9 Yes No
Binary 2 0, 1 No Yes
Octal 8 0, 1, … 7 No No
Hexa- 16 0, 1, … 9, No No
decimal A, B, … F
QUANTITIES/COUNTING (1 OF 3)
Hexa-
Decimal Binary Octal decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
QUANTITIES/COUNTING (2 OF 3)
Hexa-
Decimal Binary Octal decimal
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
QUANTITIES/COUNTING (3 OF 3)
Hexa-
Decimal Binary Octal decimal
16 10000 20 10
17 10001 21 11
18 10010 22 12
19 10011 23 13
20 10100 24 14
21 10101 25 15
22 10110 26 16
23 10111 27 17
CONVERSION AMONG BASES
The possibilities:

Decimal Octal

Binary Hexadecimal
QUICK EXAMPLE

2510 = 110012 = 318 = 1916

Base
BINARY TO DECIMAL
Decimal Octal

Binary Hexadecimal
EXAMPLE

1010112 => 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
4310
BINARY TO OCTAL
Decimal Octal

Binary Hexadecimal
EXAMPLE
10110101112 = ?8

1 011 010 111

1 3 2 7

10110101112 = 13278
BINARY TO HEXADECIMAL
Decimal Octal

Binary Hexadecimal
EXAMPLE
10101110112 = ?16

10 1011 1011

2 B B

10101110112 = 2BB16
OCTAL TO DECIMAL
Decimal Octal

Binary Hexadecimal
EXAMPLE

7248 =>
4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810
OCTAL TO BINARY
Decimal Octal

Binary Hexadecimal
EXAMPLE
7058 = ?2

7 0 5

111 000 101

7058 = 1110001012
OCTAL TO HEXADECIMAL
Decimal Octal

Binary Hexadecimal
EXAMPLE
10768 = ?16
1 0 7 6

001 000 111 110

2 3 E

10768 = 23E16
HEXADECIMAL TO DECIMAL
Decimal Octal

Binary Hexadecimal
EXAMPLE

ABC16 => C x 160 = 12 x 1 = 12


B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810
HEXADECIMAL TO BINARY
Decimal Octal

Binary Hexadecimal
EXAMPLE
10AF16 = ?2
1 0 A F

0001 0000 1010 1111

10AF16 = 00010000101011112
HEXADECIMAL TO OCTAL
Decimal Octal

Binary Hexadecimal
EXAMPLE
1F0C16 = ?8
1 F 0 C

0001 1111 0000 1100

1 7 4 1 4

1F0C16 = 174148
DECIMAL TO BINARY
Decimal Octal

Binary Hexadecimal
EXAMPLE 2 125
2 62 1
12510 = ?2 2 31 0
2 15 1
2 7 1
2 3 1
2 1 1
0 1

12510 = 11111012
DECIMAL TO OCTAL
Decimal Octal

Binary Hexadecimal
EXAMPLE

123410 = ?8 8 1234
8 154 2
8 19 2
8 2 3
0 2

123410 = 23228
DECIMAL TO HEXADECIMAL
Decimal Octal

Binary Hexadecimal
EXAMPLE
123410 = ?16
16 1234
16 77 2
16 4 13 = D
0 4

123410 = 4D216

You might also like