Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 409 -
[Example]
The following program displays messages of all alarms which are
currently arising in CNC.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_ALM 40
#define MAX_AXIS 8
char axis_name[MAX_AXIS] ;
int idx_to_num( int *index )
{
int number = 0 ;
int temp = 0x0001 ;
while ( ( *index & temp ) == 0 ) {
temp <<= 1 ;
number ++ ;
}
*index &= ~temp ;
return ( number ) ;
}
void get_axisname( void )
{
int idx ;
struct iodbpsd buf ;
cnc_rdparam( 1020, -1, 4+1*MAX_AXIS, &buf ) ;
for ( idx = 0 ; idx < MAX_AXIS ; idx++ )
if ( buf.u.cdatas[idx] == 0 )
axis_name[idx] = '1' + idx ;
else
axis_name[idx] = buf.u.cdatas[idx] ;
}
/* to be continued on the next page... */