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

Page 143

Advertising
background image

Appendix A

Sample Applications

A-21

else
{

if (replyPacket.plcStatus.keyswitchMode!=kPLC540V_REMOTE_PROGRAM_LOAD)
{
printf(”\nPLC is not in remote program mode.”);
printf(”\n\tAttempting to change its mode to program load...”);
plc540v_pccc_set_cpu_mode(kvmeSlaveAddress,

kplc540vUla,
kVME_D16_DATA_WIDTH,
kVME_A24_ADDR_SPACE,
ctlMode,
&scmReplyPacket,
&status);

if (status.plc540vStatus != 0)
{

printf(” FAILED”);
exit(1);

}
else

printf(” OK...”);

}

}
}

/***************************************************************************/
/**************************** CHECK_FOR_FAULTS *****************************/
/***************************************************************************/
void check_for_faults(void)
{
// This function will check the processor for any faults.

PLC540V_PCCC_IHAS_RPY_TYPE replyPacket;
PLC540V_STATUS_TYPE status;

plc540v_pccc_id_host_and_status(kvmeSlaveAddress,

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

if (status.plc540vStatus != 0)
{

printf(”\nChecking the PLC for faults failed.”);
exit(1);

}
else
{

// Check for major faults...
if (replyPacket.plcStatus.majorFault != 0)
{
printf(”\nProcessor has major faults so we cannot continue.”);
exit(1);
}

// Check for bad RAM...
if (replyPacket.plcStatus.ramInvalid != 0)
{
printf(”\nProcessor has bad RAM so we cannot continue.”);
exit(1);
}

}
}

Advertising