Rockwell Automation 1785-Vx0B, D17856.5.9 PLC-5 VME VMEbus Programmable Controllers User Manual User Manual

Page 235

Advertising
background image

Sample API Modules

Appendix B

B-77

/*****************************************************************************
*
* PURPOSE: This function adds an system address and its corresponding
* AND and OR masks to a data structure which will then be used
* by the plc540v_pccc_rmw() function. It it imperative that
* this data structure be initialized prior to using this
* function by calling plc540v_init_addrmasks().
*
* UWORD arrayOffset contains the index into the array. Since
* we are using C arrays, this value is within the range of
* 0 <= x < kPLC540V_MAX_RMW_ADDRMASKS.
*
* UWORD fileNumber is the data table file number that we will
* be accessing for the read-modify-write operation.
*
* UWORD elementNumber is the data table file’s element number
* that we will be accessing for the read-modify-write operation.
*
* UWORD andMask contains the AND mask which will be used on the
* value read from the data table file’s element. A zero in the
* AND mask resets the corresponding bit in the addressed word to
* zero. A one in the AND mask leaves the corresponding bit
* unchanged.
*
* UWORD orMask contains the OR mask which will be used on the
* value read from the data table file’s element. A one in the
* OR mask sets the corresponding bit in the addressed word to
* one. A zero in the OR mask leaves the corresponding bit
* unchanged.
*
* PLC540V_RMW_ADDRMASKS_TYPE addrMasks contains system
* addresses and their corresponding AND and OR masks.
* This structure MUST be initialized by calling
* plc540v_init_addrmasks() function before using it
* with this function.
*
* OUTPUT: PLC540V_STATUS_TYPE *status will contain the final status
* of requesting this function. This status could be and EPC
* or PLC-5/40V value.
*
* RETURNS: Nothing.
*
* EXAMPLE:
* PLC540V_STATUS_TYPE status;
* PLC540V_RMW_ADDRMASKS_TYPE addrMasks;
* register int addrCount = 0;
* UWORD fileNumber = 7;
* UWORD elementNumber = 20;
* UWORD andMask = 0xFF00;
* UWORD orMask = 0x00AA;
* plc540v_init_addrmasks(addrMasks);
* for (addrCount=0; addrCount<5; addrCount++,elementNumber++)

Advertising