GAL16V8 :2- Latches, SR Latch

Today we will explore the basic of SR Latch and how to build one with a GAL16V8.

The wikipedia definition of a latch is ” a circuit that has two stable states and can be used to store state information“.

The latch we want to implement today is the SR LATCH with two nor gates. the circuit is as follows.

Image result for sr latch

This latch have two inputs, Set (S) and Reset (r), and two exits, Q, which is the stored state, and !Q, which is the inverse of the stored state. Easy.

The truth table of this circuit is as follows.

Truth table of SD Latch

As we can see, as long as only one of either Set or Reset is on, the Q output will store the value of Set.

Note that when Set and Reset are off, Q and !Q keep their values, that is where the storage property comes in.
Also in this specific latch made out of NOR gates, when both Set and Reset are ON both Q and !Q are disabled, thus both are 0, this is an unstable state and the end value of Q and !Q when both Set and Reset are OFF again will be a race condition on which one is set last.

Now How will this looks in CUPL code? Well, we only need to define the following two equations.

Q = !(R # QN);
QN = !(S # Q);

As you can see, we are only describing the inputs of the NOR gates here, in the CUPL file it will look similar to this.

partNo 00;
Date 16/06/2016;
Revision 01;
Designer Esteban;
Company estebon;
Assembly None;
Location None;
Device g16v8ms;

PIN 2 = R;
PIN 3 = S;

PIN 12 = Q;
PIN 13 = QN;

Q = !(R # QN);
QN = !(S # Q);

Now we burn our gal and wire as follows. See the Make it blink tutorial on how to program our gal.

Wiring of SR Latch

And finally we can test it, Notice how the output led match the button pressed.

SR Latch with GAL16V8

That is all on this, hope you find it useful.

Leave a Reply

Your email address will not be published. Required fields are marked *