← Back to course
3/6
Week 03 Β· The processor

Wednesday

On and off: binary
// One instruction at a time, billions of times a second
⏱ about 15 min

Wednesday: On and off: binary

The power is out again, so Nova turns on four tiny lights in a row. Some are lit and some are dark. "I am sending you a number," she says.

Rocket squints. "Lights are not numbers!" Raven looks longer. "What do you notice? Each light is either on or off. Nothing in between."

Nova flickers. "Inside a processor, everything is a switch," she says. "On or off. Would you like a hint? Give each light a value."

Everything is a switch

Deep inside a processor are billions of tiny switches. Each switch is either on or off. There is no half on.

We write on as 1 and off as 0. One switch, one 1 or 0, is called a bit.

A number system that uses only 1 and 0 is called binary. Every number, letter, picture and sound in a computer is stored as bits.

Counting with lights

Here is how four lights can make a number. Each light has a value. From right to left, the values are 1, 2, 4 and 8.

Add up the values of the lights that are on. Ignore the lights that are off.

Light values8421Number
Nova's lightsoffonoffon4 + 1 = 5
Exampleoffoffonon2 + 1 = 3
Exampleonoffonoff8 + 2 = 10
Exampleonononon8 + 4 + 2 + 1 = 15

In binary, we write on as 1 and off as 0. So Nova's lights, off on off on, are written 0101. That is the number 5.

Four bits can show every number from 0 to 15. More bits can show bigger numbers.

Lights are on, on, off, off. Values are 8, 4, 2, 1. What number is that?
WHY THIS EXERCISEThe 8 light and the 4 light are on. 8 + 4 = 12. In binary that is 1100.
Lights off, off, on, off (values 8, 4, 2, 1). What number?
Lights off, on, on, off. What number?
Lights on, off, off, on. What number?
Binary 0111 is what number?
BINARY BASICS
  • Read the question.
  • Tap your answer.
What is one bit?
In binary, which digits are allowed?
Which binary number is 3?
What is the biggest number four bits can show?
StatementTrue or false?
A switch inside a processor can be half on.?
Binary uses only 1 and 0.?
Binary 1000 is the number 8.?
Four bits can show the number 20.?
WHY THIS EXERCISEBinary is simple on purpose. Two states are easy for billions of tiny switches to hold.
Try it
Lay four coins in a row. Heads is on, tails is off.
Give them the values 8, 4, 2, 1 from left to right.
Flip coins to make the number 5, then 10, then your age.

You can read binary now, Crew Technician! Tomorrow you will put the clock, the switches and the instructions together.

← Tuesday