Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 481 -
[Description]
Writes the macro executor variable (P-code macro variable) data within
the specified range.
Specify the start custom macro variable number in "buf.datano_s"
and the end one in "buf.datano_e" with binary format.
Store the variable data to be written in both
"buf.pm_r[i].p6_r.mcr_val" and "buf.pm_r[i].p6_r.dec_val".
The formats of "mcr_val" and "dec_val" are same as ones of "Write
P-code macro variable(cnc_wrpmacro)". See description of
"cnc_wrpmacro". But "void" value can not be written by this function.
(only FS16/18-B, "void" can be written in FS16/18-C or later.)
Also expanded P-code macro variables (after #20000) which are used
as fixed integer are written as floating point variables.
The window internal routine converts floating format into fixed
integer format.
This function can write only P-code macro variables whose number are
equal to or more than 10000.
"pr_m[i].p2_r.mcr_val" and "pr_m[i].p2_r.dec_val", members of the
structure "odbpr", are definition for compatibility with the past
specification. These are not used now.
[Example]
The following program writes the integer values into the P-code macro
variables within the specified range.
#include <data.h>
#include <fwindow.h>
#include <stdlib.h>
/* start is start variable number to be written. */
/* value is array of value to be written. */
/* number is number of variable. */
int example( long start, long *value, int number )
{
struct odbpr *buf ;
int ret ;
long idx ;
buf = (struct iodbpr *)malloc( 10+6*number ) ;
buf->datano_s = start ;
buf->datano_e = start + number - 1 ;
for ( idx = 0 ; idx < number ; idx++ ) {
buf->pm_r[idx].p6_r.mcr_val = value[idx] ;
buf->pm_r[idx].p6_r.dec_val = 0 ;
}
ret = cnc_wrpmacror( 10+6*number, buf ) ;
free( buf ) ;
return ( ret ) ;
}