0% found this document useful (0 votes)
10 views5 pages

Document 13

Uploaded by

samanvitha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views5 pages

Document 13

Uploaded by

samanvitha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

• 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). Some calculators also have a solar cell to provide free power in the daylight.

The most basic calculations are addition, subtraction, multiplication, and


division. The more transistors an integrated circuit has, the more advanced
mathematical functions it can perform. Today's scientific calculators, for
example, can perform incredibly advanced mathematical calculations.
Like all other electronic devices, calculators work by processing information
in binary form. We're used to thinking of numbers in our normal base-ten
system, in which there are ten digits to work with: 0, 1, 2, 3, 4, 5, 6, 7, 8, and
9. The binary number system is a base-two system, which means there are
only two digits to work with: 0 and 1. Thus, when you input numbers into a
calculator, the integrated circuit converts those numbers to binary strings of
0s and 1s.
The integrated circuits then use those strings of 0s and 1s to turn transistors
on and off with electricity to perform the desired calculations. Since there
are only two options in a binary system (0 or 1), these can easily be
represented by turning transistors on and off, since on and off easily
represent the binary options (on = 0 and off = 1 or vice versa).
Once a calculation has been completed, the answer in binary form is then
converted back to our normal base-ten system and displayed on the
calculator's display screen. Most calculator displays use inexpensive
technologies common today, such as liquid crystal displays (LCD) or light-
emitting diodes (LED).

ress down on one of the number keys on your calculator and a series of things will happen in
quick succession:

1. 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.
2. The rubber button pushes down making an electrical contact between two layers in the
keyboard sensor underneath and the keyboard circuit detects this.
3. The processor chip figures out which key you have pressed.
4. A circuit in the processor chip activates the appropriate segments on the display
corresponding to the number you've pressed.
5. 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 and store it in another register.
Finally, when you hit the = key, the calculator will add the contents of the two registers
together and display the result. There's a little more to it than that—and I'll go into a few
more details down below.

You're probably used to the idea that your computer screen makes letters and numbers using a
tiny grid of dots called 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.

Representing numbers in binary


Humans work on numbers in decimal format (the numbers 0–9) largely, it's believed, because we
have ten fingers and toes to count with. But the numbers we use to write out amounts of things
are arbitrary. Let's say you have a pile of coins and you want to tell me how wealthy you are. You
can point to the pile, I can look at it, and if I see a lot of coins I'll conclude you're rich. But what if
I'm not there to look at the pile? Then you can use a symbol to represent the coins—and that's
what a number is: a symbol that indicates an amount. If there were nineteen coins, you could use
the two symbols "1" and "9" written together: 19. Taken together, that means 1 × 10 plus 9 × 1 =
19. That's how decimal works using a system of 10 symbols. But you could use other symbols
too.

For the last century or so, computers and calculators have been built from a variety of switching
devices that can either be in one position or another. Just like a light-switch, they're either "on"
or "off." For that reason, computers and calculators store and process numbers using what's
called binary code, which uses just two symbols (0 and 1) to represent any number. So in binary
code, the number 19 is written 10011, which means (1 × 16) + (0 × 8) + (0 × 4) + (1 × 2) + (1 × 1)
= 19. The beauty of binary is that you can represent any decimal number with a series of
switches that are either on or off—perfect for a calculator or a computer—like this:

