Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 514 -
------------------------------------------------------------------------------
1.78 Read tool life management data (tool length compensation number 2).
<Main,Alarm>
------------------------------------------------------------------------------
[Name]
cnc_rd2length
[Syntax]
#include <data.h>
#include <fwindow.h>
int cnc_rd2length( int grp_num, int tuse_num, struct odbtool *buf ) ;
struct odbtool {
int datano ; /* Tool group number. */
int type ; /* Tool use-order number. */
long data ; /* Tool length compensation number. */
} ;
[Arguments]
grp_num Tool group number.
tuse_num Tool use-order number.
buf Buffer in which the tool management data are stored.
[Return]
0 Successful.
3 Incorrect tool group number "grp_num".
4 Incorrect tool use-order number "tuse_num".
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.
[Description]
Reads the tool length compensation number of the specified tool group
and tool use-order number.
Specify the tool group number in "grp_num" and the tool use-order
number in "tuse_num" with binary format.
The tool length compensation number of the specified tool is stored in
"buf.data" with binary format. The currently used tool group and tool
are referenced by specifying "0" in "grp_num". However, in case that
any tool group number has never be specified since power-on, "0" is
stored.
In the case of specifying "0" in "tuse_num", either the currently used
tool for already used tool group or the first tool for not-used tool
group is referenced.
This function is effective for only M Series. "0" is always read for
T Series.
[Example]
The following program reads the tool length compensation number of the
specified tool group and tool use-order number, and displays it.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
/* grpno/useno are GROUP/USE-ORDER index number to be read. */
int example( int grpno, int useno )
{ struct odbtool buf ;
int ret ;
ret = cnc_rd2length( grpno, useno, &buf ) ;
if ( !ret )
printf( "Tool length compensation number of "
"GROUP #%d/USE-ORDER #%d is %ld.\n",
grpno, useno, buf.data ) ;
else