<?xml version="1.0" encoding="Shift_JIS"?>
<?xml-stylesheet type="text/xsl" href="../Fmethod_xsl/fmethod_he_c.xsl"?>

<root>
  <func>
    <title>cnc_rdposition</title>


    <declare>
      <vc>
        <include>#include "fwlib32.h"</include>
        <prottype>FWLIBAPI short WINAPI cnc_rdposition(unsigned short FlibHndl, short type, short *data_num, ODBPOS *position);</prottype>
      </vc>
    </declare>



    <doc>
        <cmn>
            <p>Reads the positions from 1st axis to the specified axis number.</p>
            <p>In case that "*data_num" is bigger than the current controlled axis
            number, this function sets the actual read axis number (the current
            controlled axis number) to "*data_num" variable after execution.
            And in case that "*data_num" is smaller than the current controlled
            axis number, this function reads data for the specified axis number
             which is specified by "*data_num".</p>
        </cmn>
    </doc>



    <argument>
        <common>
            <vc>
                <item>
                    <name>FlibHndl</name>
                    <type>in</type>
                    <content>
                        <p>
                            Specify the library handle. See "<a href="handle.htm" target="_parent">Library handle</a>" for details.
                        </p>
                    </content>
                </item>
                <item>
                    <name>type</name>
                    <type>in</type>
                    <content>
                        <p>
                            Specify the data type.
                        </p>
                        <table class="dd">
                            <tr>
                                <td>0</td>
                                <td>:</td>
                                <td>absolute position</td>
                            </tr>
                            <tr>
                                <td>1</td>
                                <td>:</td>
                                <td>machine position</td>
                            </tr>
                            <tr>
                                <td>2</td>
                                <td>:</td>
                                <td>relative position</td>
                            </tr>
                            <tr>
                                <td>3</td>
                                <td>:</td>
                                <td>distance to go</td>
                            </tr>
                            <tr>
                                <td>-1</td>
                                <td>:</td>
                                <td>all type</td>
                            </tr>
                        </table>
                    </content>
                </item>
                <item>
                    <name>data_num</name>
                    <type>in / out</type>
                    <content>
                        <p>
                            Specify the pointer to the number of data to be read. This
                    function returns the number of data which was read actually.
                        </p>
                    </content>
                </item>
                <item>
                    <name>position</name>
                    <type>out</type>
                    <content>
                        <p>
                           Specify the pointer to the array of ODBPOS structure to store
                    the positions. The number of array must be equal to
                    "*data_num". The ODBPOS structure is as follows.
                        </p>
<pre>
typedef struct odbpos {
    POSELM  abs;    /* absolute position */
    POSELM  mach;   /* machine position  */
    POSELM  rel;    /* relative position */
    POSELM  dist;   /* distance to go    */
} ODBPOS ;
</pre>
                        <ul>
                            <dl>
                                <dt>abs</dt>
                                <dd>The POSELM structure for absolute position</dd>
                                <dt>mach</dt>
                                <dd>The POSELM structure for machine position</dd>
                                <dt>rel</dt>
                                <dd>The POSELM structure for relative position</dd>
                                <dt>dist</dt>
                                <dd>The POSELM structure for distance to go</dd>
                            </dl>
                        </ul>
                        <p>And the POSELM structure is as follows.</p>
