INGEAR.NET.MBLINK

 

Controller.GroupRead Method 

Reads a TagGroup from the MODBUS device

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

Parameters

TagGroup
TagGroup

Return Value

ResultCode

Remarks

TagGroup parameter and be a single instance of a TagGroup, or an array of TagGroups.  

Exceptions

Exception Type Condition
ArgumentNullException Thrown if TagGroup parameter is a null reference (Nothing in Visual Basic).
ArgumentException Thrown if TagGroup parameter is not TagGroup Type.

Example

VB
Imports MBLink
' * initialize Controller class
Dim MBDevice As New Controller("192.168.1.45")
' * initialize TagGroup class
Dim MyGroup As New TagGroup
' * initialize Tag classes
Dim Tag1 As New Tag("40001")
Dim Tag2 As New Tag("40002")
Dim Tag3 As New Tag("40003", TypeOf(System.Single))
' * add tags to group
MyGroup.AddTag(Tag1)
MyGroup.AddTag(Tag2)
MyGroup.AddTag(Tag2)
' * read group
MBDevice.GroupRead(MyGroup)
' * display data
Console.WriteLine(ToString(Tag1.Value))
Console.WriteLine(ToString(Tag2.Value))
Consoler.WriteLine(ToString(Tag3.Value))
C#
using MBLink
// initialize Controller class
Controller MBDevice = new Controller("192.168.1.45");
// initialize TagGroup class
TagGroup MyGroup = new TagGroup()
// initialize Tag classes
Tag Tag1 = new Tag("40001");
Tag Tag2 = new Tag("40002");
Tag Tag3 = new Tag("40003", typeof(System.Single));
// add tags to group
MyGroup.AddTag(Tag1);
MyGroup.AddTag(Tag2);
MyGroup.AddTag(Tag2);
// read group
MBDevice.GroupRead(MyGroup);
' * display data
Console.WriteLine(ToString(Tag1.Value));
Console.WriteLine(ToString(Tag2.Value));
Console.WriteLine(ToString(Tag3.Value));

See Also

Controller Class | MBLink Namespace | TagGroup | GroupWrite