Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 460 -
------------------------------------------------------------------------------
1.57 Read pitch error compensation data (range specified). <Main,Alarm>
------------------------------------------------------------------------------
[Name]
cnc_rdpitchr
[Syntax]
#include <data.h>
#include <fwindow.h>
int cnc_rdpitchr( int s_number, int e_number, int length,
struct iodbpi *buf ) ;
struct iodbpi {
int datano_s ; /* Start pitch error compensation */
/* data number. */
int dummy ; /* Not used. */
int datano_e ; /* End pitch error compensation */
/* data number. */
char data[N] ; /* Pitch error compensation data. */
} ; /* N is the amount of compensation */
/* data to be read. */
[Arguments]
s_number Start pitch error compensation number.
e_number End pitch error compensation number.
length Data block length ( =6+(number of compensation data to
be read) )
buf Buffer in which the pitch error compensation data are
stored.
[Return]
0 Successful.
2 Incorrect data block length "length".
3 Incorrect pitch error compensation number "s_number" or
"e_number".
[Description]
Reads the pitch error compensation data stored in the CNC within the
specified range.
Specify the start pitch error compensation data number in "s_number"
and the end one in "e_number" with binary format.
The pitch error compensation data are stored in "buf.data" with signed
binary format. (The negative value is represented as 2's complement.)
[Example]
The following program reads the pitch error compensation data within
the specified number range and displays them.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
/* start/end are start/end number to be read. */
int example( int start, int end )
{
struct iodbpi *buf ;
int ret, idx ;
buf = (struct iodbpi *)malloc( 1024 ) ;
ret = cnc_rdpitchr( start, end, 6+(end-start+1), buf ) ;
if ( !ret )
for ( idx = 0 ; idx < end-start+1 ; idx++ )
printf( "#%04d %+d\n", idx+start, buf->data[idx] ) ;