Ch1 Binary Numbers Part 1
Ch1 Binary Numbers Part 1
Chapter 2
1
` Logic:
A statement is either True or False
Often represented by a T or F.
` Electrical Circuits:
A lamp will be On or Off
A circuit can have current flow or no flow (switch on or
off)
` Polarity:
Positive or negative.
2
How many ones make up 642???
600 + 40 + 2 ?
i.e. 6 hundreds, 4 tens, and 2 ones
6x102 + 4x101 + 2x100
What would it mean if we counted in
eights?
6x82 + 4x81 + 2x80
Then it would mean 418 counting in tens.
3
642 in base 10 positional notation is:
5
R is the base
of the number
As a formula:
642 is 63 * 102 + 42 * 10 + 21
7
6
` Can you show that this representation must
always be unique?
7
` Binary numbers are numbers where
the BASE IS 2
` This means there can only be two digits 0 and
1 (Why?)
` Counting in Binary:
0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001
and so on...
` Why does Base 2 interest us so much?
8
` Octal is where we use BASE 8
` The digits are then 0, 1, 2, 3, 4, 5, 6, 7
9
10
` What is 1010 (as a base 10 number) if the
base is 2, 8, 10 and 16?
` 10
` 520
` 1010
` 4112
11
1. Computers represent data in binary code:
off/on, false/true, 0/1;
2. Thus we would like to represent numbers in
such a format;
3. We can represent numbers in any base. We
are used to base 10 but this is habit; it is not
driven by mathematics;
E.g. 642 is 63 * 102 + 42 * 10 + 21
4. In base R the number dn dn-1 … d2 d1 means:
dn * Rn-1 + dn-1 * Rn-2 + ... + d2 * R + d1
5. Arithmetic works in any base exactly as in base 10.
12
R is the base
of the number
As a formula:
1202
642 = 164*8*3 10
+ 22 +*842 +*010 1 1+ +22
*8
3 3 2 2 11
110091807060504031201 7
13
Addition in Base 2:
We want to add the two numbers
1010111 and
1001011
14
Remember that there are only 2 digits in binary,
0 and 1
1 + 1 is 0 with a carry
Carry Values
1011111
1010111
+1 0 0 1 0 1 1
10100010
15 14
` Let’s take 111011 away from 1010111.
16
Remember borrowing? Apply that concept
here:
12
202
1010111
- 111011
0011100
17
Mark groups of three (from right)
This is because three binary digits exactly
represent the octal digits 0, 1, 2, 3, 4, 5, 6, 7
i.e. 000, 001, 010, 011, 100, 101, 110, 111
Example: Convert 10101011 to octal
18
Mark groups of four (from right)
This is because each group of four binary
digits represents one hexadecimal digit
19