beautypg.com

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

Page 147

background image

Appendix A

Sample Applications

A-25

// Save this read address in the file packet
filePacket.plcAddress = readAddr;

// Save this read length in the file packet
filePacket.plcDataLength = readSize;

// Save the plc data into the file packet
memmove((char *) &filePacket.plcData,

(char *) &replyPacket.data[0],
readSize);

fwrite((char *) &filePacket, 1, sizeof(FILE_PACKET_TYPE), out);

}

}

/***************************************************************************/
/************************** UPLOAD_IS_COMPLETE *****************************/
/***************************************************************************/
void upload_is_complete(void)
{
// Tell the processor that the upload is now completed.

PLC540V_PCCC_ULC_RPY_TYPE replyPacket;
PLC540V_STATUS_TYPE status;

plc540v_pccc_upload_complete(kvmeSlaveAddress,

kplc540vUla,
kVME_D16_DATA_WIDTH,
kVME_A24_ADDR_SPACE,
&replyPacket,
&status);

if(status.plc540vStatus != 0)
{

printf(”\nUpload Complete command failed.”);
exit(1);

}
}

/***************************************************************************/
/****************************** UPLOAD_ALL *********************************/
/***************************************************************************/
void upload_all(PLC540V_PCCC_ULA_RPY_TYPE *replyPacket)
{
// Issue the upload all request.

PLC540V_STATUS_TYPE status;

plc540v_pccc_upload_all(kvmeSlaveAddress,

kplc540vUla,
kVME_D16_DATA_WIDTH,
kVME_A24_ADDR_SPACE,
replyPacket,
&status);

if(status.plc540vStatus != 0)
{

printf(”\nUpload All command failed.”);
exit(1);

}
}