INGEAR.NET.MBLINK

 

Controller.ReadTag Method 

Read instance of a Tag class or an array of Tag classes from the MODBUS device.

[Visual Basic]
Public Function ReadTag( _
   ParamArray Tag As Tag() _
) As Integer
[C#]
public int ReadTag(
   params Tag[] Tag
);

Parameters

Tag
Instance of a Tag or array of Tags

Return Value

The status of the operationResultCode

Remarks

If the instance of the Controller class is not already connected to the programmable logic controller, calling this method will automatically establish a connection.

The data value from the programmable logic controller will be returned in the Value property of the Tag class.  

Exceptions

Exception Type Condition
ArgumentNullException Thrown if Tag parameter is a null reference (Nothing in Visual Basic)
InvalidOperationException Thrown if Tag parameter is not Tag Type, or if Name> is null or empty, or Value is null

Example

VB
Imports MBLink
Dim MBDevice As New Controller("192.168.1.45")
Dim MyTag As New Tag("40001")
MBDevice.ReadTag(MyTag)
C#
using MBLink;
Controller MBDevice = new Controller("192.168.1.45");
Tag MyTag = new Tag("40001")
MBDevice.ReadTag(MyTag)

See Also

Controller Class | MBLink Namespace | GroupRead | WriteTag | Now