Write

(VTSDriver Library)

Description: Used by a tag to create a write request to a driver address.
Returns:

Object value of underlying write module if called on a Server. Returns Invalid when called on the client.

Usage: Script Only.
Function Groups: String and Buffer,  Stream and Socket
Related to: AddRead
Format: …\Driver\Write(Address, N, Val[, DType, TagName, Success])
Parameters:  
Address    
Required. The starting address to write the data to.
N   
Required. The number of elements to write.
Val   
Required. The data to be written. If Val is a single value or a statically-declared array, it should be preceded by a pointer reference (&). Do not use the pointer reference if passing a dynamically-declared array of values.
DType   
No longer used. Was: the data type to be written to the I/O device.
TagName   
The name of the tag that is writing the data.
Success  

Pointer to a Boolean, used to pass success/fail information.

Success is not set if Write is called on a client.

Comments:

Allows the writing of a specific address on demand. The resulting data will be sent only to the requesting machine.

Write returns Invalid when called on the client. Only when running on the server does it return an object that can be used to tell if the write is done.

The object value of the underlying read module is returned from the function. When the write finishes, the returned object’s value will go to Invalid, signaling the end of the write operation.

Example:

{ Simple variable example - writes a value of 12 to address 49500 }

WriteData = 12;
\Root\Driver\Write(49500, 1, &WriteData, Invalid(), Invalid(), &Success);

{ Multi-variable (array) example - writes 12, 14, 30123 to addresses 40001, 40002, & 40003 respectively }

WriteData = New(3);
WriteData [0] = 12;
WriteData [1] = 14;
WriteData [2] = 30123;
\Root\Driver\Write(40001, 3, WriteData, Invalid(), Invalid(), &Success);