HPlogo Understanding Your System: HP 3000 Series 9X8LX Computer Systems > Chapter 6 Behind the Scenes

Why Numbers?

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Computers do not truly understand words or letters the way we do. They understand only numbers. Everything that a computer can work with is represented inside the computer as a number.

To work with letters, computers assign numbers (codes) to each letter--in fact, to each key on the keyboard. When you press A on your keyboard, the keyboard electronically sends a number code to the computer. By examining the code number that it receives, the computer determines that it must display the character "A" on your screen.

TIP: The function keys on your keyboard, labeled F1, F2, F3,..., are a special case.

Programs such as HP Easytime/iX store instructions in these keys. When they appear at the bottom of your screen, the function key labels tell you what function, if any, each key performs.

Because different programs can store different kinds of software instructions in these function keys, they are sometimes called soft keys.

When you type words, the computer looks at each number key code that it receives, determines what to display, and obligingly strings together the characters that you typed.

TIP: In general, what we regard as a word--a collection of letters strung together in a particular order that has meaning to us--has no intrinsic meaning to the computer. However, certain combinations of letters and numbers do have meaning for the computer--but only because a programming engineer has instructed the computer to behave that way.

"CAT" means something in the English language: a small, furry, four-legged feline that behaves in ways that we have come to recognize. To the computer, however, it is simply the characters C, A, and T bound together in what is known as a string.

When you enter HELLO at the logon prompt, that entry does have meaning for the computer, but it has meaning only because a programming engineer has instructed the computer to recognize this string of characters. Because it recognizes HELLO as a command, the computer takes action some action--it starts a session.

Computers are electronic machines, and the fundamental language of electronics is simple. The current is either On or it is Off.

TIP: Imagine that you had to talk to another person and your only way of communicating was to turn a light on, or turn a light off. What would you do?

Computers face the same problem.

You might decide to say very little, of course, or you might decide to create a code based solely on these two primitive messages:

  • The light is on.

  • The light is off.

Turning the light on might stand for "Yes." Turning it off might stand for "No." That leaves very little to say.

The inventor Samuel Morse faced the same sort of problem in trying to communicate with a telegraph. His solution was the Morse Code, a sequence of long and short pulses on the telegraph key. (There is an international telegraph code, too.) Each letter of the alphabet is assigned a sequence of long and short pulses. Computers do something very similar.

In computers, the solution has been to designate the number 1 to represent "On," and 0 (zero) to represent "Off."

The entire "alphabet" of electronic computers consists of two digits, 1 and 0. This limited "alphabet" has advantages for the computer and some obvious disadvantages for human beings.

The advantage for computers is that counting from 0 to 1 at the speed of electricity goes very fast. The disadvantage for us is that with an "alphabet" of only two digits, there is not much that you can say, and counting looks hopeless.

Arithmetic for humans became far easier with the invention of the decimal system of notation (the digits 1 to 9, plus a dot to represent zero), which we owe to the ancient Sanskrit mathematicians. Arabic mathematicians invented the zero and used the dot to separate the whole number from any fractional part: 11.1 is one ten and one one plus one-tenth of one.

Reading from right to left, 2013 is three ones, plus one ten, plus no hundreds, plus two thousands. There are only ten digits to work with (0 to 9), but the position of each digit tells you the magnitude (size) of the number that it represents. As you move from right to left, each place represents a magnitude (size) 10 times its neighbor to the right.

Binary notation

Binary notation has only two digits, 0 and 1. That makes it ideal for computers. Using binary notation, computers can count very nicely--although it still looks a little odd to most of us. Binary comes from "bi," meaning "two."

With binary notation, moving from right to left signifies a magnitude (size) 2 times its neighbor to the right.

BinaryMeaningDecimal Equivalent
1 one one1
10no ones, plus one two2
1011one one, plus one two, plus no fours, plus one eight11
101010The leftmost digit represents one 32.42

TIP: Addition appears strange, but that is that you must work with twos instead of tens:
   Binary    Decimal     Binary    Decimal



      101    5           101010    42

   +   11    3        +    1011    11

   ------   --           ------    --

     1000    8           110101    53

Each digit, 1 or 0, (On or Off) is called a bit. The largest number that a computer can count depends on how many ones and zeros that it can examine at one time.

Older personal computers, for instance, might examine only eight bits at a time: 11111111 is the largest counting number that they can manage. A grouping of eight bits is called a byte. More powerful computers can examine 16 bits (two bytes) at a time. Others can examine 32 bits (4 bytes).

