Numbers and Units
Storing information
Why binary?
Units you need to know
Converting binary to denary
Why 8 bit binary number?
11111111 in binary, this takes up 8 bits (1 byte)
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255 in denary
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
Convert these numbers
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Adding binary numbers
(144) 10010000
( 1) 00000001 +
(145) 10010001
It’s just like adding denary numbers
Adding binary numbers
(3) 00000011
(3) 00000011 +
(6) 00000110
Explanation:
Right column: 1+1 = 2, but in binary that’s 10. So 0 carry 1
Second to right column:1+1(+1 carried over) = 3 (11 in binary)
8
Overflow
This is when we don’t have enough bits for the answer
(255) 11111111
( 1) 00000001 +
(256) 100000001
Oops. That would need 9 bits to store. We only have 8.
Hex
What is FE in binary?
F E
Do each letter separately (split into nibbles)
(hex) F E
(den) 15 14
(bin) 1111 1110
Now join them together:
11111110
Now you can easily work out the denary (it’s 254!)
Convert 64 into hex
Convert 65 into hex
Convert 176 into hex
Convert 13 into hex
Why Hex?
Task I (to do on paper)
Answers
Task II (to do on paper)
Answers II