Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 595 -
------------------------------------------------------------------------------
2.3 Read data from extended keep memory. <Main,Alarm>
------------------------------------------------------------------------------
[Name]
pmc_rdkpm
[Syntax]
#include <data.h>
#include <fwindow.h>
int pmc_rdkpm( unsigned long offset, char *data,
unsinged int length ) ;
[Arguments]
offset Start offset.
data Input buffer.
length Data length.
[Return]
0 Successful.
2 Incorrect data length "length".
3 Incorrect start offset "offset".
6 The extended keep memory is unavailable.
[Description]
Reads the contents of the extended keep memory of PMC within the
specified range.
Specify the offset address from the top of the extended keep memory in
byte unit in "offset".
Specify the byte size of data to be read in "length".
The read data are stored in "data" with the same format as PMC.
[Example]
The following program reads the contents of the extended keep memory
of PMC within the specified range, and displays them.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
/* offset is start offset address to be read. */
/* size is byte size. */
int example( unsigned long offset, unsigned int size )
{ int ret, idx ;
unsigned char *buf ;
buf = (unsigned char *)malloc( size ) ;
ret = pmc_rdkpm( offset, buf, size ) ;
if ( !ret ) {
for ( idx = 0 ; idx < size ; idx++ )
printf( "%03u ", buf[idx] ) ;
putchar( '\n' ) ;
}
else
printf( "ERROR!(%d)\n", ret ) ;
free( buf ) ;
return ( ret ) ;