What about numbers such as 387.435? Computers work with fractional numbers, too. However, the method of representing such numbers inside the computer is genuinely complex.

TIP: The search for greater computer power is largely a search for ways of allowing computers to handle larger and larger numbers of bits (or bytes) in one "gulp"--hence, the rush to develop computer "chips" that can accommodate more and more bytes. (To be sure, other factors are involved, such as the speed at which each "gulp" of information moves.)

ASCII code

If you feel that binary code is awkward for human beings, you are not alone.

The solution that makes computers workable for us is the ASCII code (American Standard Code for Information Interchange). It is not the only code for computers, but it is in wide use. Your MPE/iX computer uses the ASCII code.

Like Morse code, ASCII code assigns to each letter--not a sequence of longs and shorts--but a sequence of bits (zeros and ones). Every key on your keyboard (every letter, every number, every symbol) is assigned an ASCII code. So is Return and every other key. Shift modifies the code sent by many keys.

The Return key, for example, does double duty. Its code tells the computer to interpret whatever you have typed. It also tells the computer to end one line and move to a new line and wait for something new, much the way Return does on an electric typewriter.

The binary code for A is 1000001, and it is numerically the same as 65 in decimal notation. The first 64 codes represent digits (0 through 9), the special symbols on the keyboard (! and # and & and so on), and special codes that are meaningful only to the computer.

All of the letters of the alphabet in English and most in European languages can be represented in a single eight-bit byte. There are enough different possible combinations of zeros and ones in an eight-bit byte (256 in fact) to accommodate all the letters and numbers in those languages, plus the special symbols and control keys. Oriental languages--and many Middle Eastern languages--require at least two eight-bit bytes to represent their written characters.

Control and Escape

Ctrl, Esc Altare special keys that appear on some keyboards. They send special codes to the computer. When you press one of these keys, it alerts the computer that something out of the ordinary is expected.

  • CtrlS tells the computer to stop words on the screen from scrolling upward.

  • CtrlQ tells the computer to resume scrolling.

  • Esc permits you to enter special coding sequences into whatever you are typing. Embedding coding sequences into anything that you write is an advanced use of the computer. Avoid doing this unless you know what the results will be.

  • CtrlA permits someone using the console to respond to requests from others who are using the computer. It has other functions, too.

  • CtrlB permits someone using the console to perform a soft or hard reset of the computer. Do not use CtrlB unless you are thoroughly familiar with the consequences of soft and hard resets. Misuse of either function can have serious consequences for other users. You will find information on resets in &using;.

Letters and numbers

When you enter AReturn on your keyboard, the computer will know that you mean the symbol A. If you are entering text into a document, you can be certain that the computer will faithfully represent the letters of the alphabet precisely as you intend to use them.

Numbers, however, are different. They present the computer with the need to make a decision.

The number keys 0, 1, 2,..., 9 send their own codes to the computer. But pressing 3 could mean that you intend to do arithmetic using the number 3, or it could mean that simply want the character 3 (a shape on the screen) to appear in your letter. The ASCII code sent by 3 is 51.

Within the computer, ASCII code 51 is associated with the character (a shape) that looks like 3. That sounds awkward.

Left to itself, the computer has no way of deciding precisely what you intended by pressing 3.

In fact, the computer does not make the decision. It leaves the decision to the program or the command that you are using when you press 3. The program or command that you are using is "aware" of the context in which you are entering characters. A text editing program such as EDIT/3000 will conclude that you mean the character (shape) 3. An accounting program, however, will conclude that you mean the number 3 and that some arithmetic operation is intended.

Files: ASCII or binary?

When you hear or read that something is in ASCII code, you will know that what is recorded is letters or words or symbols that you can read, just as you would read any printed document.

When you hear or read that something is in binary code, you will know that what is recorded is collections of ones and zeros. You cannot read binary files as you would a document.

TIP: To say that a text file is recorded in ASCII form is a convenient way of thinking about text files. It is easier to imagine letters and words being recorded just as you type them at the keyboard. In truth, all files are recorded in binary form.

When you create a text file, the computer records this fact for its own reference.

When you use a program or a command to examine a text file, the computer recognizes from its own records that the file was intended for reading by people and performs a quick interpretation of the data that it finds in order to display the letters and words that you wrote.

Feedback to webmaster