The Binary Number System converted by: Unreal All digital computers are basically collections of switches. Each switch has two possible positions: open, "0", or off; and closed, "1", or on. The two positions form the basis of the binary (or two-valued: 0, 1) number system. Otherwise, the computer uses numbers as we do in familiar decimal system. -= Binary Numbers =----------------------------------------------------------- Any number can be represented in binary as well as in decimal form. For example, the number 1,985 expressed in binary form is 11111000001. As is the case with decimal numbers, we can interpret a binary number as the sum of a series of powers of the base number. For example, in decimal notation: (p = to the power of) 1,985 = 1 x 10p3 + 9 x 10p2 + 8 x 10p1 + 5 x 10p0 that is, 1,985 = 1 x 1,000 + 9 x 100 + 8 x 10 + 5 x 1 Similarly, in binary notation: 11111000001 = 1 x2p10 + 1 x 2p9 + 1 x 2p8 + 1 x 2p7 + 1 x 2p6 + 0 x 2p5 + 0 x 2p4 + 0 x 2p3 + 0 x 2p2 + 0 x 2p1 + 1 x 2p0 or, in decimal notation: 11111000001 = 1 x 1,024 + 1 x 512 + 1 x 256 + 1 x 128 + 1 + 64 + 0 x 32 + 0 x 16 + 0 x 8 + 0 x 2 + 1 x 1 Numbers can be used to represent nonnumerical quantities, such as letters of the alphabet and punctuation marks. A standard code is often used to assign specific patterns of binary numbers to printable characters. -= Logic Circuits =----------------------------------------------------------- Binary numbers can also be used to represent the results of logical operations. For example, if 1 represents TRUE and 0 represents FALSE, we can represent all logical functions (except "maybe") by sequences of binary numbers. We can then arrange the circuits of a computer to make logical tests on statements given to the machine. These logic circuits enable the CPU (central processor unit) to react to an incoming instruction or piece of data. For example, an important feature of the computer (and of the human mind) is the ability to decide between two alternatives. Suppose the computer must decide who in a group of people are at least 21 years of age. The computer examines the item of data labeled "age" for each member of the group. Each time it examines the age, a logic circuit in the CPU compares the binary number for the age with the binary number for 21. If the age number is equal to or greater than 21, the circuit produces a 1, for TRUE. If the age number is less than 21, the circuit produces a 0. The type of circuit used for logical comparisons is called a gate because the circuit acts to pass on 1's, like a gate in a fence, only for the logical conditions for which it is set. there are two basic kinds of gate: AND and OR, representing the two basic kinds of logical decision to be made. In the simplest form, each gate has two inputs and one output. An AND gate produces a 1 at its output only if both of its inputs are also 1. An OR gate produces a 1 at its output if either or both of its inputs are 1's. A third kind of gate, called an XOR gate (exclusive OR), produces a 1 at its output only if one input but not the other is a 1. In other words, and AND gate produces 0's unless both inputs are 1's; an OR gate ; produces 0's only if both inputs are 0; an XOR gate demands one of each. To see how this works, suppose a computer is in charge of a baking a roast in a microwave oven. The owner of the oven programs it to stop cooking the roast when either the preset time has elapsed or the thermometer in the roast reads 140 degrees F. The logic gate used by the computer in the oven for this task is an OR gate. At the start of the cooking process, neither the timer output nor the thermometer output satisfies the conditions set in the oven (timer output greater than or equal to 140). Therefore , the OR gate will produce a 0 at its output, since both inputs are 0. At some point one or both of the conditions will be met and the OR gate will produce a 1. thereby shutting down the oven. Now suppose the chef, knowing it is possible to get thermometer reading that is too high if the thermometer is touching the bone in the roast, sets the oven to stop cooking when the thermometer has at least reached a certain point and the proper cooking time has elapsed. The difference between this and the previous situation is that an AND gate is used in the microwave computer; the gate produces the required 1 only when both the temperature has reached 140 degrees F. and the roast has cooked for 30 minutes. All the complex logical operations of much more sophisticated computers can be reduced to combinations of logic-gate operations much like those described. ______________________________________________________________________________ Logic Gate Illustration: * A * A * B ÚÄÄÄ¿ ÚÄÄÄÙ *ÄÄÄ¿ ÚÄÄÄ¿ ÚÄÄÄÄÙ *ÄÄÄÙ *ÄÄÄij ³ <- Bell ÚÄÄÄÄij * B ³ÄÄij ³ ³ ÀÄÄÄÙ ³ ÀÄÄÄÙ *ÄÄÄÙ ÀÄÄÄÙ ÄÅÄ ³ ÄÅÄ ³ ÚÄÄÄ¿ <- Battery ³ ÚÄÁÄ¿ ³ ÀÄÄÄÙ ³ ÀÄÄÄÙ ³ ÄÅÄ ³ ÄÅÄ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ (a) ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ (b) A A B ÚÄÄÄ¿ ÚÄÄÄÄÄÄÄ*ÄÄÄ¿ ÚÄÄÄ¿ ÚÄÄÄÄÄÄÄÄ*ÄÄÄÄÄÄÄ*ÄÄÄij ³ ÚÄÄÄÄij B ³ÄÄij ³ ³ ÀÄÄÄÙ ³ ÀÄÄÄÄÄÄÄ*ÄÄÄÙ ÀÄÄÄÙ ÄÅÄ ³ ÄÅÄ ³ ÚÄÄÄ¿ ³ ÚÄÁÄ¿ ³ ÀÄÄÄÙ ³ ÀÄÄÄÙ ³ ÄÅÄ ³ ÄÅÄ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ (c) ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ (d) Logic Gates can be though of as doorbell circuits: (a) an AND gate, where the two switches A and B are connected in series and both must be close to the ring bell; (b) an OR gate, where the two switches are connected in parallel and either must be closed to ring the bell; (c) a NAND (not AND) gate, where both switches must be open for the bell to ring; (d) a NOR (Not OR) gate, where either switch must be open for the bell to ring.