Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 510 -
------------------------------------------------------------------------------
1.76 Read tool life management data (tool life count). <Main,Alarm>
------------------------------------------------------------------------------
[Name]
cnc_rdcount
[Syntax]
#include <data.h>
#include <fwindow.h>
int cnc_rdcount( int number, struct odbtool *buf ) ;
struct odbtool {
int datano ; /* Tool group number. */
int type ; /* Not used. */
long data ; /* Tool life counter. */
} ;
[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 tool life counter of the specified tool group.
Specify the tool group number in "number" with binary format.
The tool life counter of the specified tool group is stored in
"buf.data" with binary format.
The tool life counter of 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.
The unit of the tool life counter is either [minute] or [count]. The
parameter No.6800#2 LTM determines which unit is used.
[Example]
The following program reads the tool life counter of 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 iodbpsd prm ;
struct odbtool buf ;
int ret ;
cnc_rdparam( 6800, 0, 4+1*1, &prm ) ;
ret = cnc_rdcount( grpno, &buf ) ;
if ( !ret )
printf( "Tool life counter of GROUP #%d is %ld%s.\n", grpno,
buf.data, (prm.u.cdata & 0x04)?"[min]":"[times]" ) ;
else
printf( "ERROR!(%d)\n", ret ) ;