<pre>
typedef struct poselm {
    long    data;   /* position data */
    short   dec;    /* place of decimal point of position
                       data */
    short   unit;   /* unit of position data */
    short   disp;   /* status of display */
    char    name;   /* axis name */
    char    suff;   /* subscript of axis name */
} POSELM;
</pre>
                        <ul>
                            <dl>
                                <dt>data</dt>
                                <dd>Position data</dd>
                                <dt>dec</dt>
                                <dd>Place of decimal point</dd>
                                <dt>unit</dt>
                                <dd>Unit
                                    <table class="dd">
                                        <tr>
                                            <td>0</td>
                                            <td>:</td>
                                            <td>mm</td>
                                        </tr>
                                        <tr>
                                            <td>1</td>
                                            <td>:</td>
                                            <td>inch</td>
                                        </tr>
                                        <tr>
                                            <td>2</td>
                                            <td>:</td>
                                            <td>degree</td>
                                        </tr>
                                    </table>
                                </dd>
                                <dt>disp</dt>
                                <dd>Status of display
                                    <table class="dd">
                                        <tr>
                                            <td>0</td>
                                            <td>:</td>
                                            <td>not display in the CNC screen</td>
                                        </tr>
                                        <tr>
                                            <td>1</td>
                                            <td>:</td>
                                            <td>display in the CNC screen</td>
                                        </tr>
                                    </table>
                                </dd>
                                <dt>name</dt>
                                <dd>Axis name (ASCII)</dd>
                                <dt>suff</dt>
                                <dd>Subscript of axis name (ASCII)</dd>
                            </dl>
                        </ul>
                    </content>
                </item>
            </vc>
        </common>
    </argument>



    <errcode>
        <item>
            <name>EW_LENGTH</name>
            <content>
                Data block length error<br/>
                The axis number (*data_num) is 0 or less.
            </content>
        </item>
        <item>
            <name>EW_ATTRIB</name>
            <content>
                Data attribute error<br/>
                Type of position (type) is wrong.
            </content>
        </item>
        <add></add>
    </errcode>



    <option>
        <hssb>The extended driver/library function is necessary.</hssb>
        <ethr><p>The Ethernet function and the extended driver/library function are necessary.</p>
              <p>However, in case of Series 160i/180i/210i/0i MODEL B and 300i, the required CNC option is as follows.</p>
              <p>When Embedded Ethernet is used,</p>
              <p><ul>above two optional functions are not required.</ul></p>
              <p>When Ethernet board is used,</p>
              <p><ul>only Ethernet function is required.</ul></p>
        </ethr>
    </option>



    <parameter>
    </parameter>



    <mode>
    </mode>



    <support>
        <m>
            <fs0ia>X</fs0ia>
            <fs0ib>O</fs0ib>
            <fs15>X</fs15>
            <fs15i>O</fs15i>
            <fs16>X</fs16>
            <fs18>X</fs18>
            <fs21>X</fs21>
            <fs16ia>O</fs16ia>
            <fs18ia>O</fs18ia>
            <fs21ia>O</fs21ia>
            <fs16ib>O</fs16ib>
            <fs18ib>O</fs18ib>
            <fs21ib>O</fs21ib>
            <fs30i>O</fs30i>
        </m>
        <t>
            <fs0ia>X</fs0ia>
            <fs0ib>O</fs0ib>
            <fs15>X</fs15>
            <fs15i>X</fs15i>
            <fs16>X</fs16>
            <fs18>X</fs18>
            <fs21>X</fs21>
            <fs16ia>O</fs16ia>
            <fs18ia>O</fs18ia>
            <fs21ia>O</fs21ia>
            <fs16ib>O</fs16ib>
            <fs18ib>O</fs18ib>
            <fs21ib>O</fs21ib>
            <fs30i>O</fs30i>
        </t>
        <lc>
            <fs0ia>X</fs0ia>
            <fs0ib>X</fs0ib>
            <fs15>X</fs15>
            <fs15i>X</fs15i>
            <fs16>X</fs16>
            <fs18>X</fs18>
            <fs21>X</fs21>
            <fs16ia>X</fs16ia>
            <fs18ia>X</fs18ia>
            <fs21ia>X</fs21ia>
            <fs16ib>X</fs16ib>
            <fs18ib>X</fs18ib>
            <fs21ib>X</fs21ib>
            <fs30i>X</fs30i>
        </lc>
        <p>
            <fs16i>O</fs16i>
            <fs18i>O</fs18i>
        </p>
        <l>
            <fs16i>O</fs16i>
            <fs18i>X</fs18i>
        </l>
        <w>
            <fs16i>X</fs16i>
            <fs18i>X</fs18i>
        </w>
        <pw>
            <d>O</d>
            <h>O</h>
        </pw>
        <add><b></b></add>
    </support>



    <reference>
    </reference>



    <example>
        <vc>
<pre>
The following program reads the absolute position data of all axis,
and displays them.

#include "fwlib32.h"

void example( void )
{
    ODBPOS pos[MAX_AXIS];
    short num = MAX_AXIS;
    short ret = cnc_rdposition(h, 0, &#38;num, pos);
    if(!ret) {
        int i;
        for(i = 0 ; i &#60; num ; i++) {
            printf("%c = %d\n", pos[i].abs.name, pos[i].abs.data);
        }
    }
}
</pre>
        </vc>
    </example>



  </func>
</root>
