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

Page 206

Advertising
background image

Sample API Modules

Appendix B

B-48

* UWORD baseAddress contains the base address of the
* PLC-5/40V.
*
* 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.
*
* PLC540V_PCCC_APC_RPY_TYPE reply contains PCCC’s Apply Port
* Configuration 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;
* PLC540V_PCCC_APC_RPY_TYPE reply;
* PLC540V_STATUS_TYPE status;
* void plc540v_pccc_apply_port_config(
* vmeCmdBlkAddr,
* baseAddress,
* width,
* addrMod,
* &reply,
* &status);
*
* Copyright Allen-Bradley Company, Inc. 1993
*
****************************************************************************/
void plc540v_pccc_apply_port_config(

ULONG vmeCmdBlkAddr,
UWORD baseAddress,
VME_DATA_WIDTH_TYPE width,
VME_ADDRESS_MODIFIER_TYPE addrMod,
PLC540V_PCCC_APC_RPY_TYPE *reply,
PLC540V_STATUS_TYPE *status)

{
/* The Apply Port Configuration command packet. */
PLC540V_PCCC_APC_CMD_TYPE cmdPacket;

/* Let’s initialize these packets to nothing. */
memset((char *) &cmdPacket, 0x0, kPLC540V_PCCC_APC_CMD_SIZE);
memset((char *) reply, 0x0, kPLC540V_PCCC_APC_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_APC_CMD;
cmdPacket.fnc = kPLC540V_PCCC_APC_FNC;

Advertising