ncWriteDnetIO (Write DeviceNet I/O)
Write output data to an I/O Object.
ncWriteDnetIO( NCTYPE_OBJH ObjHandle, NCTYPE_UINT32 SizeofData, NCTYPE_ANY_P Data);
|ObjHandle||Object handle of an open I/O Object|
|SizeofData||Size of Data buffer in bytes (C only)|
ncWriteDnetIO writes output data to an NI-DNET I/O Object.
Since each I/O Object continuously produces output data onto the DeviceNet network at a specified rate, calling ncWriteDnetIO multiple times for each output message is redundant and can often waste valuable processor time. To synchronize calls to ncWriteDnetIO with each output message, you can wait for input data (see ncReadDnetIO), or if no input data exists for the device, you can use an idle wait (such as wait for 10 ms).
The output data bytes passed to ncWriteDnetIO are normally sent to the output assembly of a remote DeviceNet slave device. The format of this output assembly is normally documented either by the device vendor or within the DeviceNet Specification itself.
The bytes of a device's output assembly often consist of multiple data members rather than a single value. For C, you can often place each data member into the output bytes by using typecasting. For LabVIEW, you can often place each data member into the output bytes using the ncConvertForDnetWrite function. For more information on output assemblies and how to place individual data members into the output bytes, refer to the NI-DNET User Manual.
|Description||ObjHandle must contain an object handle returned from ncOpenDnetIO. In LabVIEW, ObjHandle passes through the VI as an output so that it can be used for subsequent function calls for the object.|
|Values||The encoding of ObjHandle is internal to NI-DNET.|
|Description||For C, SizeofData is the size of the buffer referenced by Data. It is used to verify that the Data buffer is large enough to hold the output bytes. This size is normally obtained using the C language sizeof function and has no direct relation to the number of bytes produced on the network.|
For LabVIEW, since Data is obtained directly as an input, this size is not needed.
The actual number of bytes produced on the I/O connection is determined by the OutputLength parameter of ncOpenDnetIO and not this size.
|Values||sizeof (buffer referenced by Data)|
|Description||Output data. The format of these output bytes is specific to your DeviceNet device.|
|Values||Output data bytes|
Write 4 output bytes to an I/O Object.
Write 10 output bytes to the I/O Object referenced by objh.
NCTYPE_STATUS status; NCTYPE_OBJH objh; NCTYPE_UINT8 output; status = ncWriteDnetIO(objh, 10, output);