"But how does that switch change from open to closed?"
Tim, the only physical switch that is needed is the one on the power supply. Once a voltage is delivered to the system, it gets initialized to a known state and proceeds from there. Computers are almost like fractals, you keep finding the same structures and functions as you zoom in.
In this case, we start with basic transistors. Before anyone else jumps in, this is really simplified, I am assuming the transistors are used linearly and am ignoring the resistors and other components that would be used in a real circuit.
Voltage (and current), flows from the emitter to the drain. The gate controls that voltage. Depending on the transistor type, it either works as an inverter, i.e. the voltage on the drain is opposite that of the gate, or a buffer, the voltage at the drain matches the voltage at the gate, only it has more current (usually).
Now just inverters or buffers aren't all that useful, you need to have multiple inputs to make them really interesting. So the transistors are combined to form AND, OR and exclusive OR gates (XOR). An AND gate requires all the inputs to be high for the output to be high, an OR gate needs one or more inputs to be high, and an XOR needs one or the other input to be high, but not both. And then these gates are combined to form more complex structures like flip-flops, counters, adders, multiplexers, etc. |