Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 597 -
------------------------------------------------------------------------------
2.4 Write data to extended keep memory. <Main,Alarm>
------------------------------------------------------------------------------
[Name]
pmc_wrkpm
[Syntax]
#include <data.h>
#include <fwindow.h>
int pmc_wrkpm( unsigned long offset, char *data,
unsigned int length ) ;
[Arguments]
offset Start offset.
data Output 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]
Writes 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 written in "length".
Store the data to be written in "data" with the same format as PMC.
The data stored in "data" are transferred to the PMC's memory.
[Example]
The following program clears the PMC's extended keep memory within the
specified range by "0".
#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 ;
unsigned char *buf ;
buf = (unsigned char *)calloc( size, 1 ) ;
ret = pmc_wrkpm( offset, buf, size ) ;
if ( !ret )
printf( "Successfully cleared.\n" ) ;
else
printf( "ERROR!(%d)\n", ret ) ;
free( buf ) ;
return ( ret ) ;