Pages

Saturday, February 2, 2019

I Also Made a Flip Flop

So, yesterday I made a multiplexer and today I made a flip flop (not the shoe kind). But before showing you the flip flop, here's a bit more knowledge about logic gates and digital electronics.

You might have heard that computers process information using transistors. Transistors are switches which get switched using electricity. For example, a simple use for a transistor could be to use a very small amount of electricity to switch on and off a larger amount.
You can do a lot with a single transistor, but sometimes, when you need to do something more complex (like run a computer), you will need to combine transistors into units called logic gates. logic gates are useful ways for computers to decide what to do. They have different output signals depending on the type of gate and the input signals.

There are six primary types of gates: NOT (or inverter), AND, NAND (not-and), OR, NOR (not-or), X-OR and X-NOR.

  • NOT gates invert the signal coming in to them, so if the input is High (electrified), than the output will be Low, and vice versa. 
  • AND gates output Low unless both inputs are High, and OR gates output High if any or all of the inputs are High. 
  • NAND and NOR gates stand for NOT-AND and NOT-OR respectively, and they are basically AND and OR gates with inverters attached to the outputs.
  • X-OR stands for exclusive-OR, which means the output is only High if one, but not both inputs are High. X-NOR gates are basically X-OR gates with an inverter attached to the output.


That might seem a little confusing to read all at once like that. Luckily, we have something called a truth table which shows what the output of the gate will be depending on the inputs. To the right are the truth tables and schematic symbols for all the gates I've mentioned, as well as a buffer, which just continues the signal from the input into the output.

These are simple gates, but more complex gates can be created with these, like three-input AND gates for example, which can created with two ordinary AND gates.

Picture from http://www.nutsvolts.com/magazine/article/understanding_digital_buffer_gate_and_ic_circuits_part_1










Now, about my flip-flop. A flip flop is a device made out of four NAND gates and one NOT gate (Well, mine is at least, they can be more simple or complex). A flip-flop basically is memory; it stores information and passes it on. They don't store very much information, though; one flip-flop can store one bit of information, which can either be High or Low, or, in binary, 1 or 0. To put that in perspective, modern laptops often have four gigabytes of memory. That's 32,000,000,000 bits, which really makes you appreciate what it takes to make a computer.

I set mine up with two buttons and to LEDs. One button controls the input, and one is the "clock" which advances whatever the input is into the LEDs, which light up depending on whether the input was High or Low. There is a video which might help clarify if you found that bit hard to understand.

Since it might be hard to tell what's going on in that picture, Here's a diagram which will be easier to understand, should you want to recreate this yourself: (yes, it is the same circuit, I promise)
From https://electronicsforu.com/resources/learn-electronics/flip-flop-rs-jk-t-d

Now, I just built this flip-flop for fun, because I just recently started having success with complicated circuits and wanted to try something interesting using gates. It's very satisfying to building something like this and have it work, but unfortunately it's usually not very practical. If you just want a flip-flop, it's much easier to use gates contained in a chip instead of making your own out of transistors, and even easier to get something like an Arduino Uno, which you can program to do whatever you want.

But that's not the point. I enjoyed myself and learned more about electronics, which is all that matters.


If you would like to learn more about logic gates, Academo's logic gate simulator is a simple simulation that allows you to create and connect logic gates and see what happens: https://academo.org/demos/logic-gate-simulator/

No comments:

Post a Comment