R_TRIG (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

1.00 / 1.00.00


R_TRIG is a rising edge detector. It will activate the "q" output when a rising edge is detected on the "trig" input.

 

For a falling edge trigger, please see the F_TRIG function block.

 

Input:

trig : BOOL (true/false)

On the rising edge of this input, the output "q" will go high.

         

Output:

q : BOOL (true/false)

Output from the rising edge trigger detector.

 

Declaration:

FUNCTION_BLOCK R_TRIG;
VAR_INPUT
  trig : BOOL R_EDGE; | Rising edge on this signal activates 'q' for one execution
END_VAR;
VAR_OUTPUT
  q   : BOOL;       | Output from detector
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
VAR_INPUT
  input1 : BOOL; | Input for the rising edge detector
END_VAR;
 
VAR_OUTPUT
  signal : BOOL; | Output that will follow the q output from the rising edge detector.
END_VAR;
 
VAR
  trigger : R_TRIG; // Declare an instance of the R_TRIG functionblock
END_VAR;
 
PROGRAM test;
 
BEGIN
  ...
  trigger(trig:= input1); // Input the input1 signal to the rising edge detector
  signal := trigger.q; // output will follow the q output from the detector
  ...
END;
END_PROGRAM;