Returns the error code for the last MODBUS device access for the Tag instance
Types of errors reported: (see Remarks below)
ErrorCode will reflect the probably cause of failure. The ErrorString property provides a description of the error.
Operational Error - E_xxx error codes. See ResultCode
WINSOCK Error - 100xx error codes. Windows has a problem with the network subsystem an unknown Win32 error comes back with a numer (like e.g. 10060).
Device Errors - Errors reported by the MODBUS device. Please consult the MODBUS users manual for resolution.
VB
Imports MBLink
Dim MBDevice As New Controller("192.168.1.45")
Dim MyTag As New Tag("40001")
MBDevice.ReadTag(MyTag)
If MyTag.ErrorCode = ResultCode.E_SUCCESS Then
Console.WriteLine(MyTag.Value.ToString())
Else
Console.WriteLine(MyTag.ErrorString)
End If
C#
using MBLink;
Controller MBDevice = new Controller("192.168.1.45");
Tag MyTag = new Tag("40001");
MBDevice.ReadTag(MyTag);
if (MyTag.ErrorCode != ResultCode.E_SUCCESS)
Console.WriteLine(MyTag.ErrorString);
else
Console.WriteLink(MyTag.Value.ToString());
Tag Class | MBLink Namespace | ErrorString | QualityCode | QualityString | TimeStamp