Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 435 -
[Description]
Reads the parameter data stored in the CNC.
This function is used for reading the various settings of CNC to
execute any processes which are equivalent to CNC's by the application
program, etc.
Data types of CNC parameter are as follows. The data types of
parameter are different for every parameters number.
Parameter type Use Byte size
-----------------------+-------------------------------+------------
Bit parameter Every bits have each definition. 1
Byte parameter 1-byte data is stored. 1
Word parameter 2-byte data is stored. 2
2-Word parameter 4-byte data is stored. 4
It is impossible to read any bit parameter bit by bit.
Eight bits (i.e. 1 byte) which belong to the same parameter number
are read at the same time.
In case of reading any axis type parameter, either data of one
specified axis or data of all axes can be read. In case of reading any
parameter data of pitch error compensation, specify 10000,..,11023
(1024 in total) as parameter numbers.
Refer "PARAMETER MANUAL" of CNC for details of each parameters.
Specify the parameter number in "number" with binary format.
Specify one of following values corresponding with each parameter
as axis number in "axis".
axis Parameter type
-----------------------+------------------------------------
0 Ordinary (none axis type) parameter
-1 All axes data of axis type parameter
1,..,amount of One specified axis data of
controlled axis axis type parameter
For spindle parameters (No.4000,..,4799), all axes data are data of 2
axes. The parameter data of none axis type parameter or the axis type
parameter data which was read for one specified axis is stored in
"buf.u.cdata/idata/ldata". The axis type parameters which were read
for all axes are stored in "buf.u.cdatas/idatas/ldatas".
The data format depends on each parameter. The format of Byte/Word/
2-Word parameter is generally signed binary.
[Example]
The following program reads axis names of all controlled axes and
displays them.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
void example( void )
{ struct odbsys info ;
struct iodbpsd buf ;
int ret, idx, axno ;
cnc_sysinfo( &info ) ;
axno = atoi( info.axes ) ;
ret = cnc_rdparam( 1020, -1, 4+1*axno, &buf ) ;
for ( idx = 0 ; idx < axno ; idx++ ) {
printf( "#%d", idx+1 ) ;
if ( buf.u.cdatas[idx] == 0 )
printf( "\033[7m%c\033[27m\n", idx+'1' ) ;
else