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.
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.
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.
Now we burn our gal and wire as follows. See the Make it blink tutorial on how to program our gal.
And finally we can test it, Notice how the output led match the button pressed.
That is all on this, hope you find it useful.