ProSoft Technology MVI69-ADM User Manual
Page 276

CIP Messaging Library Functions
MVI-ADM ♦ 'C' Programmable
Developer's Guide
'C' Programmable Application Development Module
Page 276 of 342
ProSoft Technology, Inc.
February 20, 2013
MVIcip_ReadConnected
Syntax
int MVIcip_ReadConnected(MVIHANDLE handle, MVIHANDLE connHandle, BYTE
*dataBuf, WORD offset, WORD dataSize );
Parameters
handle
handle returned by previous call to MVIcip_Open
connHandle
handle of open connection
dataBuf
pointer to buffer to receive data
offset
offset of byte to begin reading
dataSize
number of bytes to read
Description
This function is used by an application read data being received on the open
connection specified by connHandle.
handle must be a valid handle returned from MVIcip_Open. connHandle must be
a handle passed by the connect_proc callback function. offset is the offset into
the connected data buffer to begin reading. dataBuf is a pointer to a buffer to
receive the data. dataSize is the number of bytes of data to be read.
Notes: When a connection has been established with a ControlLogix controller, the first 4 bytes of
received data are processor status and are automatically set by the controller. The first byte of data
appears at offset 4 in the receive data buffer.
A Run/Idle status word is appended when the communication format is one of the "Data-xxx" types.
This status word is not used for "Input Data-xxx" types or status connections. Only the least
significant bit of the word is used. All other bits are reset to 0. When set to 1 (run), the bit signals
the module to activate its I/O. When reset to 0, it signals the module to deactivate I/O (idle state).
The Run/Idle bit can be set only when the processor is in Run mode.
The bit is reset when the ControlLogix processor:
goes into a major fault state
is in program mode
is in test mode
The MVIcip_ReadConnected function can only be used if the rxdata_proc callback function pointer
was set to NULL in the call to MVIcip_RegisterAssemblyObject().
Return Value
MVI_SUCCESS
data was read successfully
MVI_ERR_NOACCESS
handle does not have access
MVI_ERR_BADPARAM
connHandle or dataSize is invalid
MVI_ERR_INVALID
an rxdata_proc callback has already been registered, see
MVIcp_RegisterAssemblyObject()."
Example
MVIHANDLE handle;