=====Introduction to Gates===== Gates are circuit components that act as operators on circuits. A single wire can only hold the values of ''on'' or ''off'', which is interpreted as ''1'' or ''0'' respectively. Because of this, basic gates can only perform the operations of ''AND'', ''OR'', and ''NOT''. ((Chapter 4.1)) Each simple gate is explained below. Comparisons are made to the C programming language because of how common it is. (You don't need to know C for this class and we will not be using it.) ====AND==== In the C programming language, the ''AND'' operator is ''&&''. This operation's output is a ''1'' if and only if both of the inputs are also ''1''. Below is a truth table showing the operation of this gate. The circuit symbol follows. ^ Inputs ^^ Output ^ ^ A ^ B ^ F ^ | 0 | 0 | 0 | | 0 | 1 | 0 | | 1 | 0 | 0 | | 1 | 1 | 1 | {{ :tutorials:gates_intro:and.png?nolink |}} This operation is handwritten using multiplication syntax. ''AB'' and ''A•B'' can be used, though the first is more common. When large groups of inputs are being used, simply chain them together like so: ''ABCD'' or use parentheses ''A(BCD)'' ====OR==== In the C programming language, the ''OR'' operator is ''||''. This operation's output is a ''1'' if any of the inputs are a ''1''. Below is a truth table showing the operation of this gate. The circuit symbol follows. ^ Inputs ^^ Output ^ ^ A ^ B ^ F ^ | 0 | 0 | 0 | | 0 | 1 | 1 | | 1 | 0 | 1 | | 1 | 1 | 1 | {{ :tutorials:gates_intro:or.png?nolink |}} This operation is handwritten using addition syntax, ''A+B''. The ''AND'' operation takes precedence over this operator, just like multiplication in normal Algebra. ''A+AB'' results in ''A+(AB)'', with the ''AND'' operation occurring first. ====NOT==== In the C programming language, the ''NOT'' operator is ''!''. This operator only has one input. It's output is the inverse of whatever its input is. This is commonly called an **Inverter**. Below is a truth table showing the operation of this gate. The circuit symbol follows. ^ Input ^ Output ^ ^ A ^ F ^ | 0 | 1 | | 1 | 0 | {{ :tutorials:gates_intro:not.png?nolink |}} This operation can be handwritten in multiple ways. A' and A are both common and easy to read. ''NOT'' takes precedence over ''AND''. \\ Example: AB' evaluates to A(B'). If both A and B are inverted, the syntax is A'B'. If the whole operation is to be inverted the syntax is (AB)'.