Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 1049 -
------------------------------------------------------------------------------
4. Convert pointer to linear address <Main,Alarm,Comm,HILEV>
------------------------------------------------------------------------------
[Name]
ptrtoadd
[Syntax]
#include <hilev.h>
unsigned long ptrtoadd( void *ptr ) ;
[Arguments]
ptr Pointer.
[Return]
Returns a linear address converted from a pointer.
[Description]
Returns a linear address of memory area which pointed by the
specified pointer.
This function is used to get a linear address that is specified as
an argument of "Call CNC window" function ("cnc_window").
You can specify any arbitrary pointer (except "NULL") as "ptr".
[Example]
The following program reads load information of the 1st spindle motor.
int example( void )
{
int spload ;
unsigned int iodata[10] ;
iodata[0] = 260 ;
iodata[2] = 2 ;
*(long *)&iodata[3] = 1 ;
iodata[5] = 0 ;
*(long *)&iodata[6] = 0 ;
*(unsigned long *)&iodata[8] = ptrtoadd( &spload ) ;
cnc_window( iodata ) ;
return ( spload ) ;
}