Calculators

Last updated: October 15, 2007.
Can you remember the mass of an
electron to six decimal places? Can you figure out the square root of
747 in less than a second? Can you
add up hundreds of numbers, one after another, without ever making a
mistake? Pocket calculators can do all these things and more using tiny
electronic switches called transistors.
Let's take a peek inside a calculator and find out how it works!
Caption: My Casio fx-570 calculator has given
me sterling service since 1984 and is still going strong today.
In case you're wondering, the mass of an electron (one of many
constants stored in this calculator and available at the touch of a
button) is
9.109534 x 10−31 kg (according to this calculator, anyway).
What is a calculator?

Caption: Another shot of the Casio fx-570. The
larger dark gray
keys at the bottom are the numbers and the main "operators" (+, −,
×, ÷, = etc). The
smaller white keys above them carry out a whole range of scientific
calculations with a single button click.
Our brains are amazingly versatile, but we find it hard to calculate
in our heads because they can store only so many numbers. According to
a famous bit of 1950s research by psychologist George Miller, we can
remember typically 5-9 digits (or, as Miller put it: "the magical
number seven, plus or
minus two") before our brains start to ache and forget. That's why
people have been using aids to help them calculate since ancient
times. Indeed, the word calculator comes from the Latin calculare, which means to count up using stones.
Mechanical calculators (ones made from gears and levers) were in
widespread use from the late-19th to the late-20th century. That's when
the first affordable, pocket, electronic calculators started to appear,
thanks to the development of silicon microchips in the late 1960s and
early 1970s. Calculators have much in common with computers: they share
much of the same history and work in a similar way, but there's
one crucial difference: a calculator is an entirely human-operated
machine for processing math, whereas a computer can be programmed to
operate itself and do a whole range of more general-purpose jobs. In
short, a computer is programmable and a calculator is not.
What's inside a calculator?
If you'd taken apart a 19th-century calculator, you'd have found
hundreds of parts inside: lots of precision gears, axles, rods, and
levers, greased to high heaven, and clicking and whirring away every
time
you keyed in a number. But take apart a modern electronic calculator (I
just can't resist undoing a screw when I see one!) and you might be
disappointed at how little you find. I don't recommend you do this with
your brand-new school calculator if you want to stay on speaking terms
with your parents, so I've saved you the bother. Here's what you'll
find inside:

Caption: Inside the fx-570, which is face-down
here. We're effectively looking up into the machine from below.
Don't worry, I managed to put it all back together again just fine!
- Input: Keyboard: About 40
tiny plastic keys with a rubber membrane underneath and a
touch-sensitive circuit underneath that.
- Processor: A microchip
that does all the hard work. This does the same job as all the hundreds
of gears in an early calculator.
- Output: A liquid crystal
display (LCD) for showing you the numbers you type in and the results
of your calculations.
- Power source: A long-life battery (mine has a thin lithium "button"
cell that lasts several years) and maybe also a solar cell to provide free power in the
daylight.
And that's about it!
What happens when you press a key?
Press down on one of the number keys on your calculator and a series
of things will happen in quick succession:
- As you press on the hard plastic, you compress the rubber
membrane underneath it. This is a kind of a miniature trampoline that
has a small rubber button positioned directly underneath each key and a
hollow space underneath that. When you press a key, you squash flat the
rubber button on the membrane directly underneath
it.

Caption: The keyboard membrane seen from above
(left) and below (right). I've left one of the keys on the membrane to
give you an idea of the scale. There's one rubber button directly
beneath each key.
- The rubber button pushes down making an electrical contact
between two layers in the keyboard sensor underneath and the keyboard
circuit detects this.
- The processor chip figures out which key you have pressed.
- A circuit in the processor chip activates the appropriate
segments on the display corresponding to the number you've pressed.
- If you press more numbers, the processor chip will show them up
on the display as well—and it will keep doing this until you press one
of the operations keys (such as +, −, ×,
÷) to make it
do something different. Suppose you press the + key. The calculator
will store the number you just entered in a small memory called a
register. Then it will wipe the display and wait for you to enter
another number. As you enter this second number, the processor chip
will display it digit-by-digit as before. Finally, when you hit the =
key, the calculator will add the two numbers together.
How does the display work?
You're probably used to the idea that your computer screen makes
letters and numbers using a tiny grid of dotscalled pixels.
Early
computers used just a few pixels and looked very dotty and grainy, but
a modern LCD screen uses millions of pixels
and is almost as clear and
sharp as a printed book. Calculators, however, remain stuck in the dark
ages—or the early 1970s, to be precise. Look closely at the digits on a
calculator and you'll see each one is made from a different pattern of
seven bars or segments. The processor chip knows it can display any of
the numbers 0-9 by activating a different combination of these seven
segments. It can't easily display letters, though some scientific calculators (more advanced electronic
calculators with lots of built
into mathematical and scientific formulae) do have a go.
Artwork: A seven-segment display can show all
the numbers from 0-9.
Binary brains
Now just because a calculator can display decimal numbers (0-9),
that doesn't mean it understands them the way that we do. Like
computers, calculators work using an entirely different number system
called binary code based on just two
numbers, zero (0) and one (1). In the decimal system, the columns of
numbers correspond to ones, tens, hundreds, thousands, and so on as you
step to the left—but in binary the same columns represent powers of two
(two, four, eight, sixteen, thirty two, sixty four, and so on). So the
decimal number 55 becomes 110111 in binary, which is 32+16+4+2+1.
One reason people like decimal numbers is because we have 10
fingers. Calculators don't have 10 fingers. What they have instead is
thousands or millions of electronic switches called transistors that can be either on
or off. A calculator can store decimal numbers by switching off a
series of transistors in a binary pattern, rather like someone holding
up a series of flags. The number 55 is like holding up five flags and
keeping one of them down in this pattern:

55 in decimal is equal to (1×32) +
(1×16) + (0×8) + (1×4) + (1×2) + (1×1) =
110111 in binary
A computer doesn't have any flags inside it, but it can store the
number 55 with six transistors switched on or off in the same pattern.
Transistors store binary numbers by switching electric currents
on and off. Switching on a current stores a one; switching it off
stores a zero. So storing numbers is easy. But how can you add,
subtract, multiply, and divide using nothing but electric currents? You
have to use clever circuits called logic gates, which you can read all
about in our logic gates article.
Please note: No calculators were harmed during
the making of this article.
Go shop