RS flip-flop
Set/reset latch.
- Boolean
- Modelica Standard Library
- 4 ports
rsFlipFlopLibraryLogicDescription
A set/reset latch built from two cross-coupled NOR gates. S sets Q true, R resets it, and with both false Q keeps its value.
Q starts false and Q̄ starts true.
Example
Latch, timer, and sampler Start and stop buttons set and reset a flip-flop, which times the run, gates a signal, and samples the start time.
EnableStartStopEnabled startStart edgeStop edgeRunningRun timeSine 1 Hz0Gated sineClockStart time
Also in this example:ConstantSine waveClockANDSwitch (logic)TimerBoolean constantBoolean stepTriggered samplerRising edge
Ports
Inputs 2
-
S
Set input.
-
R
Reset input.
Outputs 2
-
Q
Latched output.
-
Q̄
QIQ̄, normally the complement of Q.
Equations
Modelica
Q = ¬(R ∨ QI) QI = pre(¬(S ∨ Q)), with pre(…) = true at t = 0 pre(…) breaks the algebraic loop; the latch settles within the event iteration at the same instant.
Implementation
Modelica Standard Library 4.1.0
MSL documentation Modelica.Blocks.Logical.RSFlipFlopAssumptions and limitations
- With S and R both true, Q and QI are both false, so QI is not the complement of Q in that state.
- No propagation delay, setup, or hold times.
See also
Select a block in Gradara and press F1 to open its page offline.