ProSoft Technology MVI69-ADM User Manual
Page 308

Side-Connect API Library Functions
MVI-ADM ♦ 'C' Programmable
Developer's Guide
'C' Programmable Application Development Module
Page 308 of 342
ProSoft Technology, Inc.
February 20, 2013
MVIsc_WritePLC
Syntax
int MVIsc_WritePLC(HANDLE handle, void *buf, WORD fileno, WORD elemno, WORD
subelemno, WORD size, WORD datatype, int fsync);
Parameters
handle
Handle returned by previous call to MVIsc_Open
buf
Pointer to user data buffer which contains data to be written to
the PLC-5
fileno
PLC-5 data table file number
elemno
PLC-5 data table element number
subelemno
PLC-5 data table subelement number
size
Number of data items of type datatype to be written
datatype
Type of data item being written
fsync
Synchronization flag. Must be set to MVISC_SYNC_ACCESS or
MVISC_ASYNC_ACCESS.
Description
MVIsc_WritePLC writes size data items of type datatype from buf to the PLC-5
data table file specified by fileno. elemno specifies the element number of the
data table file to begin writing. subelemno is used to address structured data. It
specifies the offset to a particular data item within a multi-word data structure,
such as a PID structure. For simple data files such as integer or float, subelemno
must be set to zero; otherwise, no data will be written an
MVISC_ERR_XFERFAIL will be returned. subelemno is specified as the word
offset within the data structure.
Note: For convenience, sub-element definitions for each of the data items within the various PLC-5
data structures are provided in the API include file MVISCAPI.H.
fsync specifies whether the access is synchronous or asynchronous with respect
to the PLC-5 ladder scan. When set to MVISC_SYNC_ACCESS, the transfer will
take place at the end of the next ladder scan. When set to
MVISC_ASYNC_ACCESS, the transfer will take place immediately. This flag
only has effect when the PLC-5 is in Run mode. Online handle must be a valid
handle returned from MVIsc_Open.