TagWriteFB Function Block

Help Contents


The TagWriteFB Function Block asks a tag to write its value to the data source.

The function block asks the tag to write its value by sending a Write Tag Command to the tag. The function block provides status information to:

Currently no tags support the Write write tag command.

Note: Early versions of Fernhill SCADA supported Write Register Blocks for bulk data transfer to PLC Devices. Write Register Blocks used this tag command to trigger the write operation. However, Write Register Blocks were deprecated. Instead use these function blocks for bulk data transfer:

Functions and Function Blocks

The TagWriteFB Function Block is intended for use in a Program Tag that runs on the Fernhill SCADA Server. A Program Tag uses a continuous execution model, where the program code runs at a fixed interval. The function block samples the state of the tag command as it executes.

There is no equivalent TagWriteFB Function for use in an Operator Action.


The TagWriteFB Function Block has this syntax:

        ERRORMSG=>Variable-Reference );

Note: All parameters are optional.


The TagWriteFB Function Block has these parameters:

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


TAGNAME Parameter

The TAGNAME parameter is the full name of the tag that runs the Write Tag Command. The value of this parameter can be an absolute tag name or a relative tag name. A relative name tag name is resolved relative to the program tag that runs the function block.

The tag should be one of the types listed in the Applies To list of the Write Tag Command.

Timing Diagram

Once the Write 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

Tag Command Function Blocks

To learn about other tag command function blocks.

IEC 61131-3 Expressions

To learn about the different types of expression to use as function parameters.

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.