Value

<< Click to Display Table of Contents >>

 

Value

Variant Updated whenever a new valid reading from a device is performed, using N1 to N4 configuration of the I/O Block where this Element is inserted, and considering its position on the table read from the Index property. Data type of this variable (integer, floating point, or text) depends on the Driver to which the Element is associated and its configuration.

This property is only updated this way if the AllowRead property of the I/O Block to which this Element is linked is set to True, and when there are no communication errors (in this case, the Quality and TimeStamp properties are updated), according to a scan time defined in the Scan property. Another way to use this property is to write values to a device, by setting a new value to the Value property or to some of the bits from Bit00 to Bit31. In this case, the I/O Block's AllowWrite property must be set to True.

This is also I/O Block Element's default property. Therefore, a reference by value to a Block Element does not need to explicit the Value property to access this value. If this property is not being updated, check if the Index property is correctly configured. Default value of this property is empty (no value). Example:

Sub Button1_Click()
  ' Accesses a tag and shows current value
  ' tag1 is an I/O tag
  Set obj = Application.GetObject("IODriver1.tag1")
  MsgBox "Tag1's current value: " & obj.Value
  'This can also be done in a different way,
  'with no need to show Value property, which is default
  MsgBox " Tag1's current value: " & obj
End Sub

Was this page useful?