clockSet (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

1.00 / 1.00.00


This function can be used to set the real time clock on the RTCU device. If any of the input parameters are not referenced in the call, they will not be modified in the real time clock.

 

Input:

year : INT (-1, 2000 .. 2048) (Default -1)

The current year - if "-1", then not updated.

 

month : SINT (-1, 1 .. 12) (Default -1)

The current month - if "-1", then not updated.

 

day : SINT (-1, 1 .. 31) (Default -1)

The current date - if "-1", then not updated.

 

hour: SINT (-1 .. 23) (Default -1)

The current hour - if "-1", then not updated.

 

minute : SINT (-1 .. 59) (Default -1)

The current minute - if "-1", then not updated.

 

second : SINT (-1 .. 59) (Default -1)

The current second - if "-1", then not updated.

 

linsec : DINT (-1 .. 2147483647) (Default -1)

Seconds since 1980-1-1 00:00:00. If all other input variables are set to their default state (-1), and Linsec is set to something different than -1, the new time will be calculated as Linsec numbers of seconds since 1980-1-1 00:00:00.

 

Returns:

None

 

Declaration:

FUNCTION clockSet;
VAR_INPUT
  Year   : INT := -1; // 2000..2048
  Month : SINT := -1; // 01..12    
  Day   : SINT := -1; // 01..31    
  Hour   : SINT := -1; // 00..23    
  Minute : SINT := -1; // 00..59    
  Second : SINT := -1; // 00..59    
  Linsec : DINT := -1; // Seconds since 1980-1-1 00:00:00
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
  // Set the real time clock to 17th of May 2000. Please note that the hour, minute, second and day are not assigned new values.
  clockSet(year := 2000, month := 5, day := 17);
 
BEGIN
  ...
END;
 
END_PROGRAM;