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

Page 201

Advertising
background image

Sample API Modules

Appendix B

B-43

/* Let’s retrieve the reply packet. */
status->epcStatus=EpcFromVmeAm((BM_MBO|A24SD),

BM_W8,
vmeReplyPacketAddr,
(char far *) pcccReplyPacket,
pcccReplyPacketSize);

if (status->epcStatus != EPC_SUCCESS)
{
/* Signal that we have an EPC error. */
status->plc540vStatus =

kPLC540V_GET_REPLYBLK_FROM_VME_FAILED;

status->statusCategory = kEPC_STATUS;
}

}
}
else
{

/* Signal that we have an EPC error. */
status->plc540vStatus = kPLC540V_COPY_CMDBLK_TO_VME_FAILED;
status->statusCategory = kEPC_STATUS;

}

}
else
{

/* Signal that we have an EPC error copying the PCCC packet to VME.*/
status->plc540vStatus = kPLC540V_COPY_PCCC_PACKET_TO_VME_FAILED;
status->statusCategory = kEPC_STATUS;

}
}

#ifndef P40VWBP_H
#define P40VWBP_H 1

///////////////////////////////////////////////////////////////////////////////
// Definitions for the PCCC WRITE BYTES PHYSICAL COMMAND AND REPLY PACKETS //
///////////////////////////////////////////////////////////////////////////////

#include ”p40vspcc.h”

#pragma pack(1)
/***************************************************************************/
/************************ INTEL VERSION OF DEFINITIONS *********************/
/***************************************************************************/

// The maximum number of bytes which can be written in one operation.
#define kPLC540V_PCCC_MAX_WBP_DATA 238
typedef UBYTE PLC540V_PCCC_WBP_DATA_TYPE[kPLC540V_PCCC_MAX_WBP_DATA];

/* The PCCC Write Bytes Physical command packet structure. */
typedef struct
{
UBYTE reserved[4];
UBYTE cmd;
UBYTE sts;
UWORD tns;
UBYTE fnc;
ULONG addr;
PLC540V_PCCC_WBP_DATA_TYPE data;
} PLC540V_PCCC_WBP_CMD_TYPE;
#define kPLC540V_PCCC_WBP_CMD_SIZE (sizeof(PLC540V_PCCC_WBP_CMD_TYPE))

P40VWBP.H

Advertising