WriteEx

<< Click to Display Table of Contents >>

 

WriteEx

WriteEx([Value], [Timestamp], [Quality], [WriteStatus], [WriteSyncMode])

Writes a value to a device. All its parameters are optional and, if omitted, this method's behavior is the same as the Write method. This method returns a Boolean indicating whether the operation was successful or not. The Value parameter defines the value to write to the I/O Driver. Data type depends on the I/O Driver and, if omitted, I/O Tag's current value is assumed. The Timestamp parameter specifies a date and time to write to the I/O Tag, if supported by the device. If omitted, assumes the date and time from the moment of the writing operation. The Quality parameter indicates a quality, from 0 (zero) to 255. If omitted, assumes a Good (192) quality. The WriteStatus parameter receives a value returned by the I/O Driver, indicating its writing status, if supported, according to its own documentation. The WriteSyncMode parameter allows users to use a writing mode that may be different from the one used in the I/O Driver. The available options for this parameter are 0: Writing mode configured in the I/O Driver, 1: Synchronous writing mode, or 2: Asynchronous writing mode (no confirmation).

If the WriteSyncMode parameter is omitted, the writing mode configured in the I/O Driver is also used. Example:

Sub Tag1_OnRead()
  ' Use WriteEx to transfer values from one driver to another
  Application.GetObject("Driver2.Tag")._
    WriteEx Value, TimeStamp, Quality
End Sub

Was this page useful?