TagSetClock - Synchronize the Clock of a PLC

Help Contents


The TagSetClock function block attempts to synchronize the real time clock of a PLC with Fernhill SCADA.

The function block synchronizes the real time clock by sending a SetClock tag command to the PLC tag. The function block provides status information to:

Attempting to synchronize the clock of a PLC will fail if:


The TagSetClock function block has these parameters:

Parameter Type Direction Description
REQ BOOL R_EDGE Input A rising edge starts the SetClock tag command.
TAGNAME STRING Input The name of the tag to send the SetClock tag command on.
BUSY BOOL Output Set to true while the SetClock tag command is in progress.
DONE BOOL Output Set to true for 1 execution after the SetClock tag command has completed.
ERROR BOOL Output Set to TRUE if the SetClock tag command failed.
ERRORMSG WSTRING Output If ERROR is TRUE, the reason why the SetClock tag command failed.

Once the SetClock tag command begins, additional requests from the input signal REQ are ignored until the tag command completes.

These timing diagrams show the relationship of the REQ, BUSY, DONE, and ERROR signals processing two requests. The first request completes with an error, the second request completes normally:

        +--------+     +-+ +------+
  REQ   |        |     | | |      |
      --+        +-----+ +-+      +------
        +------+       +------+
 BUSY   |      |       |      |
      --+      +-------+      +----------
               ++             ++
 DONE          ||             ||
ERROR          |       |
      ---------+       +-----------------

The BUSY signal is TRUE while the tag command is in progress. The DONE signal is TRUE for 1 execution after the completion of the tag command.

Further Information

SetClock Tag Command

To learn about the SetClock tag command.

Tag Command Function Blocks

To learn about other tag command function blocks.

Elementary Data Types

To learn about the different types supported by Fernhill SCADA.

Common Elements

To learn about other IEC 61131-3 Common Elements.


For the meaning of terms used in Fernhill SCADA.