Value

<< Click to Display Table of Contents >>

 

Value

Variant Updated whenever a new valid reading from a device is performed, using N1 to N4 parameter configuration. Data type of this variable (integer, floating point, or text) depends on the Driver to which the Tag is associated and its configuration.

This property is only updated this way if the AllowRead property 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 simply setting a new value to the Value property or to some of the bits from Bit00 to Bit31 properties. In this case, the AllowWrite property must be set to True.

This is also I/O Tag's default property. Therefore, a reference by value to an I/O Tag does not need to explicit the Value property to access its value. 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 performed in a different way,
  'with no need to show Value property, which is default
  MsgBox " Tag1's current value: " & obj
End Sub

 

NOTE

Bit values (Bit00 to Bit31 properties) are not affected by adjustments in the scale, that is, they represent the bits from the value read by a device before conversion.

Was this page useful?