As I understand it, latches are made from OR gates, but I am trying to understand the basis for how they work and came across this video https://www.youtube.com/watch?v=KM0DdEaY5sY. When you make simply one OR gate with two inputs, A and B, except that the input B is the feedback output, you get a latch that doesn't reset. At around 3:00, he demonstrates that when you turn the button on, it stays on forever and that you can only reset it by creating an open circuit. But, why does the output stay high forever just because the input was high one time?


Try an analogy. You are in a room. You have a rule that you follow and a switch and a red light and a green light and a white light.

The Analogy

There are two switches outside the room that control the red and green lights. Whenever you see either the red light or the green light on, you flip the switch on, which turns the white light on. If both the red and green lights are off, you flip the switch off, and the white light turns off.

enter image description here

That's how the OR gate works.

Now let's put another person in the room beside you. She has a white light that turns on and off with yours. Her job is to flip the switch on if she sees the white light on and off if she sees the white light off. Her switch turns your red light on. The green light is controlled by someone else.

That's the feedback.

enter image description here

Now if both red and green are off, you don't turn the white light on and nothing happens.

Then the dude controlling the green light turns his switch on for some reason. You see the green light and flip your switch on. A bit later the person controlling the red light sees the white light that came on as a result of your action and flips her switch on, and the red light also comes on.

In your room you see the green light and the red light, so you keep your switch closed. The dude controlling the green light decides to turn his off. So you're left with just the red light, so you still have to keep the white light on. The person controlling the red light still sees your white light, so she never turns her switch off.

And we're stuck here forever until the rules change.


Note that there are reaction times involved here- if the green light flickers on only briefly it's possible it could get missed and then you'd never flick the switch. Or maybe you get to flick the switch and the white light goes on briefly, but the green light goes off and you flick it back before your neighbor gets a chance to react, so the latch never catches.

Electronic Reality

Inside a typical 4000-series CMOS OR gate the transistors are arranged like this:

enter image description here

(it's implemented as an inverter on each input, followed by a NAND gate (with two cascaded inverters afterward). You can see the NAND in the middle- two n-channel transistor in series (both inputs have to be high for the output to be low) and two p-channel transistors in parallel (if either input is low the output is high).

As you probably know \$A+B = \overline{\overline{A} \cdot \overline{B}}\$, it implements an OR gate.


Because an OR gate's output is high if either input is high. If you tie the output to one of the inputs, once the output is high (for any reason), it can never go low again. It doesn't matter what the other input does after that.

It's pretty much the simplest example of positive feedback in a Boolean system.

  • \$\begingroup\$ this is an incorrect assumption ...latches are made from OR gates \$\endgroup\$ – jsotola Dec 15 '17 at 1:08
  • \$\begingroup\$ why does the output stay high forever just because the input was high one time ... there are two inputs that go high \$\endgroup\$ – jsotola Dec 15 '17 at 1:09
  • \$\begingroup\$ Okay, but what's the actual mechanism by which it's staying at 1? All you did was reiterate what the video stated which didn't really solve anything. \$\endgroup\$ – John Joe Dec 15 '17 at 2:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.