# Latch problem (RS NAND)

#### Robin Mitchell

Joined Oct 25, 2009
819
Hi guys,

How do I use the RS NAND to remember an input because i cant get it to work, i am using the 4044...(i have millions)

Last edited:

#### beenthere

Joined Apr 20, 2004
15,819
An RS latch only retains the maintained input. It's not like a flip flop.

#### Robin Mitchell

Joined Oct 25, 2009
819
Great
Is there anyway?

#### beenthere

Joined Apr 20, 2004
15,819
Use a SPDT toggle switch so the input only changes with the switch. Otherwise, you need a flip flop to hold the change. Then you have to have some means of resetting the flip flop later. IC level logic can be a bit tedious.

An RS latch usually gets used for switch debouncing.

#### Papabravo

Joined Feb 24, 2006
14,679
The problem with an RS latch made from NAND gates is that it requires 2 different inputs, one to set the latch and one to reset the latch.

What you want is called a transparent latch. It takes samples of a logic input in the following way. If the enable is HIGH the input data is passed to the output; that is the transparent part. When the enable goes low the data present on the input is held as long as the enable remains low.

Look at the 74xx373, where xx could be any available logic family suitable for your purposes.

They are easy to implement in an FPGA using the following Boolean equation
Rich (BB code):
Transparent Latch for output Q, Input D, and Enable G
Q = QG* + DG + DQ
Smart readers may well ask about the apparently redundant 3rd term, DQ, in the above equation. It is a so called "covering term" designed to prevent a logic hazard when the input "D" and the enable "G" switch at close to the same time.