SR — Set-dominant bistable

Pin layout

DirectionNameTypeDescription
InputS1BOOLSet (dominant) — wins over R when both are TRUE
InputRBOOLReset
OutputQ1BOOLLatched state

SR vs. RS

FBSet inputReset inputPriority
SR (this page)S1RSet wins
RSSR1Reset wins

The “1” suffix marks the dominant input. Pick SR when an active set request must override a release (latching alarms, fault counters that should remember their trip until manual acknowledge); pick RS when an active reset must override a set (safety-stop systems).

Semantics

S1 = TRUE  : Q1 := TRUE  (set wins)
R = TRUE   : Q1 := FALSE (only when S1 = FALSE)
both FALSE : Q1 unchanged

Truth table:

S1RQ1 (next)
FFunchanged
TFTRUE
FTFALSE
TTTRUE (S1 wins)

Example

VAR
    alarmLatch : SR;
END_VAR

alarmLatch(S1 := xFaultCondition,
           R  := xOperatorAck);

IF alarmLatch.Q1 THEN
    xAlarmLamp := TRUE;
END_IF;

Latching alarms are the canonical SR use-case: a fault that self-clears (sensor recovers) should keep the alarm on until the operator acknowledges. SR encodes “set on fault, only release on ack” with set-priority by construction.

IEC reference

IEC 61131-3 third edition (2013), Annex F.4.1.

matiec conformance

Implemented per the standard.