P40vwbp.c, B-44 – Rockwell Automation 1785-Vx0B, D17856.5.9 PLC-5 VME VMEbus Programmable Controllers User Manual User Manual

Page 202

Advertising
background image

Sample API Modules

Appendix B

B-44

/* The PCCC Write Bytes Physical reply packet structure. */
typedef struct
{
UBYTE lnhHi;
UBYTE lnhLo;
UBYTE reserved[4];
UBYTE cmd;
UBYTE sts;
UWORD tns;
UBYTE extsts;
} PLC540V_PCCC_WBP_RPY_TYPE;
#define kPLC540V_PCCC_WBP_RPY_SIZE (sizeof(PLC540V_PCCC_WBP_RPY_TYPE))
#pragma pack()

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);
#endif

#include <stdio.h>
#include <stdlib.h>
#include <mem.h>
#include ”epc_obm.h”
#include ”epc_err.h”
#include ”busmgr.h”
#include ”p40vwbp.h”

/***************************************************************************/
/************************* PRIVATE DEFINITIONS ****************************/
/***************************************************************************/
#define kPLC540V_PCCC_WBP_CMD 0x0F
#define kPLC540V_PCCC_WBP_FNC 0x18

/***************************************************************************/
/************************* PRIVATE TYPE DEFINITIONS ************************/
/***************************************************************************/

/***************************************************************************/
/*************************** PRIVATE FUNCTIONS *****************************/
/***************************************************************************/

/*****************************************************************************
*
* PURPOSE: This function sends the PCCC Write Bytes Physical command to
* the PLC–5/40V.
*
* INPUT: ULONG vmeCmdBlkAddr contains the VME address where the
* command block will be copied to so the PLC–5/40V can
* access its information.
*
* UWORD baseAddress contains the base address of the
* PLC–5/40V.
*

P40VWBP.C

Advertising