|
Basic SR Latch
SR means SET and RESET
Outputs are Q and Q' (off and on)
Concept:
It's a very simple state machine. On, Off, based on SET and RESET. States being ON and OFF.
State Table, (pretend this is a circle)
(0 0) no change
/ \
(11)(amb) (0 1) RESET, Q' STATE
\ /
( 1 0 ) SET, Q STATE
Truth Table(ish) Truth tables
for state machines, in this case a LATCH, are slightly different, they describe the RESULTING state from the given inputs
S and R can be A or B or x and y or any other literal used to set up the circuit.
Left is the signal for S and R.
Right is the cosponsoring state.
Bottom output is Q
Top output is Q'
S R | Q Q'
________ (Description)
0 0 | Q Q' Both are zero.. DO NOTHING
0 1 | 0 1 RESET signal... OFF
1 0 | 1 0 SET .... signal... ON
1 1 | amb Ambiguous... invalid.
Like telling a light switch
to turn off and on at
the same time.
Great thing about Latches and their smarmy uptown cousins, Flip Flops, is that they drive behavior. They act as
on-off switches when a clock (timed pulses of ones and zeros at a given interval) tell the latch to turn on.
Note: you can invert the outputs to get Q on top and Q' on bottom via NOT gates.
The clocks can be a single 555 timer (from a linear circuit fed into the digital circuit) set to produce logical ON at a given time, quarts crystals connected to voltage (vibrating at a specific rate and time), or even a clock-type digital circuit.
How is this important? It lets you implement selection (if else). It also lets you implement AI behavior, which is in itself driven by states (observe, think, act).
Simple appetite AI.
Observe that S = 0 for not hungry level.
S is zero, state is not hungry or (Q')
S becomes 1 temporarily (blips to 1 then 0)... state is now hungry (Q).
Note: while hungry and not hungry are 1, everything shuts down (confusion).
State is hungry.
If the signal of 1 for R comes in and switches back to zero again (also blips to 1 then 0), that represents "have eaten enough" and the state changes back to Not Hungry (Q').
Would 1 1 represent nausea? Hm...
|