Wednesday, October 12, 2011

RS NOR Latch: An Intro to Latches

I'll just be covering one latch in this post, and the next post should be a demonstration of one possible use for a RS NOR latch.

A latch or a flip-flop is a redstone circuit that effectively carries a single bit of memory - that is, it can hold an "on" or "off" state and hold it, instead of relying only on input at the moment it's given.
Latches typically have two inputs, one "reset" input and one "set" input - that is, one R and one S input.
Flip-flops add more complicated logic to a latch in order to change the way it behaves. I'll go into them at a later time.

All of these circuits are, at their core, built around the RS NOR Latch:
In this image, the top left lever is the "set" or S input, and the bottom right lever is the "reset" or R input. The top output - on the blue block - is the inverse output, and the green output is the uninverted output.
(Just for the record, you may not want to use levers - because they can both be set to "on" at the same time, they can cause some issues. Something like a button will work with less chance of error.)
In the state pictured, you can sit there pulling the R lever as much as you like and nothing will happen, the inverse output will stay on, and the uninverted output will stay off.
Flick the S lever on and then off, though, and the opposite is true - the uninverted output will remain on, and the inverted input will be off, no matter how many times you pull the S lever (or push the S button, walk over the pressure pad, whatever input you use...)
(This is why I really should've used buttons, by the way - if you pull the S lever and leave it on, then pull the R lever, it will mess the whole thing up. I used them mostly so that they're visible, but keep this in mind if you use this circuit!)

So there you go - this is the simplest latch. There's a variety of designs for it, as there are with most of the circuits we've covered so far, but for the moment I'll be sticking with this for the sake of consistency.
You can also have an RS NAND Latch, which would just be an RS NOR latch with inverters applied to the inputs and outputs.

No comments:

Post a Comment