# CODESYS SR

Instructions · `SR` · verification: source checked

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).

## Specification

| Property | Value |
|---|---|
| Language | iec 61131 3 |
| Code | SR |
| Group | Bistable Function Blocks |
| Syntax | SRInst(SET1 := VarBOOL1, RESET := VarBOOL2) |
| Dialect | CODESYS |

### Parameters

| Name | Data type | Description |
|---|---|---|
| SET1 | BOOL | Sets the output Q1 to TRUE (dominant) |
| RESET | BOOL | Resets the output Q1 to FALSE |
| Q1 | BOOL | Output 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).

## Sources

1. [Beckhoff Information System](https://infosys.beckhoff.com/content/1033/tcplclib_tc2_standard/74396043.html) (accessed 2026-10-26)
2. [CODESYS Group](https://content.helpme-codesys.com/en/libs/Standard/Current/Bistable-Function-Blocks/SR.html) (accessed 2026-10-26)

---

Source page: https://machineschema.com/instruction/iec-sr  
JSON: https://machineschema.com/instruction/iec-sr.json  
License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Cite Machine Schema and the original sources.
