{"id":"iec-r-trig","model_id":"R_TRIG","name":"CODESYS R_TRIG","summary":"R_TRIG is a function block in the CODESYS Standard library that detects a rising edge of a boolean signal. A declared instance is called with the boolean signal to be checked connected to the CLK input. The Q output is TRUE when a rising edge is detected.","study_notes":["R_TRIG is marked (FB), i.e. it is a function block, so an instance must be declared before use: RTRIGInst : R_TRIG;","The instance is called in structured text as RTRIGInst(CLK := VarBOOL1); and the result is read from the Q output: VarBOOL2 := RTRIGInst.Q;","The library page places R_TRIG under the Trigger category of the Standard library."],"safety_notes":[],"sources":[{"url":"https://infosys.beckhoff.com/content/1033/tcplclib_tc2_standard/74391563.html","title":"Beckhoff Information System","accessed":"2026-10-26"},{"url":"https://content.helpme-codesys.com/en/libs/Standard/Current/Trigger/R_TRIG.html","title":"CODESYS Group","accessed":"2026-10-26"}],"verification":{"status":"source_checked","checked_at":"2026-10-26","values":9,"method":"llm_source_check"},"updated_at":"2026-10-26","type":"instruction","spec":{"language":"iec_61131_3","code":"R_TRIG","syntax":"RTRIGInst(CLK := VarBOOL1);","parameters":[{"name":"CLK","data_type":"BOOL","description":"Input: boolean signal to be checked"},{"name":"Q","data_type":"BOOL","description":"Output: TRUE: rising edge detected"}],"dialect":"CODESYS","related":[],"standards":[]},"url":"https://machineschema.com/instruction/iec-r-trig","license":"https://creativecommons.org/licenses/by/4.0/"}