Table Of Contents

Transferring Data Using Tags

Last Modified: November 7, 2019

Use tags to send and receive data from one system to other systems.

What to Use

You can find the SystemLink Tag and Configuration APIs on the Data Communication palette in LabVIEW and LabVIEW NXG.
spd-note-note
Note  

This example uses the LabVIEW NXG Tag and Configuration APIs. You can use the same code in LabVIEW to send data between systems.

What to Do

  1. Create the following diagram in a VI to read tag data.

    Customize the gray sections for your unique programming goals.

    Open Configuration initiates a connection with a SystemLink Server or SystemLink Cloud.
    Open Tag opens a reference to a tag on the server defined by the configuration.
    spd-note-note
    Note  

    Use Query Tags instead of Open Tag if you do not know the data type of the tag.

    If the reference does not exist on the server, Open Tag will create one. Open Tag will return an error if a tag with the same path but of a different data type already exists.

    Use a For Loop to open a tag for each element in an array of tag names. In this example, the VI opens an array of station temperature tags.

    Read Tag checks the current value of the tag. Follow an open/read/close model when using this VI.
    spd-note-note
    Note  

    Use Multi Read instead of Read Tag if you need to read multiple tag values as a part of a single operation.

    Use a While Loop to continue reading tags until a condition is met. In this example, Read Tag returns tag values unless the boolean constant changes to True.

    Close Tag closes a tag reference.

    Use a For Loop to close tags from an array of tag names, or call Open Tag (Multiple) instead.

    Close Configuration invalidates any open reference to created objects and closes connections associated with the configuration.
  2. Create the following diagram in a VI to write a tag value.

    Customize the gray sections for your unique programming goals.

    Open Configuration initiates a connection with a SystemLink Server or SystemLink Cloud.
    Open Tag opens a reference to a tag on the server defined by the configuration.
    spd-note-note
    Note  

    Use Query Tags instead of Open Tag if you do not know the data type of the tag.

    If the reference does not exist on the server, Open Tag will create one. Open Tag will return an error if a tag with the same path but of a different data type already exists.

    Use a For Loop to open a tag for each element in an array of tag names. In this example, Open Tag opens an array of station temperature tags.

    Write Tag writes a value to a tag. Follow an open/write/close model when using this VI.
    spd-note-note
    Note  

    Use Multi Write instead of Write Tag if you need to write multiple tag values as a part of a single operation.

    If you want the server to manage the time stamp of when the tag was written, leave the time stamp cluster unwired.

    Use a While Loop to continue reading tags until a condition is met. In this example, Write Tag writes tags until you click the stop button on the panel.

    Use a For Loop to write a tag for each element in an array of tag names.

    Close Tag closes a tag reference.

    Use a For Loop to close tags from an array of tag names, or call Open Tag (Multiple) instead.

    Close Configuration invalidates any open reference to created objects and closes connections associated with the configuration.

Troubleshooting

If you encounter errors, try the following troubleshooting strategy:
  • Verify the data type of the tag matches the Function configuration or selected polymorphism of the VI. For instance, if the data type of the tag called from the server is a double-precision, floating point number, select Double as your Function configuration.

Recently Viewed Topics