Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 506 -
------------------------------------------------------------------------------
1.74 Read tool life management data (tool number). <Main,Alarm>
------------------------------------------------------------------------------
[Name]
cnc_rdntool
[Syntax]
#include <data.h>
#include <fwindow.h>
int cnc_rdntool( int number, struct odbtool *buf ) ;
struct odbtool {
int datano ; /* Tool group number. */
int type ; /* Not used. */
long data ; /* Amount of tool. */
} ;
[Arguments]
number Tool group number.
buf Buffer in which the tool management data are stored.
[Return]
0 Successful.
3 Incorrect tool group number "number".
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 amount of tools which are registered in the specified tool
group.
Specify the tool group number in "number" with binary format.
The amount of tools which are registered in the specified tool group
is stored in "buf.data" with binary format.
The amount of tools which are registered in the currently used tool
group number is stored by specifying "0" in "number". However, in case
that any tool group number has never be specified since power-on, "0"
is stored.
[Example]
The following program reads the amount of tools which are registered
in the specified tool group, and displays it.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
/* grpno is GROUP index number to be read. */
int example( int grpno )
{
struct odbtool buf ;
int ret ;
ret = cnc_rdntool( grpno, &buf ) ;
if ( !ret )
printf( "Total number of tools registered in GROUP #%d"
" is %ld.\n", grpno, buf.data ) ;
else
printf( "ERROR!(%d)\n", ret ) ;