Artwork: How to represent the binary number 19 inside a calculator or a computer using five switches. Three are
pressed down (switched on) and two are left as they are (switched off), indicating the binary number 10011,
which is equal to 19 in decimal.
Converting decimal to binary
The first thing your calculator has to do is convert the decimal numbers you input to binary
numbers it can work with, and it does that using a (fairly) simple circuit called a BCD (binary
coded decimal) encoder. It's simpler than it sounds—and the animation below shows how it
works for the numbers 1–9. There are 10 "input" keys (I've omitted zero) wired to four output
lines. Each input is wired in such a way that it triggers one or more of the outputs, so the
conversion process effectively happens through the pattern of the wiring. For example, key 1
triggers just the line on the right, giving us an output of 0001 in binary, while key 7 triggers three
of the four lines giving us 0111 in binary (4 + 2 + 1).

Animation: How a calculator's BCD encoder converts decimal input from the keyboard into binary output. The
output lines are triggered by OR gates (described below) connected to the input lines, so each output line triggers
if one OR more of the input lines connected to it send a current.

Using logic gates with binary


Let's say you want to do the sum 3 + 2 = 5.

A calculator tackles a problem like this by turning the two numbers into binary, giving 11 (which
is 3 in binary = 1 × 2 + 1 × 1) plus 10 (2 in binary = 1 × 2 + 0 × 1) makes 101 (5 in binary = 1 × 4 +
0 × 2 + 1 × 1). How does the calculator do the actual sum? It uses logic gates to compare the
pattern of switches that are active and come up with a new pattern of switches instead.

A logic gate is really just a simple electrical circuit that compares two numbers (inputs) and
produces a third number (an output) depending on the values of the original numbers. There are
four very common types of logic gates called OR, AND, NOT, and XOR. An OR gate has two
inputs (each of which can be either 0 or 1) and it produces an output of 1 if either of the inputs
(or both) is 1; it produces a zero otherwise. An AND gate also has two inputs, but it produces an
output of 1 only if both inputs are 1. A NOT gate has a single input and reverses it to make an
output. So if you feed it a zero, it produces a 1 (and vice-versa). An XOR gate gives the same
output as an OR gate, but (unlike an OR gate) switches off if both its inputs are one.

Half adders and full adders


Now if you put different logic gates together, you can make more complex circuits called adders.
You feed into these circuits two binary numbers as their input and get out a third, binary number
as your output. The number that comes out is the binary sum of the numbers you put in. So if
you fed in the electrical signals 10 and 11 you would get out 101 (2 + 3 = 5). The basic ingredient
of adder circuits is a pair of logic gates, working in parallel, called a half adder, which can do sums
no more complex than (wait for it!) 1 + 1 = 2. One example of a half adder looks like this:

You feed in two binary numbers you want to add on the two input lines A and B. They "travel"
simultaneously to the inputs of the two logic gates—an XOR gate at the top and an AND gate
underneath. The output from the XOR gate gives the sum of the two inputs, while the output
from the AND gate tells us if we need to carry a 1. It'll be clearer what that means if we consider
four possible calculations a half adder can do:

• If A and B both receive a zero, we're doing the sum 0 + 0 = 0. The XOR gate gives a zero
if both its inputs are zero, and so does the AND gate. So the result of our sum is zero and
the carry is zero.
• If A receives a zero and B receives a one, we're doing the sum 0 + 1 = 1. The XOR gate
gives a one if either one (but not both) of its inputs is a one. The AND gate gives a one
only if both of its inputs are one. So the result of our sum is one and the carry is zero.
• If A receives a one and B receives a zero, it's just the same as the previous example: the
result of our sum is one and the carry is zero.
• Finally, if both A and B receive a one, we're doing the sum 1 + 1 = 2. Now the XOR gate
gives a zero, while the AND gate gives a one. So the sum is zero and the carry is one,
which means the overall result is 10 in binary or 2 in decimal.

Half adders can't really do any more than this, but if we put a few more logic gates together, we
can make what's called a full adder circuit that does harder sums with bigger numbers. How does
an adder work? That's beyond the scope of this introductory article, but you can find a few
examples on the web pages below.

Unless you're doing a degree in electronics or computing, all you really need to know is that an
adder is built from a number of AND, OR, and NOT logic gates contained inside chips that are
connected together. We can use other patterns of logic gates to subtract, multiply (which can
also be done by repeated addition), and do other kinds of calculations.

You might also like