|
|
|
 |
 |
 |
 |
 |
 |
|
|
|
|
|

Internetworking Basics |
|
|
|
|
|
 |
 |
|
 |
| |
Chapter 1: Introduction to Networking
The Binary Number System
These notes guide you understanding the binary number system.
Introduction
Overview of Binary
Number Base and Place Value
Binary Number System
Binary to Decimal Conversions
Decimal To Binary Conversions
Summary
| |
| |
Introduction
On completion of these notes you should be
- Understand number bases and place values
- Understand the binary number system
- Be able to convert from binary to decimal
- Be able to convert from decimal to binary
|
| |
Overview of Binary
The electronic components used in computer systems can usually be in one of two physical states which can be represented by a number 0 or 1. These are also the numbers of the binary system. This is why it is convenient for a computer to use the binary number system, rather than the more familiar denary number system. The hexadecimal and octal number systems are also commonly used in computer systems. These notes look at the binary number system in more detail.
|
| |
Number Base and Place Value
Number Base
The denary number system has ten symbols, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The binary system only has two symbols, 0 and 1. The base of a number system is the number of different symbols it uses. Thus, the denary system is also referred to as base 10 and the binary number system as base 2.
Place Value
The position of a number symbol in relation to other number symbols is very important. The value of a symbol entirely depends on it's position. This is referred to as place value. In the denary system, each place is weighted by a power of ten. We have 100 which is units, 101 which is tens, 102 which is hundreds and so on. Let's illustrate this idea with a table.
| 103 |
102 |
101 |
100 |
. |
10-1 |
10-2 |
10-3 |
| thousands |
hundreds |
tens |
units |
decimal point |
tenths |
hundreths |
thousands |
1
|
2
|
3
|
4
|
|
|
|
|
4 |
3 |
2 |
1 |
|
|
|
|
|
|
|
|
|
1 |
2 |
3 |
The number 123410 can be expressed as 1 thousand + 2 hundreds + 3 tens + 4 units.
This is an entirely different number value to 432110 which is 4 thousands + 3 hundreds + 2 tens + 1 unit. So symbol position is all important.
What about 0.123. This can be expressed as no units + 1 tenth + 2 hundredths + 3 thousandths or 0 + 1/10 + 2/100 + 3/1000.
Note: 100 is actually equal to 1. Any number raised to the power of 0 is equal to 1.
The fractional part of a number is also determined by place value, except the power is a negative number, e.g. 10-1 means tenths.
|
Now, what about other number systems?
The binary number system has two symbols, 0 and 1.
A binary number such as 102 also has a value depending upon the positioning of the symbols. Now however, each place is weighted by a power of two and not a power of ten like the denary system. We have 20 which is units, 21 which is twos, 22 which is fours and so on. A place value table for the binary system would look like...
| 23 |
22 |
21 |
20 |
. |
2-1 |
2-2 |
2-3 |
| 8 |
4 |
2 |
1 |
decimal point |
half |
quarter |
eighth |
|
|
1
|
0
|
|
|
|
|
So, the binary number 102 means 1 two + 0 units.
You should note the binary number 102 is definitely not the same as the number 1010 in the denary system. We will see how to convert a number such as 102 to denary later on.
~Now try the activity~
| Activity A |
-
Add four more columns to the left of the place value table and write in the correct powers of two.
-
We know that 23 = 2 * 2 * 2 = 8. Convert the following powers of 2 in the same way
24,25,26,27
- Add the values calculated in the previous question to your column headings.
- Place the following in the correct position in your binary table
-
1 sixty four + 1 eight + 1 unit
- 1 one hundred and twenty eight + 1 eight + 1 unit
|
Now, what about the hexadecimal number system?
The hexadecimal number system has sixteen symbols...
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
The base of the hexadecimal system is 16. So, each place is weighted by a power of sixteen. A place value table for the hexadecimal system would look like...
| 163 |
162 |
161 |
160 |
. |
16-1 |
16-2 |
16-3 |
| 4096 |
256 |
16 |
1 |
decimal point |
sixteenth |
1/256 |
1/4096 |
|
|
1
|
0
|
|
|
|
|
So, the hexadecimal number 1016 means 1 sixteen + 0 units.
Again, this number 1016 is not the same as the number 1010 in the denary system. We will see how to convert the number to denary later on.
~Now try the activity~
| Activity B |
- Draw up a place value table for the octal number system
- Place the following in the correct position in your octal table
- 5 sixty fours + 2 eights + 3 units
- 7 five hundred and twelve's + 3 eights + 6 units
|
|
| |
Binary Number System
The binary symbols are 1 and 0. Each digit in a binary system is known as a binary digit or bit. An example of a binary number is 101102.
Computers tend to group 8 bits together. A group of 8 bits is known as a byte. Other groupings are:-
- bit: - the smallest addressable unit
- byte - a group of 8 bits
- KB (kilobyte) - 1024 bytes
- GB (gigabyte) - 1024 kilobytes
- TB (terabyte) - 1024 gigabytes.
A computer works with the binary number system in a natural way, since binary correlates well with the on/off states of transistors inside computers. However, humans can find the binary system difficult to deal with. Therefore binary data, which the computer has no problem with, frequently has to be converted to decimal and vice versa solely for our benefit.
To properly understand computer systems, it is necessary to understand the binary system and how to convert between the decimal and binary number systems.. |
| |
Binary to Decimal Conversions
So, how do we convert a number such as 101102 to denary?
| 27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
| 128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
|
|
1
|
0 |
1 |
1 |
0 |
Well 101102 is equivalent to 1×16 + 0×8 +1×4 + 1×2 + 0×1. Which is 16 + 4 + 2 = 2210.
So to convert a binary number to denary, all we do is multiply each binary digit by it's place value and add them all together. Here are a few more examples.
011011012 = 0×128 + 1×64 + 1×32 + 0×16 + 1×8 + 1×4 + 0×2 + 1×1 = 64 + 32 + 8 + 4 + 1 = 10910
100100012 = 1×128 + 0×64 + 0×32 + 1×16 + 0×8 + 0×4 + 0×2 + 1×1 = 128 + 16 + 8 + 1 = 15310
00011102 = 0×128 + 0×64 + 0×32 + 1×16 + 1×8 + 1×4 + 1×2 + 0×1 = 16 + 8 + 4 + 2 = 3010
~Now try the activity~
| Activity C |
- Convert the following binary numbers to denary
- 1100101
2
- 0111000
2
- 0001101
2
- 1000001
|
|
| |
Decimal to Binary Conversions
How do we convert a decimal number to binary?
There are a few ways of doing this. There is the division by 2 method. However, for small decimal numbers, the simplest way is to use the binary place value table.
As an example, suppose we want to convert as 1210 to binary?
Looking at the place value table, the nearest place value less than or equal to 12 is 8. So we can write a 1 below this place value.
However, 12 minus 8 leaves a remainder of 4. The nearest place value less than or equal to 4 is 4. So we can write a 1 below this place value too. There is no remainder.
Now we have to fill in any empty place values with zeros, except those to the left of the leftmost digit 1
So, 1210 is equivalent to 11002
| 27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
|
| 128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
|
|
|
|
1 |
1 |
0 |
0 |
= 1210
|
Here is another example. Let's convert 6510 to binary?
Looking at the place value table, the nearest place value less than or equal to 67 is 64. So we can write a 1 below this place value.
However, 67 minus 64 leaves a remainder of 3. The nearest place value less than or equal to 3 is 2. So we can write a 1 below the 2 place value.
Now 3 minus 2 leaves a remainder of 1. The nearest place value less than or equal to 1 is 1. So we can write a 1 below this place value.
Now we have to fill in any empty place values with zeros, except those to the left of the leftmost digit 1.
So, 6710 is equivalent to 10000112
| 27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
|
| 128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
|
1 |
0 |
0 |
0 |
0 |
1 |
0 |
= 6710
|
~Now try the activity~
| Activity D |
- Convert the following decimal numbers to binary
- 129
10
- 40
10
- 101
10
- 253
10
- Extend the following table to include the decimal numbers 2 to 9 and the binary equivalents.
Base10 |
Base2 |
| 0 |
0000 |
| 1 |
0001 |
|
|
| |
Summary
On completing these notes you should have:-
- Learnt that the binary number system uses base 2, which is made up of 0s and 1s
- Practiced converting from binary to decimal
- Practiced converting from decimal to binary
|
 |
|
 |
|
 |
|
 |
|
| |
|
|

|