# Introduction to Digital Logic Gates

concept

Logic gates are discrete devices like resistors, capacitors and inductors that are designed to perform operations with digital signals.
The logic gates we'll be covering in this topic are the inverter (or NOT gate), the OR gate and the AND gate.
With each of these gates you apply 1 or more input signals and the gate, using some logic rules, creates an output signal of either a 1 or a 0.
These logic gates are the building blocks of digital electronics.

The first logic gate we'll cover is the inverter (also called the NOT gate). This is the simplest logic gate there is. You apply a single signal as the input and you get an output which is the opposite of your input.

fact

The inverter gate (NOT gate) outputs the opposite of whatever you give it. So if you give it a 1 it'll output a 0 and if you give it a 0 it'll output a 1.

fact

The circuit symbol for the NOT gate is:
The input is on the left and the output is on the right.

The small circle on the output is the universal logic symbol for "NOT", if you see it on any other diagrams it implies that there is some kind of inversion happening in the gate.

When talking about logic operations we use a table to describe how the inputs relate to the outputs.

fact

The logic table for the NOT gate is:

Input | Output |
---|---|

0 | 1 |

1 | 0 |

So whenever you apply a 1 the NOT gate gives you a 0. And when you apply a 0 the NOT gate gives you a 1.
All logic gates have an external power supply that isn't shown on circuit diagrams, otherwise the NOT gate couldn't generate a 1 when you apply no voltage to it.
Below is an interactive example of a NOT gate, click the input to change its value and see how the output responds.
A dark green is a 0 (off) and a light green is a 1 (on).

example

The next gate we'll cover is the OR gate, this gate takes two inputs rather than the NOT gate's one input.

fact

The symbol for the OR gate is:
Its two inputs are on the left and the output is on the right.

fact

The output of the OR gate is 1 if either of the inputs are 1 and 0 if both of its inputs are 0

fact

The logic table for the OR gate is:

A | B | Output |
---|---|---|

0 | 0 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 1 |

Below is an interactive example of an OR gate, click the inputs to toggle their values and see the output update.
Light green is a 1 and dark green is a 0.

example

The final logic gate we're covering in this topic is the AND gate.

fact

The symbol for the AND gate is:

fact

The AND gate's output is a 1 when BOTH of its inputs are 1 and a 0 otherwise.

The AND gate is similar to binary multiplication of two bits, if either of the bits are a zero then the result will be a zero.

fact

The logic table for the AND gate is:

A | B | Output |
---|---|---|

0 | 0 | 0 |

0 | 1 | 0 |

1 | 0 | 0 |

1 | 1 | 1 |

Below is an interactive example of an AND gate, click the inputs to toggle their values and see the corresponding output.

example

practice problems