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

<root>
  <func>
    <title>cnc_rdspeed</title>


    <declare>
      <vc>
        <include>#include "fwlib32.h"</include>
        <prottype>FWLIBAPI short WINAPI cnc_rdspeed(unsigned short FlibHndl, short type, ODBSPEED *speed);</prottype>
      </vc>
    </declare>



    <doc>
        <cmn>
            <p>Reads the actual feed rate and the actual rotational speed of the spindle.</p>
            <p>The spindle speed, which can be read in this function, is one of the
            main spindle that is dispalyed in the position screen of the CNC.</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>feed rate</td>
                            </tr>
                            <tr>
                                <td>1</td>
                                <td>:</td>
                                <td>spindle speed (The spindle function is not provided in Power Mate i-H.)</td>
                            </tr>
                            <tr>
                                <td>-1</td>
                                <td>:</td>
                                <td>all</td>
                            </tr>
                        </table>
                    </content>
                </item>
                <item>
                    <name>speed</name>
                    <type>out</type>
                    <content>
                        <p>
                           Pointer to the ODBSPEED structure for the speed data.
                           The ODBSPEED structure is as follows.
                        </p>
<pre>
typedef struct odbspeed {
    SPEEDELM    actf;   /* feed rate */
    SPEEDELM    acts;   /* spindle speed */
} ODBSPEED ;
</pre>
                        <ul>
                            <dl>
                                <dt>actf</dt>
                                <dd>SPEEDELM structure for the feed rate</dd>
                                <dt>acts</dt>
                                <dd>SPEEDELM structure for the spindle speed<br/>
                                    And the SPEEDELM structure is as follows.</dd>
                            </dl>
                        </ul>
<pre>
typedef struct speedelm {
    long    data;       /* speed data */
    short   dec;        /* place of decimal point*/
    short   unit;       /* unit */
    short   reserve;    /* */
    char    name;       /* name */
    char    suff;       /* subscript of name */
} SPEEDELM;
</pre>
                        <ul>
                            <dl>
                                <dt>data</dt>
                                <dd>Speed 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/min</td>
                                        </tr>
                                        <tr>
                                            <td>1</td>
                                            <td>:</td>
                                            <td>inch/min</td>
                                        </tr>
                                        <tr>
                                            <td>2</td>
                                            <td>:</td>
                                            <td>rpm</td>
                                        </tr>
                                        <tr>
                                            <td>3</td>
                                            <td>:</td>
                                            <td>mm/rev</td>
                                        </tr>
                                        <tr>
                                            <td>4</td>
                                            <td>:</td>
                                            <td>inch/rev</td>
                                        </tr>
                                    </table>
                                </dd>
                                <dt>name</dt>
                                <dd>Name (ASCII)
                                    <table class="dd">
                                        <tr>
                                            <td>Feed rate</td>
                                            <td>:</td>
                                            <td>'F'</td>
                                        </tr>
                                        <tr>
                                            <td>Spindle speed</td>
                                            <td>:</td>
                                            <td>'S'</td>
                                        </tr>
                                    </table>
                                </dd>
                                <dt>suff</dt>
                                <dd>Subscription of name (ASCII)<br/>
                                    When the multi spindle control function is available,
                            in case of the spindle speed, the selected position
                            coder number (ASCII format) is stored.</dd>
                            </dl>
                        </ul>
                    </content>
                </item>
            </vc>
        </common>
    </argument>



    <errcode>
        <item>
            <name>EW_ATTRIB</name>
            <content>
                Data attribute error<br/>
                Type of data (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>
        <type>This function is not related to the multi spindle control.</type>
    </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 feed rate and the spindle speed, and displays them.

#include "fwlib32.h"

void example( void )
{
    ODBSPEED speed;
    short ret = cnc_rdspeed(h, -1, &#38;speed);
    if(!ret) {
        printf("%c = %d\n", speed.actf.name, speed.actf.data);
        printf("%c = %d\n", speed.acts.name, speed.acts.data);
    }
}
</pre>
        </vc>
    </example>



  </func>
</root>
