CODESYS SR

SR is a standard function block that implements a bistable set-dominant latch. The output Q1 is set to TRUE by the input SET1 and reset to FALSE by the input RESET, with SET1 taking priority. The implementation is the Boolean expression Q1 := SET1 OR (NOT RESET AND Q1).

Source checked12/12 values · 2026-10-26

Specification

2 sources
Languageiec 61131 3
CodeSR
GroupBistable Function Blocks
SyntaxSRInst(SET1 := VarBOOL1, RESET := VarBOOL2)
DialectCODESYS

Parameters

NameData typeDescription
SET1BOOLSets the output Q1 to TRUE (dominant)
RESETBOOLResets the output Q1 to FALSE
Q1BOOLOutput value

Study notes

  • Implementation in ST: Q1 := SET1 OR (NOT RESET AND Q1);
  • Example declaration: SRInst : SR;
  • Example call in ST: SRInst(SET1 := VarBOOL1, RESET := VarBOOL2); then read VarBOOL3 := SRInst.Q1;
  • Set-dominant means SET1 overrides RESET when both inputs are TRUE.
  • Q1 is an output, so it is read from the instance (SRInst.Q1).
↑↓ navigate↵ openesc close