1 of 20

Numbers and Units

Storing information

2 of 20

Why binary?

  • Computers can only understand 0 or 1 (off or on)
  • Broken down a computer is just a load of circuits which either do or don’t let electricity flow. These are controlled by switches, which are either off or on. There’s no half on.
  • Binary consists of 0 and 1, nothing else.

3 of 20

Units you need to know

  • bit
  • nibble
  • byte
  • kilobyte
  • megabyte
  • gigabyte
  • terabyte

4 of 20

Converting binary to denary

  • Denary is “normal” counting (in tens)

  • Binary is counting in twos

  • You need to be able to convert 0 – 255 into 8 bit binary numbers

5 of 20

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

6 of 20

Convert these numbers

  • 100 to denary
  • 1000 to denary
  • 10000 to denary (what have you noticed?)
  • 7 to binary
  • 17 to binary
  • 192 to binary

128

64

32

16

8

4

2

1

7 of 20

Adding binary numbers

(144) 10010000

( 1) 00000001 +

(145) 10010001

It’s just like adding denary numbers

8 of 20

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

9 of 20

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.

10 of 20

Hex

  • Binary is counting in 2s
  • Denary is counting in 10s
  • Hex is counting in 16s.
  • But we only have 10 digits (0-9)… so we use letters (A-F) after the digits to give us 16 different symbols

11 of 20

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!)

12 of 20

Convert 64 into hex

  1. 64 / 16 = 4 remainder 0

  • 4 in hex is 4

  • 0 in hex is 0

  • So answer is 40

13 of 20

Convert 65 into hex

  1. 65 / 16 = 4 remainder 1

  • 4 in hex is 4

  • 1 in hex is 1

  • So answer is 41

14 of 20

Convert 176 into hex

  1. 176 / 16 = 11 remainder 0

  • 11 in hex is B

  • 0 in hex is 0

  • So answer is BO

15 of 20

Convert 13 into hex

  1. 13/ 16 = 0 remainder 13

  • 0 in hex is 0

  • 13 in hex is D

  • So answer is 0D (or just D)

16 of 20

Why Hex?

  • Easier to remember FE than 11111110

  • Easier to read and write hex than binary because a single hex digit replaces four bits

  • Used for colours in html (eg #FF0000 is red)

17 of 20

Task I (to do on paper)

  • Convert these numbers from denary to binary and denary into hex

      • 17, 28, 37, 75, 100, 127, 157

18 of 20

Answers

19 of 20

Task II (to do on paper)

  • Convert these numbers into denary

      • FA, 11101000, 25, 9C, C9, 10001000

20 of 20

Answers II