Date and time instructions
290
Part II IEC Instructions
GET_RTC_DT
Read the Real-Time Clock
To add an enable input and enable output to the instruction, select [With EN/ENO] from the
"Instructions" pane (LD, FBD or IL editor). To reuse an instruction select "Recently used" from the
context menu or press <Ctrl>+<Shift>+<v> in the programming window.
PLC types Availability of GET_RTC_DT (see page 1326)
Data type I/O Function
DATE_AND_TIME output date and time
Description
GET_RTC_DT reads the PLC's real-time clock value for the clock/calendar function. If the PLC has
no real-time clock or if the real-time clock is not functioning, the result is an invalid date and time
value.
Data types
Example
In this example the function has been programmed in ladder diagram (LD) and structured text (ST).
POU header
All input and output variables used for programming this function have been declared in the POU
header.
LD
ST
When programming with structured text, enter the following:
DT_value := GET_RTC_DT();