Keyboard to binary

When you press a key, the computer does not get a letter. It gets a code made of 1s and 0s. Press a key and follow it from the keyboard to the monitor.

Keyboard

යතුරු පුවරුව

Input

Press a key…

Main memory

ප්‍රධාන මතකය

Processing

Bytes stored: 0

  1. Empty

Processor

සකසනය

Processing

Waiting for a byte…

Monitor

සංදර්ශකය

Output

Click here to type

Press a key and follow its byte from the keyboard to the monitor.

What is happening?

Every letter, digit and symbol has a number, called its ASCII code. When you press a key, that number travels through the computer in binary, in four steps:

  1. The keyboard (input) turns the key press into eight electrical signals, each one ON or OFF, and sends them along a wire.
  2. The main memory stores those eight bits as one byte.
  3. The processor reads the byte and identifies which character it stands for.
  4. The monitor (output) shows that character.

For example, the capital letter A is code 65, which is 01000001 in binary. Each 0 or 1 is called a bit, and 8 bits make one byte. So every letter you type uses one byte.

Things to try

  • Type your name. How many bytes does it use?
  • Type a and then A. Which bit changes?
  • Press Space and Enter. They have codes too, even though you can’t see them.
  • Type the digit 1. Is its binary code the same as the number one?
  • Choose Step by step, press one key, then use the right arrow key to move its byte from one part to the next.

More free ICT tools