{"id":"iec-sr","model_id":"SR","name":"CODESYS SR","summary":"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).","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)."],"safety_notes":[],"sources":[{"url":"https://infosys.beckhoff.com/content/1033/tcplclib_tc2_standard/74396043.html","title":"Beckhoff Information System","accessed":"2026-10-26"},{"url":"https://content.helpme-codesys.com/en/libs/Standard/Current/Bistable-Function-Blocks/SR.html","title":"CODESYS Group","accessed":"2026-10-26"}],"verification":{"status":"source_checked","checked_at":"2026-10-26","values":12,"method":"llm_source_check"},"updated_at":"2026-10-26","type":"instruction","spec":{"language":"iec_61131_3","code":"SR","group":"Bistable Function Blocks","syntax":"SRInst(SET1 := VarBOOL1, RESET := VarBOOL2)","parameters":[{"name":"SET1","data_type":"BOOL","description":"Sets the output Q1 to TRUE (dominant)"},{"name":"RESET","data_type":"BOOL","description":"Resets the output Q1 to FALSE"},{"name":"Q1","data_type":"BOOL","description":"Output value"}],"dialect":"CODESYS","related":[],"standards":[]},"url":"https://machineschema.com/instruction/iec-sr","license":"https://creativecommons.org/licenses/by/4.0/"}