Binary
Most of us use digital machines like calculators and computers almost every day. But very few of us understand the basics about how they work. The binary system is what computing devices use at the most basic level to represent and store data.
The base 10 number system is what most people use. Using the numbers 0 through 9 we can write down any number imaginable. Our numbering system is probably base 10 because we have 10 fingers to count on.
The binary system is base 2 using only two symbols, a zero (0) and a one (1). Why do you think that is? One of the simplest electrical circuits is a switch, representing on and off, yes and no, empty and full, and of course 1 and 0.
Computers use switches like fingers to count on, passing around electrical signals in binary code.
How does this strange binary system work? Binary works with powers of two, marking them either one meaning on or zero meaning off. Here is the number one. Notice that the light representing 1 is on. That means there is one 1.
Let’s try the decimal number 25. Using the decimal number system 25 would be described as two 10’s and five 1’s.
25 in binary would look like this; A 16, an 8, no 4’s, no 2’s, and a 1. 16+8+1=25.
This binary system sounds pretty complicated compared to the one we are all used to but computers are so fast they can handle it with no sweat.
All the data your computer uses is stored in binary at the most basic level. Sure, it may look like all files and folders and desktop patterns, but way down deep it is just a bunch of on’s and off’s. The keys you type, the movements of your mouse, even the sound of a voice in a computer video are all represented by binary code.
BooleanLogic
We have examined the way in which 0s and 1s can be used to represent values in a computer. The next thing we need to talk about is the manner in which we can use 0s and 1s, together with simple operators, to accomplish various computing tasks. It is useful to think of the value 1 as "TRUE", and the value 0 as "FALSE". Used in this way the 0s and 1s are called Boolean values (after the mathematician George Boole).
AND, OR, and NOT
The fundamental elements are "AND", "OR", and "NOT". They're not just words! The key to correctly following instructions is to understand the use of these operators. Note that the operators can be put together to form more complex expressions: "8 items OR less, AND NOT a check OR credit card".
Rollercoaster example: a person can ride if they: "are wearing shoes AND have a strong stomach." This condition for riding can be enforced using an AND gate at the entrance to the rollercoaster! The inputs to the AND gate are determined by the two conditions. If you are wearing shoes, then the first input is a 1; otherwise it's 0. If you have a strong stomach the input is a 1; otherwise it's a 0. The output of the AND gate is 1 if you are allowed to ride; 0 otherwise.
Notice that the meaning of a sentence can be changed depending on where you put the parentheses. Demonstrate this: You can ride the roller coaster if you are NOT under 12 yrs old AND under 48" tall. What does this mean? There are two interpretations: the condition "NOT (under 12 yrs old AND under 48" tall)" is satisfied by a 49" 11-year old, or a 47" 13-year old, whereas the condition "(NOT under 12 yrs old) AND (under 48" tall)" is only satisfied by short (under 48") people who are at least 12 years old.
The behavior of the AND, OR, and NOT operators can be modeled using mechanical devices. We usually refer to such devices as "gates". The AND and OR gates receive two inputs and create one output, and the NOT gate receives one input and produces one output. The gates are designed to operate on binary values. These values can be thought of as 1s and 0s, Trues and Falses, Ons and Offs, or Ups and Downs.
If both inputs to the AND gate are 1s, the output is a 1, otherwise the output is a 0. If 1 or more inputs to the OR gate are 1s, the output is 1, otherwise the output is 0. (Another way of saying this is that the OR gate outputs a 0 if both inputs are 0, and outputs a 1 otherwise.) Finally, if the input to the NOT gate is 0 then the output is 1, otherwise the output is 0. It is worthwhile to mention the "exclusive or" or the XOR gate. The XOR gate outputs 1 if exactly one of its inputs is 1, otherwise it outputs 0. Put another way: XOR outputs 1 only when the inputs are different.
In a computer, the AND, OR, and NOT gates are electronic circuits. One or two input lines will have voltages of either "high" or "low", corresponding to 1 or 0, (true or false); the circuit is then configured so that the voltage on the output line is "high" or "low" as desired. For example, if the two input voltages to an AND gate are both "high", then the voltage on its output line will be "high". Example 2: If at least 1 of the input line voltages to an OR gate is "high", then the output line's voltage will be "high".
Gates
These diagrams describe the behavior of not, and, or, and xor gates on all possible inputs. The inputs to the gates are on the top, and the output is on the bottom. Notice that all the gates take two inputs except not, which takes only one.
A / Q
0 / 1
1 / 0
/
This is the truth table for the NOT gate
1. Write the truth table for the AND gate.
2. Write the truth table for the OR gate
3. Write the truth table for the XOR gate.
SIMPLE BOOLEAN CIRCUIT of a car buzzer. Test the buzzer by writing input values, and having them flow through the gates, writing the correct output value on the wiring coming out of each gate. These in turn become input values to later gates, and so on, until the values have propagated to the final output.