Skip to main content

7.1.1 SR

Function

SR is called set priority standard bistable element, that is, set priority

LD graphics

alt text

Parameter description

Interface variablesDeclarationData typeDescription
S1Var_InputBOOLSet
RVar_InputBOOLReset
Q1Var_OutputBOOLOperand signal status

Corresponding syntax:

  • Q1 = S1 OR (NOT R AND Q1)
  • When the S1 and R signals are both TRUE, the operand signal status is set to "1";
  • When the S1 signal is TRUE and the R signal is FALSE, the operand signal status is set to "1";
  • When the S1 and R signals are both FALSE, the operand signal status remains unchanged;
  • When the S1 signal is FALSE and the R signal is TRUE, the operand signal status is reset to "0"
warning

Function block usage requires global declaration of an instance

Example

  • LD example is shown in the animation below

alt text

  • ST example is shown in the following code:
SR_1(S1:=IN1,R:=IN2,Q1=>OUT);
IF OUT THEN
iVar:=1;
ELSE
iVar:=0;
END_IF;