Digital Logic Tutorial

RS Flip Flop

What can be done with NAND gates? We can learn and we can teach computers to learn. To learn we need memory. The smallest bit of memory stores a single binary digit, called a "BIT", and it can only learn a single thing: It can learn on or off and not forget when we stop teaching it. This next circuit is one type of a memory bit, called an "RS Flip Flop". The name comes from Reset and Set (which are the two input wires) and Flip Flop which sort of says what it does. Like a card on a table, it can flip or flop one way or the other, but which ever way it lands, it will stay that way.

If you can't see the simulation below, try this HTML version of the Falstad simulator: RS FlipFlop (Thanks to Al Williams for this)

The buttons in the LogiSim circuit will pop back up as soon as you let up on the mouse button, but the light on the output will stay "set" or "reset" even when no button is down. If you press "set", it will stay on. If you press "reset" it will stay off. It remembers what you pressed.

Note the the first NAND gate in the upper left: It has both its inputs hooked to the button. This is a trick that makes the NAND gate into a NOT gate. We could have just put a NOT gate here, but we wanted to show you how any gate can be made from NAND gates. This NAND / NOT gate is here to make the button into a "normally on" type of button. The output of the NAND / NOT gate (at the wire with "/S" over it) is on until the button is pushed, then it goes off for a moment.

The /S just means "NOT Set". Signals are named to show what is true when the signal is on / true / one / high. So when this signal is on, the flip-flop is reset, or not set. See the Advanced section below for more on this.

Look at the output of the top right NAND gate (the gate is labled "A" and the wire is labled "Q" ). If the Set button is pressed, /S is low, and Q MUST be high. Why? Because if any input to a NAND gate is low, the output will be high. If Q is on, the top input to the lower right NAND gate (labled "B") is on. Now, if the Reset button is not pressed, the "/R" wire must also be high. So both inputs to B are on and the output of B will go OFF. That makes the lower input to "A" off and it "locks" the circuit in the Set position. Now if the Set button is up (off), even though /S is on, the lower input to A keeps that gate on.

You can run through the Reset switch the same way. If Reset is pressed, /R is low so B must be high so A will be low (/S is high) so the top input to B locks it on even when Reset is released and /R comes back on.

If that doesn't make sense yet, keep pressing the buttons while you read the above text again and again until it clicks.

Remy says to remind you that all computer memory is made from bits. 8 Bits are a BYTE and 1 Mega Byte (1MB) is about 1 million Bytes while 1GB (Giga Byte) is about a Billion bytes. FLASH memory is a short name for the real name: NAND FLASH. Guess what it's made out of?

Next

The D type flip-flop; A bit more like a bit. Or Binary and decimal numbers computers count!

See also:

Advanced

What would happen if both the Set and Reset buttons were pressed at the same time?

What would happen if you fed the Q output back into the input?

An RS Flip Flop is actually one type of a multivibrator. It is a bistable multivibrator because it has two stable states. Other multivibrator types include the monostable and astable multivibrators.

When naming a signal, including the bar attribute (such as the "/") means that the condition whose name appears after the bar is not true when the signal itself is true. For example, on a memory chip it is common to see a control signal named READ meaning the signal is true when the read condition is true, that is, when a read is being done. It might also be named /WRITE meaning the signal is true when the write condition is not true, that is, when a write is not being done. Sometimes, we even see both labels used as in READ /WRITE meaning it's high while a read is being done and a write is not being done.

Thanks to Joe Watson for help with this page

See also: