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

<root>
  <func>
    <title>cnc_rdspmeter</title>


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



    <doc>
        <cmn>
            <p>Reads the spindle load meter data and the spindle motor speed data from
            1st spindle to the specified spindle number.</p>

            <p>In case that "data_num" is bigger than the current spindle number, this function sets the actual read spindle number (the current spindle number) to "data_num" variable after execution. And in case that "data_num" is smaller than the current spindle number, this function reads data for the specified spindle 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>spindle load meter data</td>
                            </tr>
                            <tr>
                                <td>1</td>
                                <td>:</td>
                                <td>spindle motor speed data</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>loadmeter</name>
                    <type>out</type>
                    <content>
                        <p>Specify the pointer to the array of ODBSVLOAD structure to
                  store the spindle load meter data and the spindle motor speed
                  data. The number of array must be equal to "*data_num".
                  The ODBSVLOAD structure is as follows. </p>
<pre>
typedef struct odbspload {
    LOADELM     spload;     /* spindle load meter data */
    LOADELM     spspeed;    /* spindle motor data */
} ODBSPLOAD ;
</pre>
                        <dl>
                            <dt>svload</dt>
                            <dd>The LOADELM structure for spindle load meter data</dd>
                        </dl>
                        <dl>
                            <dt>spspeed</dt>
                            <dd>The LOADELM structure for spindle motor speed data
                      And the LOADELM structure is as follows. </dd>
                        </dl>
                        <p>The LOADELM structure is as follows. </p>
<pre>
typedef struct loadelm {
    long    data;       /* load meter data, motor speed */
    short   dec;        /* place of decimal point */
    short   unit;       /* unit */
    char    name;       /* spindle name */
    char    suff1;      /* subscript of spindle name 1 */
    char    suff2;      /* subscript of spindle name 2 */
    char    reserve;    /* */
} LOADELM;
</pre>
                        <dl>
                            <dt>data</dt>
                            <dd>Load meter data, motor 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>%</td>
                                    </tr>
                                    <tr>
                                        <td>1</td>
                                        <td>:</td>
                                        <td>rpm</td>
                                    </tr>
                                </table>
                            </dd>
                            <dt>name</dt>
                            <dd>Spindle name (ASCII) <br/>
                                ASCII code 'S' is stored. </dd>
                            <dt>suff1</dt>
                            <dd><p>Subscript of spindle name 1 (ASCII) </p>
                                <li>Series 160/180/210, 160i/180i/210i, 0i, 300i, Power Mate i</li>
                                <ul><p>The spindle number ('1', '2', ...) is stored.</p></ul>
                                <li>Series 150i</li>
                                <ul><p>The value which is defined by parameter (No. 5845, 5846) is stored.</p></ul>
                            </dd>
                            <dt>suff2</dt>
                            <dd><p>Subscript of spindle name 2 (ASCII)<br/>
                                When the spindle switching function is available, the following ASCII code is stored.</p>
                                <table class="dd">
                                    <tr>
                                        <td>In case of main spindle</td>
                                        <td>:</td>
                                        <td>'1'</td>
                                    </tr>
                                    <tr>
                                        <td>In case of sub spindle</td>
                                        <td>:</td>
                                        <td>'2'</td>
                                    </tr>
                                </table>
                                <p>When the spindle switching function is not available, NULL('\0') is stored.<br/>
                                In case of Series 15, data is stored. But it is invalid for the spindle name. </p>
                            </dd>
                        </dl>
                    </content>
                </item>
            </vc>
        </common>
    </argument>



    <errcode>
        <item>
            <name>EW_LENGTH</name>
            <content>
                Data block length error<br/>
                The spindle number (data_num) is 0 or less.
            </content>
        </item>
        <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><p>This function is not related to the spindle switching control.</p></type>
    </option>



    <parameter>
        <type>
            <li>Series 150i</li>
            <ul><p>5845, 5846 (influenced by setting)</p></ul>
        </type>
    </parameter>



    <mode>
    </mode>



    <support>
        <m>
            <fs0ia>X</fs0ia>
            <fs0ib>O</fs0ib>
            <fs15>X</fs15>
            <fs15i>E</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>E</d>
            <h>X</h>
        </pw>
        <add><b></b></add>
    </support>



    <reference>
    </reference>



    <example>
        <vc>
<pre>
The following program reads all spindle load meter, and displays them.

#include "fwlib32.h"

void example( void )
{
    ODBSPLOAD sp[4];   /* 4 = maximum spinlde number */
    short num = 4;
    short ret = cnc_rdspmeter(h, 0, &#38;num, sp);

    if(!ret) {
        int i;
        for(i = 0 ; i &#60; num ; i++) {
            printf("%c%c = %d\n", 
            sp[i].spload.name, sp[i].spload.suff1,
            sp[i].spload.data);
        }
    }
}
</pre>
        </vc>
    </example>



  </func>
</root>
