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

Page 171

Advertising
background image

Sample API Modules

Appendix B

B-13

/*****************************************************************************
*
* PURPOSE: This function will transmit notification of a new command
* block awaiting processing by the PLC-5/40V. Prior to calling
* this function, the programmer must copy the command block
* into VME memory.
*
* INPUT: ULONG baseAddress contains the base address of the PLC-5/40V.
*
* ULONG vmeCmdBlkAddr contains the VME address of the command
* block.
*
* VME_ADDRESS_MODIFIER_TYPE addrSpace contains an indicator
* as to which address space contains the command block.
*
* 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 baseAddress = 0xFC00;
* ULONG vmeCmdBlkAddr = 0x80000;
* VME_ADDRESS_MODIFIER_TYPE addrSpace = kVME_A24_ADDR_SPACE;
* PLC540V_STATUS_TYPE *status;
* plc540v_send_cmd(baseAddress,
* vmeCmdBlkAddr,
* addrSpace,
* &status);
*
* Copyright Allen-Bradley Company, Inc. 1993
*
****************************************************************************/
void plc540v_send_cmd(ULONG baseAddress,

ULONG vmeCmdBlkAddr,
VME_ADDRESS_MODIFIER_TYPE addrSpace,
PLC540V_STATUS_TYPE *status)

{
/* The command word. */
ULONG command = 0;

/* The value read from the command control register. */
UWORD cmdctlReg = 0;

/* Let’s initialize the status variable to success. */
memset((char *) status, 0x0, sizeof(PLC540V_STATUS_TYPE));

/* Build the command word. */
if (addrSpace == kVME_A24_ADDR_SPACE)

command = 0x00000000L | (vmeCmdBlkAddr & 0x00FFFFFFL);

else

command = 0x01000000L | (vmeCmdBlkAddr & 0x0000FFFFL);

Advertising