Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 386 -
------------------------------------------------------------------------------
1.31 Read machine position. <Main,Alarm>
------------------------------------------------------------------------------
[Name]
cnc_machine
[Syntax]
#include <data.h>
#include <fwindow.h>
int cnc_machine( int axis, int length, struct iodbaxis *buf ) ;
struct iodbaxis {
int dummy ; /* Not used. */
int type ; /* Axis number. */
long data[N] ; /* Machine position data of */
} ; /* controlled axis. N is the amount */
/* of controlled axes. */
[Arguments]
axis Axis number ( =(1,..,amount of controlled axes),
or -1 ).
length Data block length ( =4+4*(amount of axes to be read)).
buf Buffer in which the machine position data are stored.
[Return]
0 Successful.
2 Incorrect data block length "length".
4 Incorrect axis number "axis".
Any data other than -1 or (1,..,amount of controlled axes) has
been specified.
-1 It has been failed to read machine position data because
the CNC software was updating the machine position data of the
controlled axis.
[Description]
Reads the machine position data of the controlled axis of CNC.
This machine position data is same as one which is displayed on the
current position screen of CNC.
This function is used for displaying the machine positions of the
controlled axes of CNC by the application program, etc.
Specify one of (1,..,amount of controlled axes) for each axis or -1
for all axes as axis number in "axis".
The machine position data is stored in "buf.data" with signed binary
format. (The negative value is represented as 2's complement.)
The machine position data of specified axis is stored in "buf.data[0]"
in case of reading one axis's data.
The unit of the machine position data is as follows.
IS-B IS-C
-----------------------+---------------+---------------
Linear axis(mm output) 0.001 [mm] 0.0001 [mm]
Linear axis(inch output)0.0001 [inch] 0.00001 [inch]
Rotation axis 0.001 [deg] 0.0001 [deg]