
[Description]
Writes the custom macro variable data stored in the CNC within the
specified range.
Types of custom macro variable are as follows.
(1) Local variables ( #1,..,#33 )
Not writable. (Use cnc_wrmacro function.)
(2) Common variables ( #100,..,#149, #500,..,#531 )
Writable. In case that Custom macro common variable 900 sets option is
added, #100,..,#199 and #500,..,#999 are available to be written.
(3) System variables ( #1000,.. )
Not writable. (Use cnc_wrmacro function.)
Refer "USER'S MANUAL" of CNC for details of custom macro
variables.
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.data[i].mcr_val"
and "buf.data[i].dec_val".
The formats of "mcr_val" and "dec_val" are same as ones of "Write
custom macro variable(cnc_wrmacro)". See description of "cnc_wrmacro".
[Example]
The following program writes the integer values into the custom 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. */
short example( short start, long *value, short number )
{
struct odbmr *buf ;
short ret, idx ;
buf = (struct iodbmr *)malloc( 6+6*number ) ;
buf->datano_s = start ;
buf->datano_e = start + number - 1 ;
for ( idx = 0 ; idx < number ; idx++ ) {
buf->data[idx].mcr_val = value[idx] ;
buf->data[idx].dec_val = 0 ;
}
ret = cnc_wrmacror( 6+6*number, buf ) ;
free( buf ) ;
return ( ret ) ;
}