Hi,
I want to access the invalid bit of a variable so that i can assign a particular value to an internal variable based on whether the variable status is valid or not. the VB script i am using is written below: (here DI and Test are analog modbus driver variables and VBA is an internal variable of type UINT)
Public Sub test()
Dim i, j, k As Variable
Dim l As Long
Set i = thisProject.Variables.Item("DI")
Set j = thisProject.Variables.Item("Test")
Set k = thisProject.Variables.Item("VBA")
l = thisProject.Variables.Item("DI").StatusValue
'DI1=open and DI2=close
If (l = H0x00040000) Then
k.Value = 5
ElseIf (i.Value = 0 And j.Value = 0) Then
k.Value = 0
ElseIf (i.Value = 0 And j.Value = 1) Then
k.Value = 1
ElseIf (i.Value = 1 And j.Value = 0) Then 'Set thisProject.Variables.Item("VBA").Value= k.Value
End If
End Sub
But this is not working when the variable is invalid. How can i access the invalid bit of the variable?