Truth tables are helpful for working out exactly how your NAND gate will perform in a circuit. Working under the Boolean function, they help you to figure out what the output will be as a result of multiple inputs.
In these tables, binary inputs and outputs are used. This means when the input is true (a signal is high or a switch is turned on) this is noted as a 1 and when the input is false (a signal is low or a switch is turned off) a 0 is used.
For NAND gates, the logic is that the output is 1 (or true) when all of the inputs are 0 (or false). In all other cases, the output is 0 (or false).
As such, the truth table logic for a NAND gate works like this:
Input A
| Input B
| Output
|
---|
0
| 0
| 1
|
1
| 0
| 1
|
0
| 1
| 1
|
1
| 1
| 0
|
As circuits get more complex and extra inputs are added, these truth tables can grow accordingly. For example, a four-input NAND gate truth table will be expressed like this:
Input A
| Input B
| Input C
| Input D
| Output
|
---|
0
| 0
| 0
| 0
| 1
|
0
| 0
| 0
| 1
| 1
|
0
| 0
| 1
| 0
| 1
|
0
| 0
| 1
| 1
| 1
|
0
| 1
| 0
| 0
| 1
|
0
| 1
| 0
| 1
| 1
|
0
| 1
| 1
| 0
| 1
|
0
| 1
| 1
| 1
| 1
|
1
| 0
| 0
| 0
| 1
|
1
| 0
| 0
| 1
| 1
|
1
| 0
| 1
| 0
| 1
|
1
| 0
| 1
| 1
| 1
|
1
| 1
| 0
| 0
| 1
|
1
| 1
| 0
| 1
| 1
|
1
| 1
| 1
| 0
| 1
|
1
| 1
| 1
| 1
| 0
|
When building a circuit using NAND gates, having a truth table with the correct number of inputs can help you work out exactly how the signal flow will work, ensuring you put the gates in the right place to reach the desired output.