Writing Data

<< Click to Display Table of Contents >>

Manual > Server Creation Guide > Interface > IPLink-Interface > IPLinkClient Library > IPLinkClient Library Sample Collection >

Writing Data

overview

This is a sample program that writes values. The WriteVals method is the best way to write values to multiple tags. This sample uses WriteVals to write to four tags at the same time.

 

c_interface_0136

 

 

Download the sample

The creation examples shown on this page are provided with samples.

 

The sample can be downloaded from below.

 

Samples and detailed explanations will be provided in VB.NET2010.

 

 

Program Highlights

We will explain the main points of the program.

 

WriteVals Method
WriteVals can process multiple tags at once. When writing to tags with multiple consecutive addresses (such as D0000 to D01000), writing all at once with WriteVals is faster than calling WriteVal multiple times, because the communication packets are processed together. Also, when dealing with a large number of points, writing can be done quickly by using array tags. In the sample "btnWrite_Click()", the WriteVals return value is used to determine whether the operation was successful. The Results argument stores the Boolean success or failure value for each tag in an array, but this can only be used when the WriteVals return value is TRUE.
 

If AxIPLink1.WriteVals(4, TagPaths, TxtValues, Results) Then
    For i = 0 To 3
        If CBool(Results(i)) Then
            Controls("lblResult" & i).Text = "Success!"
        Else
            Controls("lblResult" & i).Text = "Error!"
        End If
    Next i
Else
    For i = 0 To 3
        Controls("lblResult" & i).Text = "Error!"
    Next i
End If

 
 

hint

Be sure to declare the return value (Values) of WriteVals as an object array. This is to allow the values to be written to be of different types (Boolean, numeric, string, Boolean array, numeric array, string array, etc.).

 

 

 

Operation check

Once online, run the Visual Basic application.

 

Make sure that the lamps for tags "T01" to "T04" turn yellow (this example is for writing only (the values do not need to be updated automatically, so they are registered in an inactive state). If you want to check the current value, right-click the tag to display the menu, and select "Tag Operations" and "Start All Tag Monitoring" from the menu, which will allow you to check the current value (the lamps will turn red).
 

c_interface_0137

 

After checking the communication connection, enter any value on the Visual Basic screen and confirm that the value is written to the tag by clicking the Write button.