clockDayTimer (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

1.00 / 1.00.00


clockDayTimer is a simple repeating timer. It has a start- and stop time. When the start time is reached, the q output will go true. Q will go false when the stop time is reached. This will repeat every day.

 

Input:

enable : BOOL (Default: FALSE (Timer is NOT started))

Timer is enabled when enable is true.

 

start_hour: INT (-1 .. 23) Default: -1 (not used in comparison)

The starting hour.

 

start_minute : INT (-1 .. 59)  (Default: -1 (not used in comparison))

The starting minute.

 

start_second : INT (0 .. 59) (Default: 0)

The starting second.

 

stop_hour: INT (-1 .. 23) (Default: -1 (not used in comparison))

The ending hour.

 

stop_minute : INT (-1 .. 59)  (Default: -1 (not used in comparison))

The ending minute.

 

stop_second : INT (0 .. 59) (Default: 0)

The ending second.

 

Output:

q : BOOL

When start time is reached, q will go true, and it will go false when the stop time is reached

 

Declaration:

FUNCTION_BLOCK clockDayTimer;
VAR_INPUT
  enable       : BOOL := FALSE;
  start_hour   : INT := -1;  // 00..23    
  start_minute : INT := -1;   // 00..59    
  start_second : INT := 0;   // 00..59    
  stop_hour   : INT := -1;  // 00..23    
  stop_minute : INT := -1;   // 00..59    
  stop_second : INT := 0;   // 00..59    
END_VAR;
VAR_OUTPUT
  q           : BOOL;    
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
VAR_OUTPUT
  SignalLamp : BOOL; | Output that drives the signal lamp
END_VAR;
 
PROGRAM test;
VAR
  DayTimer : clockDayTimer; // Declare an instance of the clockDayTimer functionblock
END_VAR;
 
// Set the timer to start at 12:00 and end at 13:30 (every day)
DayTimer(enable:=TRUE, start_hour:= 12, start_minute:=0, stop_hour:=13, stop_minute:=30); // Start and stop time for the timer
BEGIN
  DayTimer();
  ...
  // SignalLamp will be on from 12:00 until 13:30 every day
  SignalLamp := DayTimer.q;
  ...
END;
END_PROGRAM;