AutomationView Documentation

SR (Set-Reset Flip-Flop (Set-Dominant))

A set-dominant flip-flop that latches TRUE when the set input is active.


Description

The SR instruction implements a set-dominant flip-flop, as defined in IEC 61131-3. It has two inputs: Set (S) and Reset (R). When both inputs are TRUE simultaneously, the Set input wins and the output is TRUE.

Behavior summary:

Use SR when the "on" condition must take priority over the "off" condition in conflict situations.

If you need the reset to take priority instead, use the RS (Reset-Set Flip-Flop).


Syntax

SR requires both operands. Without them, S and R both default to FALSE and the latch never moves. The Sequence visual editor and the runtime both warn when operands are missing.

Syntax

Sequence Visual Editor

Action pump_latch with the SR instruction and the pump_start and pump_stop operand chips
The first chip is the dominant set input, the second the reset input.

Python

from automation_machine import Sequence, StepType, ActionInstruction, ActionOperand

class Example(Sequence):
    def setup(self):
        step = self.add_step(StepType.INITIAL, name="StepName")
        step.add_action(
            "latch_var",
            "Set-dominant latch driven by start/stop buttons",
            instruction=ActionInstruction.SR,
            operands=[
                ActionOperand("start_btn"),
                ActionOperand("stop_btn"),
            ],
        )

See Also