Appendix b – Rockwell Automation 1785-Vx0B, D17856.5.9 PLC-5 VME VMEbus Programmable Controllers User Manual User Manual
Page 229
Sample API Modules
Appendix B
B-71
* 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;
* UBYTE dataLength;
* PLC540V_PCCC_RBP_RPY_TYPE reply;
* PLC540V_STATUS_TYPE status;
* void plc540v_pccc_read_bytes_physical(
* vmeCmdBlkAddr,
* baseAddress,
* width,
* addrMod,
* plcAddress,
* dataLength,
* &reply,
* &status);
*
* Copyright Allen–Bradley Company, Inc. 1993
*
****************************************************************************/
void plc540v_pccc_read_bytes_physical(
ULONG vmeCmdBlkAddr,
UWORD baseAddress,
VME_DATA_WIDTH_TYPE width,
VME_ADDRESS_MODIFIER_TYPE addrMod,
ULONG plcAddress,
UBYTE dataLength,
PLC540V_PCCC_RBP_RPY_TYPE *reply,
PLC540V_STATUS_TYPE *status)
{
/* The Read Bytes Physical command packet. */
PLC540V_PCCC_RBP_CMD_TYPE cmdPacket;
/* Let’s initialize these packets to nothing. */
memset((char *) &cmdPacket, 0x0, kPLC540V_PCCC_RBP_CMD_SIZE);
memset((char *) reply, 0x0, kPLC540V_PCCC_RBP_RPY_SIZE);
memset((char *) status, 0x0, sizeof(PLC540V_STATUS_TYPE));
/* Let’s establish the command packet contents... Note that
since we set this block with zeros originally, we don’t
need to explicitly set them here.
*/
cmdPacket.cmd = kPLC540V_PCCC_RBP_CMD;
cmdPacket.fnc = kPLC540V_PCCC_RBP_FNC;
cmdPacket.addr = plcAddress;
cmdPacket.size = dataLength;
plc540v_send_pccc_command(
vmeCmdBlkAddr,
&cmdPacket,
kPLC540V_PCCC_RBP_CMD_SIZE,
reply,
kPLC540V_PCCC_RBP_RPY_SIZE,
baseAddress,
kVME_NO_INT_LEVEL,
0,
width,
addrMod,
status);
}