I love logic gates. They are what all digital electronics are based upon. You can make really awesome stuff with it!

I was first introduced to logic gates when I was around 14 years old. I heard that computers consisted on ones and zeroes. But I didn’t understand what that really meant.

So I asked my father to explain it. And I loved his explanation, because it was so simple and easy to understand.

## Ones and Zeroes

You may have heard that computers are really just 1’s and 0’s. But what does that mean?

It’s actually very simple. A “1” is represented by a wire with current flowing in it, a “0” is a wire with no current.

Sometimes 1’s and 0’s are called “high” and “low”.

By using the binary number system, we can make sense of these numbers.

## Basic Logic Gates: AND, OR, INVERTER

Logic gates (or ports) are components that we use for “doing stuff” with the 1’s and 0’s.

For example an AND-gate is a gate that checks if both its inputs (a AND b) are 1. If they are, the output is 1. Otherwise it’s 0.

AND gate | ||
---|---|---|

A | B | A AND B |

0 | 0 | 0 |

0 | 1 | 0 |

1 | 0 | 0 |

1 | 1 | 1 |

An OR-gate is a gate that checks if either one of its inputs (a OR b) is 1. If one or more of them are, the output is 1. Otherwise the output is 0.

OR gate | ||
---|---|---|

A | B | A OR B |

0 | 0 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 1 |

An inverter is a really simple component that inverts the input. If the input is 1, the output is 0. And vice versa.

## More Logic Gates: NAND, NOR, XOR

The AND and OR gate described above can be turned into NAND and NOR gates by putting an inverter at the output of the gates. Now they will give the opposite result.

NAND gate | ||
---|---|---|

A | B | A NAND B |

0 | 0 | 1 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 0 |

NOR gate | ||
---|---|---|

A | B | A NOR B |

0 | 0 | 1 |

0 | 1 | 0 |

1 | 0 | 0 |

1 | 1 | 0 |

In addition to these gates, there is one more. The XOR. Which stands for the Exclusive OR. This gate will only give out 1 if one and only one input is 1. Otherwise it will return 0.

XOR gate | ||
---|---|---|

A | B | A XOR B |

0 | 0 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 0 |

## Combining Gates

By combining gates, you can start to construct some really cool things. You can add numbers by using adders or you can create memory with flip-flops.

Flip-flops are the fundamental building blocks of almost everything in digital electronics.

S. R. Das says

More explanation required in this manne

Arnav Mahajan says

You should explain with the use of some transistor including circuit diagrams and some real circuits including videos.

admin says

Yep, will update this soon.

Dave says

I’ve heard the terms of true and false being used to describe the state of something. Can you please elaborate on this at all? Thanks