# XOR GATE

 A: C: B:
Truth Table:
 A B C 0 0 0 0 1 1 1 0 1 1 1 0
Click on the A or B labels to change the input values.
Some words on XOR gates
Remember that an XOR gate's output (labeled C) is set to 1 if EITHER inputs (labeled A and B) are set to 1, except when both A and B are 1. In the latter case its output is a 0. So, the XOR gate responds almost exactly like the OR gate, except that it produces a zero output when BOTH inputs are 1. In that case the OR gate produces a 1, but the XOR gate produces a 0.(That's why we call it an "X-OR" gate: it has an eXception to the OR gate. Actually, the X stands for exclusive). In conclusion, the XOR produces a 1 when exactly one of the inputs is 1, in all other case it produces a zero.

The truth table tell us which values we expect on the output of the XOR gate for which values of the inputs A and B. For example, if A=1 and B=0, C will be 1. If A = 0 and B = 0, C will be 0. If A=1 and B=1, C will be 0, etc.

Exercise 1
Clicking on the gate labels A and B (in the diagram above) switches their values. Take a piece of paper and make a three column table. The first column represents input A. The second input B. The third column represents input C.
Try all possible values of input A and B by switching their values on the logic gate above. Write the values of A and B down in the table, in the same row. Record the resulting value of the XOR gate's output C in the third column. Verify that your table matches the one listed above.

Excercise 2
Logic gates implement what we call "Boolean logic". The XOR operation is part of that logic. In Boolean logic, an XOR operation combines two statement into one. The resulting statement is true when both statement are true, and false when either or both statements are false.

Let's look at a situation in which we would need to apply such logic. Imagine an airplane used to teach people how to fly. The airplane has two controls: one for the teacher, one for the student. (I don't know whether such planes actually exist, but it seems a good idea:-)). The plane can be controlled from either controls, so that the teacher can flip a switch and put the plane under the control of the student. From that point on the plane is under the control of the student so he or she can exercise flying the plan, until the teacher toggles the switch and regains control over the plane. Of course, either one of teacher and student must be in control at any given time for the plane not to crash. However, they can not both be in control because there would be obvious conflict. For example, the student could steer to the left, the teacher could steer to the right, etc.
This is a case of XOR logic. Let's say C indicates whether the plane is under control (1=yes, 0=no), and A indicates whether the teacher controls it (1=yes, 0=no), and B indicates whether the student controls the plane (1=yes, 0=no). The plane is under control (C=1) when either the teacher (A=1, B=0) or the student steer it (B=1, A=0), but when neither do (A=0, B=0), or both do (a=1, B=1), it is not under control.
Think of another example in which this situation would occur. Represent the outcome by the label C, and the two conditions by the labels A and C. Determine whether the relation between A, B and C corresponds to the XOR truth table.

Back to the list of logic gates...