clockGet (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

1.00 / 1.00.00


This function block can be used to read the real time clock on the RTCU device.

 

Input:

None

 

Output:

year : INT (1980 .. 2048)

The current year.

 

month : SINT (1 .. 12)

The current month.

 

day : SINT (1 .. 31)

The current date.

 

hour: SINT (0 .. 23)

The current hour.

 

minute : SINT (0 .. 59)

The current minute.

 

second : SINT (0 .. 59)

The current second.

 

linsec : DINT

Seconds since 1980-1-1 00:00:00.

 

Declaration:

FUNCTION_BLOCK clockGet;
VAR_OUTPUT
  Year   : INT;   // 1980..2048
  Month : SINT; // 01..12    
  Day   : SINT; // 01..31    
  Hour   : SINT; // 00..23    
  Minute : SINT; // 00..59    
  Second : SINT; // 00..59    
  Linsec : DINT; // Seconds since 1980-1-1 00:00:00
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  clock : clockGet; // Declare an instance of the clockGet functionblock
END_VAR;
 
PROGRAM test;
 
BEGIN
  clock();
  // Check if it is December
  IF clock.month = 12 THEN
     ...
  END_IF;
  ...
END;
 
END_PROGRAM;