SR Latch (srff)
Remembers a fault or state until it is reset.
Group: Control · Kind: {"block":"srff","kind":"control"}
When to use it
Use it to remember a fault until it is cleared, such as an overcurrent trip. Use D Flip-Flop when the state should change only on a clock edge.
Pins
| Pin | Domain | Meaning |
|---|---|---|
s |
signal | Set input; makes q 1 when above 0.5 |
r |
signal | Reset input; makes q 0 and wins over s |
q |
signal | Latch output, 0 or 1 |
qn |
signal | Opposite of q |
Common parameters
q0: Initial output q, 0 or 1 (Default: 0)
Parameters
| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
q0 |
— | 0 | Initial output q, 0 or 1 | |
priority |
— | reset | Which input wins when s and r are both high: reset, or set (set-dominant, as peak-current-mode control needs) |
Parameter descriptions are in English in both languages.
Model
At every solver step, if r is above 0.5 then q becomes 0, otherwise if s is above 0.5 then q becomes 1, otherwise q keeps its value. With priority = set the latch is set-dominant: s is checked first, and r is ignored while s is high (the clock of a peak-current-mode loop sets the latch even if the current comparator still resets it). qn is always 1 - q. The latch reacts to levels, not edges, and has direct feedthrough, so q0 (0 or 1) sets only the value before the first input is seen.
Common mistakes
- While r stays high the output stays 0 whatever s does. Use a short reset pulse, for example from Monostable, to clear a fault.
- Two latches wired to each other, or a loop through the latch and gates, is refused. One SR Latch already remembers a state, so you do not need to build one from gates.
Problems rules: compile.error
Datasheet and sources
There is no datasheet. q0 is the state at power-up that your design assumes, usually 0, meaning no fault is held. The set and reset signals come from your protection logic, such as a comparator on a current sense and a reset from the controller.
Example
Open the example with the command file.openExample and the name demo:srff.
Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.