Computers and Math Binary, Hex, and Decimal Oh My Copyright © Texas Education Agency, 2015. All...
-
Upload
leona-mccoy -
Category
Documents
-
view
212 -
download
0
Transcript of Computers and Math Binary, Hex, and Decimal Oh My Copyright © Texas Education Agency, 2015. All...
Copyright © Texas Education Agency, 2015. All rights reserved. 1
Computers and MathBinary, Hex, and Decimal Oh My
Copyright © Texas Education Agency, 2015. All rights reserved. 2
BACK TO THE FOUNDATIONA brief review of decimal notation
Copyright © Texas Education Agency, 2015. All rights reserved. 3
Numbers Review
a. Natural numbers
b. Integers
c. Positional numbering system
d. Number base
Copyright © Texas Education Agency, 2015. All rights reserved. 4
Exponents
Any number to the 0 power = 1
Example: 20 = 1
Any number to the 1st power = that number
Example: 21 = 2
Copyright © Texas Education Agency, 2015. All rights reserved. 5
Decimals
7 2 57
one hundreds
2 tens
5 ones
Used with permission: Robyn Segrest May 12, 2015.
Copyright © Texas Education Agency, 2015. All rights reserved. 6
7 * 102 = 7 * 100 = + 700
2 * 101 = 4 * 10 = + 20
5 * 100 = 5 * 1 = + 5
725
7 2 5
Used with permission: Robyn Segrest May 12, 2015.
Copyright © Texas Education Agency, 2015. All rights reserved. 7
CONVERTING FROM BINARY TO DECIMAL
11112 = 1510
Copyright © Texas Education Agency, 2015. All rights reserved. 8
Binary
• Base 2
• Uses 0 and 1
Copyright © Texas Education Agency, 2015. All rights reserved. 9
Binary Table
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
This is where binary digits (0s and 1s) go
Place holder value
Decimal equivalent
Used with permission: Robyn Segrest May 12, 2015.
Copyright © Texas Education Agency, 2015. All rights reserved. 10
Convert 000011102
from binary to decimal
000011102 = 1410
128 * 0 = 0
64 * 0 = 0
32 * 0 = 0
16 * 0 = 0
8 * 1 = 8
4 * 1 = 4
2 * 1 = 2
1 * 0 = 0 +
14
0 0 0 0 1 1 1 0
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 0
Used with permission: Robyn Segrest May 12, 2015.
Copyright © Texas Education Agency, 2015. All rights reserved. 11
YOUR TURNBinary to Decimal
Copyright © Texas Education Agency, 2015. All rights reserved. 12
CONVERTING FROM DECIMAL TO BINARY
1410 = 11102
Copyright © Texas Education Agency, 2015. All rights reserved. 13
Binary Conversion
Can be done two different ways– Long division– Subtraction
Copyright © Texas Education Agency, 2015. All rights reserved. 14
Long Division
Convert 3510 to binary
35217
21514
1
81716
1
2488
0
2244
0
2122
0
2010
1
2000
0
2
Binary bits
01000112 = 3510
Used with permission: Robyn Segrest May 12, 2015.
Copyright © Texas Education Agency, 2015. All rights reserved. 15
Subtraction
3710 = 001000112
37 - 32 = 3
3 – 2 = 1
1 – 1 = 0
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
1 1 1
Used with permission: Robyn Segrest May 12, 2015.
Convert 3710 from decimal to binary
Copyright © Texas Education Agency, 2015. All rights reserved. 16
YOUR TURNDecimal to Binary
Copyright © Texas Education Agency, 2015. All rights reserved. 17
HEXADECIMAL BASE 16
F16 = 1510
Copyright © Texas Education Agency, 2015. All rights reserved. 18
Hexadecimal
Characters– 0 – 9– A – F
Can convert directly from hex to decimal but not from decimal to hex
Copyright © Texas Education Agency, 2015. All rights reserved. 19
Hexadecimal (Hex) Binary Decimal
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
A 1010 10
B 1011 11
C 1100 12
D 1101 13
E 1110 14
F 1111 15
Used with permission: Robyn Segrest May 12, 2015.
Copyright © Texas Education Agency, 2015. All rights reserved. 20
Hexadecimal Table
165 164 163 162 161 160
1048576 65536 4096 256 16 1
This is where hexadecimal characters (0 - F) would go
Place holder value
Decimal equivalent
Used with permission: Robyn Segrest May 12, 2015.
Copyright © Texas Education Agency, 2015. All rights reserved. 21
Convert FF16 from to decimal
FF16 = 25510
15 * 16 = 240
15 * 1 = +15
255
F F
163 162 161 160
65536 4096 16 1
Used with permission: Robyn Segrest May 12, 2015.
Copyright © Texas Education Agency, 2015. All rights reserved. 22
YOUR TURN
Hexadecimal to Binary
Copyright © Texas Education Agency, 2015. All rights reserved. 23
DECIMAL TO HEX CONVERSION
Copyright © Texas Education Agency, 2015. All rights reserved. 24
Convert 5410 to Hexadecimal
54- 32 = 2222 – 16 = 66 – 4 = 22 – 2 = 0 5410 = 0011 01102
0011 01103 6
5410 = 3616
Convert from decimal to binary
Convert from binary to hex
Used with permission: Robyn Segrest May 12, 2015.
Copyright © Texas Education Agency, 2015. All rights reserved. 25
Convert 12810 to Hexadecimal
128 - 128 = 012810 = 1000 00002
1000 00008 0
12810 = 8016Binary to hex
Decimal to binary
Used with permission: Robyn Segrest May 12, 2015.
Copyright © Texas Education Agency, 2015. All rights reserved. 26
YOUR TURN
Decimal to Hexadecimal
Copyright © Texas Education Agency, 2015. All rights reserved. 27
IP ADDRESSING
Copyright © Texas Education Agency, 2015. All rights reserved. 28
IPv4
Every node on a network must have a unique IP address: Internet Protocol version 4
• Unique 32-bit number– Divided into four octets divided by decimal points
» EX: 192.168.0.3
• Separated into classes
Copyright © Texas Education Agency, 2015. All rights reserved. 29
Commonly Used IPv4 Classes
Used with permission: Robyn Segrest March 29, 2015.
Class First Octet Shared Octets
Number of Networks
Maximum Addressable
Hosts
A 1 – 126 1 126 16,777,214
B 128 – 191 2 > 16,000 65,534
C 192 – 223 3 > 2,000,000 254
Copyright © Texas Education Agency, 2015. All rights reserved. 30
IPv4
Highest decimal number an octet may be is 255– Each octet is equal to eight binary bits
• 111111112 = 25510
Running out of IPv4 addresses due to 32-bit limitation
Combined with a ‘subnet mask’ to increase number of addressable nodes on a network
Copyright © Texas Education Agency, 2015. All rights reserved. 31
Subnet Mask
Used with permission: Robyn Segrest March 29, 2015.
Class First Octet Default Subnet Mask
A 1 – 126 255.0.0.0
B 128 – 191 255.255.0.0
C 192 – 223 255.255.255.0
Copyright © Texas Education Agency, 2015. All rights reserved. 32
IPv6
Composed of 128 bits– Eight 16-bit fields
• Represented by hexadecimal numbers– Divided into groups of four hexadecimal characters
» EX: FEE3:00FF:003D:0000:0000:0000:3015:AABC– Multiple fields with zero values can be abbreviated
» EX: 00EE – EE» 0000 - 0
Copyright © Texas Education Agency, 2015. All rights reserved. 33
Assigning IP Addresses
Can be done manually or by DHCP (Dynamic Host Configuration Protocol)
– Static IP address• Manually assigned• Does not change• Human error in duplicating addresses can cause connection
issues
– Dynamic IP addressing• Assigned automatically by a DHCP server• Most common and simplest method
Copyright © Texas Education Agency, 2015. All rights reserved. 34
Boolean Operators
Also called Logical Operators or just bool
Logical operators that return true or false
Three basic Boolean operators
Order of Boolean operations
Copyright © Texas Education Agency, 2015. All rights reserved. 35
Truth Tables
ANDInput 1 Input 2 Output
0 0 00 1 01 0 01 1 1
ORInput 1 Input 2 Output
0 0 00 1 11 0 11 1 1
!ANDInput 1 Input 2 Output
0 0 10 1 11 0 11 1 0
!ORInput 1 Input 2 Output
0 0 10 1 01 0 01 1 0
Used with permission: Robyn Segrest May 12, 2015.
Copyright © Texas Education Agency, 2015. All rights reserved. 36
ANDING
Every IP address has a default subnet mask– Class A – 255.0.0.0– Class B – 255.255.0.0– Class C – 255.255.255.0
In order to locate a specific node on the network a computer must AND the IP address with the appropriate subnet mask in binary
Based on our truth tables we should know the following– 1 AND 1 = 1– 1 AND 0 = 0– 0 AND 1 = 0– 0 AND 0 = 0
Copyright © Texas Education Agency, 2015. All rights reserved. 37
Finding the Network Address
EXAMPLE:• IP address: 192.168.0.10• Subnet mask: 255.255.255.0
First we convert both to binary:
IP address: 11000000.10101000.00000000.00001010 (192.168.0.10)
Subnet Mask: 11111111.11111111.11111111.00000000 (255.255.255.0)
AND: 11000000.10101000.00000000.00000000 (192.168.0.0)
The result of ANDing is the network address.
Copyright © Texas Education Agency, 2015. All rights reserved. 38
YOUR TURN
Converting IP Addresses