Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 600 -
------------------------------------------------------------------------------
2.6 Get pointer to extended keep memory. <Main,Alarm>
------------------------------------------------------------------------------
[Name]
pmc_kpmgetptr
[Syntax]
#include <data.h>
#include <fwindow.h>
int pmc_kpmgetptr( void **ptr, unsigned long *size ) ;
[Arguments]
ptr Pointer to the extended keep memory area.
size Byte size of the extended keep memory.
[Return]
0 Successful.
2 No free local descriptor for the user program.
6 The extended keep memory is unavailable.
[Description]
Gets the pointer to the extended keep memory area.
This function stores the pointer to the extended keep memory in "ptr",
and the size of the extended keep memory in "size". When the extended
keep memory is unavailable, it returns NULL as pointer and 0L as size.
The user application program can read or write directly arbitrary data
from/to the extended keep memory using the pointer this function
returns.
This function comsumes one local descriptor at one call. The number
of the available local descriptor for each task of C executor is about
200. The local descriptors may be exhausted if the user application
program calls this function many times repeatedly. This function
returns the same pointer each time even if this is called many times.
Therefore, call this function at the initialization procedure for each
task, store the result in the global variables and use the global
variables in various procedures.
[Example]
The following program displays the 10 btypes of byte-data stored in
the 100th-byte of the extended keep memory.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
void example( void )
{
char *ptr ;
unsigned long size ;
unsigned int idx ;
pmc_kpmgetptr( &ptr, &size ) ;
for ( idx = 0 ; idx < 10 ; idx++ )
printf( "%4d ", *(ptr+idx) ) ;