Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 553 -
------------------------------------------------------------------------------
1.97 Write tool life management data (tool number). <Main,Alarm>
------------------------------------------------------------------------------
[Name]
cnc_wrtoolnum
[Syntax]
#include <data.h>
#include <fwindow.h>
int cnc_wrtoolnum( struct odbtool *buf ) ;
struct odbtool {
int datano ; /* Tool group number. */
int type ; /* Tool use-order number. */
long data ; /* Tool 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]
Alters the tool number of the specified tool use-order number in the
specified tool group.
When (the current maximum tool use-order number + 1) is
specified as the tool use-order number, the new tool will be added.
Specify the tool group number, tool use-order number and the tool
number (1,..,9999) in each "buf.datano", "buf.type" and "buf.data"
with binary format.
[Example]
The following program alters the tool number of the specified tool
use-order number in the specified tool group.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
/* grpno/useno are GROUP/USE-ORDER index number to be written in. */
/* toolno is new tool index number to be written. */
int example( int grpno, int useno, long toolno )
{ struct odbtool buf ;
int ret ;
buf.datano = grpno ;
buf.type = useno ;
buf.data = toolno ;
ret = cnc_wrtoolnum( &buf ) ;
if ( !ret )
printf( "New tool index number %ld has been written.\n",
buf.data ) ;
else
printf( "ERROR!(%d)\n", ret ) ;
return ( ret ) ;