Accessing the RTC special data registers

In this example the system variables of the real time clock are called in structured text. The numbers of data registers differ for the PLC type used.

System variable

FP0, FPe

FPS, FP-X, FP2, FP2SH

sys_wClockCalendarMinSec

DT9054

DT90054

sys_wClockCalendarDayHour

DT9055

DT90055

sys_wClockCalendarYearMonth

DT9056

DT90056

sys_wClockCalendarSet

DT9058

DT90058

POU header

In the POU header, all input and output variables are declared that are used for programming this function.

ST body

(* Set RTC to 05-06-31 12:00:00 *)
if (bSetNewRTC) then
    sys_wClockCalendarMinSec:=16#0000;
    sys_wClockCalendarDayHour:=16#3112;
    sys_wClockCalendarYearMonth:=16#0506;
    sys_wClockCalendarSet:=16#8000;
end_if;
(* Evaluate the RTC for 12:00:00 *)
if ( sys_wClockCalendarMinSec=16#0000AND
    (sys_wClockCalendarDayHour AND16#00FF)=16#0012) then
    (* React on lunch time *)
end_if;

Modified on: 2019-01-25Feedback on this pagePanasonic hotline