What is Binary?

advertisement
N4 Computing Science Software Design and Development
"There are 10 kinds of
people in the world,
those who understand
binary numbers, and
those who don't."
Learning Intentions
Use of binary to represent and store:
 positive integers
 characters
 instructions (machine code)
Units of storage (bit, byte, Kb, Mb, Gb, Tb, Pb)
What is Binary?
Binary is a number system made up of only two states and uses two symbols 0 and 1
What is a number system?
Think about our number system called Decimal which is base 10, it is made up of 10 states
0,1,2,3,4,5,6,7,8,9
Why do we need to know about Binary?
Binary is the number system that all computers use.
Why does a computer use Binary and not decimal?
Electronic computers have many circuits that switch On and Off.
When a pulse of electricity is passed down a wire it is On and can be represented in binary by 1.
When electricity is not passed down a wire it is Off and can be represented in binary by 0
Machine code is the language understood by the computer’s CPU it is classed as a low level
language and is made up of binary instructions such as 10001110.
This is difficult for humans to interpret (understand) but computers find this much easier and faster
to interpret.
Humans can understand programming languages such as Visual Basic much easier, because they are
text based, this language is classed as a high level language.
So when the computer user presses the letter f on the keyboard this instruction
is sent to the computer as binary?
Yes
How does that work?
First you have to understand that all numbers can be represented by just the binary symbols of 0
and 1.
Show me.
Well…. we will have to get a bit mathematicy here… sorry.
Our number system, decimal, is base 10 and uses the symbols 0,1,2,3,4,5,6,7,8,9 to represent all our
numbers using a combination of these symbols. So fifteen is represented with 15 and seven with a 7.
Binary is base 2 and can represent all the numbers by just using the symbols 0 and 1. So fifteen is
represented in binary as 1111 and seven is represented in binary as 111
Go to http://www.mathsisfun.com/binary-number-system.html for more information
Decimal
Binary
0
1
2
3
4
5
6
7
8
0
.
..
…
….
…..
……
…….
……..
1
Start at 0
Then 1
10
Start back at 0 again, but add 1 on the left
11
start back at 0 again, and add one to the number on the left...
... but that number is already at 1 so it also goes back to 0 ...
... and 1 is added to the next position on the left
100
101
110
111
Start back at 0 again (for all 3 digits),
add 1 on the left
1000
Watch the YouTube video for more information http://www.youtube.com/watch?v=EzTcGnUxPPY
Base 2
This
means…
Decimal
Binary
28
27
26
25
24
23
22 21 20
2x2x2x2x2x2x2x2
2x2x2x2x2x2x2
2x2x2x2x2x2
2x2x2x2x2
2x2x2x2
2x2x2
2x2
2
1
256
100000000
128
10000000
64
100000
32
100000
16
10000
8
1000
4
100
2
10
1
1
Look at the example table below which converts binary numbers to their
decimal equivalent. Practice converting the second table of binary
numbers to their decimal equivalents on the next page.
BINARY
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
DECIMAL
Conversion
Base 2
23
22
21
20
Binary
Decimal
0
0
0
0
0
0
0
0
Base 2
23
22
21
20
Binary
Decimal
0
0
0
0
0
0
1
1
Base 2
23
22
21
20
Binary
Decimal
0
0
0
0
1
2
0
0
Base 2
23
22
21
20
Binary
Decimal
0
0
0
0
1
2
1
1
Base 2
23
22
21
20
Binary
Decimal
0
0
1
4
0
0
0
0
Base 2
23
22
21
20
Binary
Decimal
0
0
1
4
0
0
1
1
Base 2
23
22
21
20
Binary
Decimal
0
0
1
4
1
2
0
0
Base 2
23
22
21
20
Binary
Decimal
0
0
1
4
1
2
1
1
Base 2
23
22
21
20
Binary
Decimal
1
8
0
0
0
0
0
0
Base 2
23
22
21
20
Binary
Decimal
1
8
0
0
0
0
1
1
Base 2
23
22
21
20
Binary
Decimal
1
8
0
0
1
2
1
1
0
1
2
3
4
5
6
7
8
9
10
Name:_________________________________________
BINARY
1000
1001
1010
1011
1100
1101
1110
1111
BINARY
0001
DECIMAL
Conversion
Base 2
23
22
21
20
Binary
Decimal
1
0
0
0
0
0
0
Base 2
23
22
21
20
Binary
Decimal
1
0
0
1
Base 2
23
22
21
20
Binary
Decimal
1
0
1
0
Base 2
23
22
21
20
Binary
Decimal
1
0
1
1
Base 2
23
22
21
20
Binary
Decimal
1
1
0
0
Base 2
23
22
21
20
Binary
Decimal
1
1
0
1
Base 2
23
22
21
20
Binary
Decimal
1
1
1
0
Base 2
23
22
21
20
Binary
Decimal
1
1
1
1
DECIMAL
BINARY
0111
0101
1101
0011
1011
1001
1111
0110
1110
DECIMAL
Download