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

Page 139

Advertising
background image

Appendix A

Sample Applications

A-17

/***************************************************************************/
/******************************* MAINLINE **********************************/
/***************************************************************************/

/*****************************************************************************
*
* PURPOSE: This is the main function for the upload demonstration
* program. This program implements the algorithm to
* successfully save the entire processor memory of the
* PLC-5/40V to a disk file on the Radisys EPC-4. Please
* note that this implementation will also save the current
* port configurations so they can be restored as part of
* the physical restore procedure.
*
* INPUT: You must supply a filename on the command line. This name
* will be used for the output file which is created on the
* Radisys EPC-4. If the file already exists, it will be
* overwritten without any warning!
*
* OUTPUT: When this program exits to the shell (under normal and error
* conditions), it will have created the output file which was
* specified on the command line.
*
* RETURNS: This program will return 1 to the DOS shell if there is an
* error and 0 if the program completed normally.
*
* EXAMPLE: upload procmem.sav <CR>
*
* where:
* procmen.sav is the output file
* <CR> is a carrage return
*
* BUILD ENVIRONENT:
*

Borland C++ 3.0 compiler

*

Use the UPLOAD.MAK makefile to build the executable.

*
* EDIT HISTORY:
*
* Copyright Allen-Bradley Company, Inc. 1994
*
****************************************************************************/

main(int argc, char *argv[])
{

// The segment pointers
unsigned short physicalReadCount = 0;
unsigned short finalPhysicalReadSize = 0;
unsigned long segmentSize = 0L;
unsigned long readAddr = 0L;
unsigned long endPointer = 0L;

// The reply packet from the physical bytes read
PLC540V_PCCC_ULA_RPY_TYPE replyPacket;

// Loop counter
register int i;

// The output file pointer
FILE *out;

// Validate the command line...
if (argc != 2)
{

printf(”\nUSAGE: upload save_file_name”);
exit(1);

}

Advertising