TPERIOD (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

1.00 / 1.00.00


TPERIOD is a periodic timer. This function block will activate its "q" output when it is enabled by using the enable input. The high_period specifies the period where the "q" output should be true, and the low_period specifies the period where the "q" output should be false. The periods are specified in milliseconds.

 

Timing:

 

tperiod-timing

 

 
Notes:

This functionblock uses the TP function block.

 

Input:

enable : BOOL (true/false) Default FALSE

If this input is true, the timer is enabled.

 

high_period : INT (0..32767)

Specifies how many milliseconds the "q" output should be true.

 

low_period : INT (0..32767)

Specifies how many milliseconds the "q" output should be false.

         

Output:

q : BOOL (true/false)

Output from the timer.

 

Declaration:

FUNCTION_BLOCK TPERIOD;
VAR_INPUT
  enable     : BOOL := FALSE; |'TPERIOD' operation enabled.
  low_period : INT;           | Period for low-signal
  high_period : INT;           | Period for high-signal
END_VAR;
VAR_OUTPUT
  q           : BOOL;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
VAR_INPUT
  input1 : BOOL; | Input that will enable the periodic timer
END_VAR;
 
VAR_OUTPUT
  signal : BOOL; | Output that will follow the q output from the periodic timer.
END_VAR;
 
VAR
  tper : TPERIOD; // Declare an instance of the TPERIOD functionblock
END_VAR;
 
PROGRAM test;
 
BEGIN
  tper();
  ...
  tper.high_period := 20; // number of ticks the q output should be high
  tper.low_period := 20; // number of ticks the q output should be low
  tper.enable := input1; // The timer is enabled when input1 is true
  signal := tper.q; // output will follow the q output from the timer
  ...
END;
END_PROGRAM;