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 I/O Block Element is inserted, and considering its position on the table read from the Index property. Data type of this variable, such as integer, floating point, or text, depends on the I/O Driver to which the I/O Block 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 I/O Block 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 an I/O 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. The default value of this property is empty. The next script contains an example of using this script.

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?