PHYS 324 DIGITAL ELECTRONICS Binary Numb

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

PHYS.

324 - ELECTRONICS
Prof. Dr. Ali S. Hennache

DIGITAL ELECTRONICS
Binary Number Systems
A Binary Number is made up of only 0s and 1s.

Example of a Binary Number

110100
There is no 2,3,4,5,6,7,8 or 9 in Binary

A Binary Digit can only be 0 or 1

Binary Number

A Binary Number is made up Binary Digits.

Bits: In the computer world "binary digit" is often shortened to


the word "bit"

Words
The word binary comes from "Bi-" meaning two. We see "bi-" in
words such as "bicycle" (two wheels) or "binocular" (two eyes).

When you say a binary number, pronounce each digit


(example, the binary number "101" is spoken as "one zero
one", or sometimes "one-oh-one"). This way people don't get
confused with the decimal number.
A single binary digit (like "0" or "1") is called a "bit". For
example 11010 is five bits long.
The word bit is made up from the words "binary digit"

More Than One Digit

So, there are only two ways you can have a binary digit ("0" and "1",
or "On" and "Off") ... but what about 2 or more binary digits?

Let's write them all down, starting with 1 digit (you can test it yourself
using the switches):

2 ways to have one digit

1
4 ways to have two digits

0 → 00
0
1 → 01

0 → 10
1
1 → 11
8 ways to have three digits

0 → 000
0
1 → 001
0
0 → 010
1
1 → 011

0 → 100
0
1 1 → 101

1 0 → 110
1 → 111

and 16 ways to have four digits.

0 → 0000
0
1 → 0001
0
0 → 0010
1
1 → 0011
0
0 → 0100
0
1 → 0101
1
0 → 0110
1
1 → 0111

0 → 1000
0
1 → 1001
0
0 → 1010
1
1 → 1011
1
0 → 1100
0
1 → 1101
1
0 → 1110
1
1 → 1111

And, in fact, we have created the first 16 binary numbers:

Decimal: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Binary: 0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111

This is quite a useful thing to remember. If you forget how the


sequence of binary numbers go, just think:

 "0" and "1" {0,1}


 then "0" and "1" again but with a "1" in front: {0,1,10,11}
 then take those four with "1"s as a third
digit: {0,1,10,11,100,101,110,111}
 and so on!

(Or count in the same way as decimal numbers, but don't use
2,3,4,5,6,7,8 or 9.)

Exercise

Convert the numbers below from binary to decimal:

 10
 111
 10101
 11110

Remember:
2^4| 2^3| 2^2| 2^1| 2^0
| | | 1 | 0
| | 1 | 1 | 1
1 | 0 | 1 | 0 | 1
1 | 1 | 1 | 1 | 0

Position
In the decimal System there are the Units, Tens, Hundreds, etc

In Binary, there are Units, Twos, Fours, etc, like this:


(1101.101) is 1×8 + 1×4 + 0×2 + 1 + 1×(1/2) + 0×(1/4) +
1×(1/8)
= 13.625 in Decimal

Numbers can be placed to the left or right of the point, to indicate values greater than
one or less than one.

10.1
The number to the left of the point is a whole
number (10 for example)

As we move further left, every number place


gets 2 times bigger.

The first digit on the right


means halves (1/2).

As we move further right, every number


place
gets 2 times smaller (half as big).
Example: 10.1

 The "10" means 2 in decimal,


 The ".1" means half,
 So "10.1" in binary is 2.5 in decimal

Words
The word binary comes from "Bi-" meaning two. We see "bi-" in words
such as "bicycle" (two wheels) or "binocular" (two eyes).

When you say a binary number, pronounce each digit


(example, the binary number "101" is spoken as "one zero
one", or sometimes "one-oh-one"). This way people don't get
confused with the decimal number.
A single binary digit (like "0" or "1") is called a "bit". For
example 11010 is five bits long.
The word bit is made up from the words "binary digit"
How to Show that a Number is Binary
To show that a number is a binary number, follow it with a little 2 like
this: 1012

This way people won't think it is the decimal number "101" (one
hundred and one).

Example: What is 11112 in Decimal?

 The "1" on the left is in the "2×2×2" position, so that means


1×2×2×2 (=8)
 The next "1" is in the "2×2" position, so that means 1×2×2 (=4)
 The next "1" is in the "2" position, so that means 1×2 (=2)
 The last "1" is in the units position, so that means 1
 1111 = 8+4+2+1 = 15 in Decimal

Example: What is 10012 in Decimal?

 The "1" on the left is in the "2×2×2" position, so that means


1×2×2×2 (=8)
 The "0" is in the "2×2" position, so that means 0×2×2 (=0)
 The next "0" is in the "2" position, so that means 0×2 (=0)
 The last "1" is in the units position, so that means 1
 1001 = 8+0+0+1 = 9 in Decimal

Example: What is 1.12 in Decimal?

 The "1" on the left side is in the units position, so that means 1.
 The 1 on the right side is in the "halves" position, so that means
1×(1/2)
 1.1 is "1 and 1 half" = 1.5 in Decimal

Example: What is 10.112 in Decimal?

 The "1" is in the "2" position, so that means 1×2 (=2)


 The "0" is in the units position, so that means 0
 The "1" on the right of the point is in the "halves" position, so
that means 1×(1/2)
 The last "1" on the right side is in the "quarters" position, so that
means 1×(1/4)
 10.11 is 2+0+1/2+1/4 = 2.75 in Decimal
How to convert decimal to binary
In order to convert decimal number x to binary number:
For decimal number x:
1. Get the highest power of 2 that is less than the decimal number x:

2n < x, (n=1,2,3,...)
2. The high binary digit is equal 1:

dn = 1
3. Calculate the difference Δ of the number x and he power of 2, 2n:

Δ = x - 2n
4. Repeat step #1 with the difference until the result is 0.

Example
Convert x=13 to binary.

Solution
n=3, 23=8 < 13
n=4, 24=16 > 13
So
n=3
d3 = 1
Δ = 13 - 23 = 5
n = 2, x = Δ = 5
d2 = 1
Δ = 5 - 22 = 1
n = 1, x = Δ = 1
d2 = 0
n = 0, x = Δ = 1
d0 = 1
Δ=1-1=0
(d3d2d1d0) = 1101
So 13 in decimal is equal to 1101 in binary:
x = 1310 = 11012

Decimal Value 1 7 9 13 16 18 21 30 99
Binary 00 011 100 110 0001000 0001001 0001010 0001111 0110001
01 1 1 1 0 0 1 0 1

Decimal 145 238 363 475 532 688 760 879 999
Value
Binary 10010 1110 000 00011 0010000 0010101 0010111 0011011 0011111
001 1110 101 10110 10100 10000 11000 01111 00111
101 11
011

How to convert binary to decimal


Example
The decimal number is equal to the sum of powers of 2 of the binary number's '1'
digits place:
binary number: 1 1 1 0 0 1
power of 2: 25 24 23 22 21 20

1110012 = 1·25+1·24+1·23+0·22+0·21+1·20 = 57

Exercise

binary number: 1000000 00

power of 2:

What is the decimal value of the above binary number?

1000000002 = 1·2?+0·2?+0·2?+0·2?+0·2?+..........+0·20 = ..............?????

PROF.ASH/AIMISIU/CS/DP/RUH/KSA/29.04.2014/23.47//

You might also like