TagWriteValueQualityFB Function Block

Help Contents


The TagWriteValueQualityFB Function Block writes a value and quality to an Internal Data Point Tag.

The function block writes the value and quality by sending a WriteValueQuality Tag Command to the tag. The function block provides status information to:

Functions and Function Blocks

The TagWriteValueQualityFB 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. A program uses the function block to sample the state of the tag command as it executes.

If you want to write value and quality from an Operator Action, use the TagWriteValueQuality Function.


The TagWriteValueQualityFB Function Block has this syntax:

        ERRORMSG=>Variable-Reference );

Note: All parameters are optional.


The TagWriteValueQualityFB Function Block has these parameters:

Parameter Type Direction Description
REQ BOOL R_EDGE Input A rising edge starts the WriteValueQuality Tag Command.
TAGNAME STRING Input The name of the tag to send the WriteValueQuality Tag Command to. This can be an absolute tag name, or a relative tag name. Relative tag names are resolved relative to the full name of the host program.
VALUE ANY Input The value to write to the tag.
QUALITY INT Input The quality to write to the tag.
BUSY BOOL Output Set to TRUE while the WriteValueQuality Tag Command is in progress.
DONE BOOL Output Set to TRUE for 1 execution after the WriteValueQuality Tag Command has completed.
ERROR BOOL Output Set to TRUE if the WriteValueQuality Tag Command failed.
ERRORMSG WSTRING Output If ERROR is TRUE, the reason why the WriteValueQuality Tag Command failed.


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

WriteValueQuality Tag Command

To learn about the WriteValueQuality Tag Command.

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.