A reset-dominant flip-flop that latches FALSE when the reset input is active.
The RS instruction implements a reset-dominant flip-flop, as defined in IEC 61131-3. It has two inputs: Reset (R) and Set (S). When both inputs are TRUE simultaneously, the Reset input wins and the output is FALSE.
Behavior summary:
TRUEFALSEFALSE (reset-dominant)Use RS when the "off" condition must take priority over the "on" condition, which is common in safety-critical applications where stopping must always override starting.
For safety-critical outputs (e.g., emergency stop),
RS(reset-dominant) is generally the safer choice.
ActionQualifier enum (default: ActionQualifier.N)ActionInstruction.RS[ActionOperand("set_input"), ActionOperand("reset_input")] - operand[0] is the Set input, operand[1] is the Reset input
RSrequires both operands. Without them, S and R both default toFALSEand the latch never moves. The Sequence visual editor and the runtime both warn when operands are missing.
{GIF:HERE} - Screenshot showing a step named "StepName" with an action on "latch_var" using the RS (reset-set flip-flop) instruction, with the Set and Reset input variables specified in the two operand fields
from automation_machine import Sequence, StepType, ActionInstruction, ActionOperand
class Example(Sequence):
def setup(self):
step = self.add_step(StepType.INITIAL, name="StepName")
# `latch_var` follows the reset-dominant flip-flop logic; stop overrides start if both are TRUE.
step.add_action(
"latch_var",
"Reset-dominant latch driven by start/stop buttons",
instruction=ActionInstruction.RS,
operands=[
ActionOperand("start_btn"), # Set (S)
ActionOperand("stop_btn"), # Reset (R) - wins on conflict
],
)