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

Page 203

Advertising
background image

Sample API Modules

Appendix B

B-45

* VME_DATA_WIDTH_TYPE width contains the data width that
* should be used for the copy operations. It can be D16
* or D08.
*
* VME_ADDRESS_MODIFIER_TYPE addrMod defines the address space
* in which the VME data is accessed. It can be A16 or A24.
*
*

ULONG plcAddress contains the physical address to write to

*

in the processor.

*
*

PLC540V_PCCC_WBP_DATA_TYPE data contains the data to write

*

to the processor.

*
*

UBYTE dataLength contains the number of bytes to write.

*
* PLC540V_PCCC_WBP_RPY_TYPE reply contains PCCC’s Write Bytes
* Physical command specific reply packet.
*
* 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:
* ULONG vmeCmdBlkAddr = 0xE0F100;
* UWORD baseAddress = 0XFC00;
* VME_DATA_WIDTH_TYPE width = kVME_D16_DATA_WIDTH;
* VME_ADDRESS_MODIFIER_TYPE addrMod = kVME_A24_ADDR_SPACE;
*

ULONG plcAddress;

*

PLC540V_PCCC_WBP_DATA_TYPE data;

*

UBYTE dataLength;

* PLC540V_PCCC_WBP_RPY_TYPE reply;
* PLC540V_STATUS_TYPE status;
* void plc540v_pccc_write_bytes_physical(
* vmeCmdBlkAddr,
* baseAddress,
* width,
* addrMod,
* plcAddress,
*

data,

* dataLength,
* &reply,
* &status);
*
* Copyright Allen–Bradley Company, Inc. 1993
*
****************************************************************************/
void plc540v_pccc_write_bytes_physical(

ULONG vmeCmdBlkAddr,
UWORD baseAddress,
VME_DATA_WIDTH_TYPE width,
VME_ADDRESS_MODIFIER_TYPE addrMod,
ULONG plcAddress,
PLC540V_PCCC_WBP_DATA_TYPE data,
UBYTE dataLength,
PLC540V_PCCC_WBP_RPY_TYPE *reply,
PLC540V_STATUS_TYPE *status)

{
/* The Write Bytes Physical command packet. */
PLC540V_PCCC_WBP_CMD_TYPE cmdPacket;

/* Let’s initialize these packets to nothing. */
memset((char *) &cmdPacket, 0x0, kPLC540V_PCCC_WBP_CMD_SIZE);
memset((char *) reply, 0x0, kPLC540V_PCCC_WBP_RPY_SIZE);
memset((char *) status, 0x0, sizeof(PLC540V_STATUS_TYPE));

Advertising