7.1.1 SR
Function
SR is called set priority standard bistable element, that is, set priority
LD graphics
Parameter description
| Interface variables | Declaration | Data type | Description |
|---|---|---|---|
| S1 | Var_Input | BOOL | Set |
| R | Var_Input | BOOL | Reset |
| Q1 | Var_Output | BOOL | Operand 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

- 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;