Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 543 -
------------------------------------------------------------------------------
1.92 Write tool life management data (tool length compensation number 2).
<Main,Alarm>
------------------------------------------------------------------------------
[Name]
cnc_wr2length
[Syntax]
#include <data.h>
#include <fwindow.h>
int cnc_wr2length( struct odbtool *buf ) ;
struct odbtool {
int datano ; /* Tool group number. */
int type ; /* Tool use-order number. */
long data ; /* Tool length compensation number. */
} ;
[Arguments]
buf Buffer in which the tool management data are stored.
[Return]
0 Successful.
3 Incorrect tool group number "buf.datano".
4 Incorrect tool use-order number "buf.type".
6 The required option (Tool life management or Tool number
expansion for tool life management (512 sets in total, only
M Series)) is not added.
-1 Attempted to execute this function while the other low-speed
window function is being executed.
Retry after completing currently executed window's process.
[Description]
Writes the tool length compensation number of the specified tool group
and the tool use-order number.
Specify the tool group number in "buf.datano", the tool use-order
number in "buf.type", and the tool length compensation number
(1,..,255, inside of the amount of the tool compensation) in
"buf.data" with binary format.
This function is effective for only M Series.
[Example]
The following program alters the tool length compensation number of
the specified tool group and tool use-order number.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
/* grpno/useno are GROUP/USE-ORDER index number to be written in. */
/* lcomp is tool length compensation number to be written. */
int example( int grpno, int useno, long lcomp )
{ struct odbtool buf ;
int ret ;
buf.datano = grpno ;
buf.type = useno ;
buf.data = lcomp ;
ret = cnc_wr2length( &buf ) ;
if ( !ret )
printf( "New tool length compensation number %ld "
"has been written.\n", buf.data ) ;
else
printf( "ERROR!(%d)\n", ret ) ;
return ( ret ) ;