Tag access functions – ProSoft Technology MVI56E-LDM User Manual
Page 116

CIP API Functions
ControlLogix Platform ♦ "C" Programmable
Developer's Manual
Linux Application Development Module
Page 110 of 264
ProSoft Technology, Inc.
March 12, 2014
5.6
Tag Access Functions
The API functions in this section can be used to access tag data withing
ControlLogix controllers. The prototypes for most of these functions and their
associated data structure definitions can be found in the header file
OCXTagDb.h.
The tag access functions that include "Db" in the name are for use with a valid
tag database (see OCXcip_BuildTagDb).
OCXcip_AccessTagData
Syntax
int OCXcip_AccessTagData (OCXHANDLE apihandle,
char * pPathStr,
WORD rspTimeout,
OCXCIPTAGACCESS * pTagAccArr,
WORD numTagAcc );
Parameters
apihandle
handle returned by previous call to OCXcip_Open
pPathStr
Pointer to NULL terminated device path string
rspTimeout
CIP response timeout in milliseconds
pTagAccArr
Pointer to array of pointers to tag access definitions
numTagAcc
Number of tag access definitions to process
Description
This function efficiently reads and/or writes a number of tags. As may operations
as will fit will be combined into a single CIP packet. Multiple packets may be
required to process all of the access requests
pTagAccArr
is a pointer to an array of pointers to
OCXCIPTAGACCESS
structures.
numTagAcc
is the number of pointers in the array.
The
OCTCIPTAGACCESS
structure is show in the following example:
typedef struct tagOCXCIPTAGACCESS
{
char * tagName; //tag name (symName[x,y,z].mbr.mbr [x].etc)
WORD daType; //Data type code
WORD eleSize; //Size of one data element
WORD opType; //Read/Write operation type
WORD numEle; //Number of elements to read or write
void * data; //Read/Write data pointer
void * wrMask; //Pointer to write bit mask data, NULL if none
int result; // Read/Write operation result
} OCXCIPTAGACCESS
tagName
Pointer to tag name string (
symName[x,y,z].mbr[x].etc
). All
array indices must be specified except the last set of
brackets. If the last set is omitted, the indices are assumed
to be zero.