Digital Electronics Projects: How to Use Switches to Build Gates - dummies

# Digital Electronics Projects: How to Use Switches to Build Gates

To give you an idea of how basic gates work, these electronics projects show you how to assemble an AND gate, an OR gate, and an XOR gate using simple DPDT knife switches. In actual practice, gate circuits are built with transistors or with integrated circuits. But these three projects will give you a good idea of how gates work.

The following list summarizes these three basic logical operations:

• AND: An AND operation compares two binary values. If both values are 1, the result of the AND operation is 1. If one value is 0 or both of the values are 0, the result is 0.

• OR: An OR operation compares two binary values. If at least one of the values is 1, the result of the OR operation is 1. If both values are 0, the result is 0.

• XOR: An XOR operation compares two binary values. If exactly one of them is 1, the result is 1. If both values are 0 or if both values are 1, the result is 0.

The AND gate is implemented by connecting two switches together in series. Both switches must be closed for the lamp to light.

To implement an OR gate with switches, you simply wire the switches in parallel. Then, the lamp lights if either of the switches is closed.

The XOR gate circuit wiring is a bit trickier. The DPDT switches are cross-connected in such a way that the circuit to the lamp is completed if one of the switches is in the A position and the other is in the B position. If both switches are in the same position, the circuit is not completed so the lamp does not light.