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

<root>
  <func>


    <title>cnc_rddiag_ext</title>



    <declare>
      <vc>
        <include>#include "fwlib32.h"</include>
        <prottype>FWLIBAPI short WINAPI cnc_rddiag_ext(unsigned short FlibHndl, long *prm_no, short num, IODBPRM *param);</prottype>
      </vc>
    </declare>



    <doc>
        <cmn>

Reads the random number diagnosis data. The diagnosis data numbers are specified by the array of long type (&quot;prm_no[]&quot;). And the number of the array is specified by &quot;num&quot;.<p/>

The information of diagnosis data is stored to the array of IODBPRM structure. If an invalid diagnosis data number is specified, the <b>type</b> field of the IODBPRM structure is <b>-1</b>.
In case of non-axis type diagnosis data, the diagnosis data value is stored to the <b>data[0]</b> of the IODBPRM structure. And, in case of axis-type diagnosis data, the diagnosis data value is stored to the <b>data array</b> of the structure.<p/>

All diagnosis data values are stored to long type. So your application have to cast them according to the type information.<p/>

See the &quot;MAINTENANCE MANUAL&quot; of CNC for details of each diagnosis data.<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>prm_no</name>
                    <type>in</type>
                    <content>
                        <p>
                            Specify the pointer to the array of the diagnosis data numbers.
                        </p>
                        <p>
See the "MAINTENANCE MANUAL" of CNC about available diagnosis number. It can be got by <a href="misc/cnc_rddiagnum.htm" target="_parent">cnc_rddiagnum</a> function and <a href="misc/cnc_rddiaginfo.htm" target="_parent">cnc_rddiaginfo</a> function.
                        </p>
                    </content>
                </item>
                <item>
                    <name>num</name>
                    <type>in</type>
                    <content>
                        <p>
                            Specify the number of the diagnosis data to be read.
                        </p>
                    </content>
                </item>
                <item>
                    <name>param</name>
                    <type>out</type>
                    <content>
                        <p>
                            Specify the pointer to the array of IODBPRM structure to store the diagnosis data. The number of array must be equal to "num".
                        </p>
The IODBPRM structure is as follows.
<pre><![CDATA[
typedef struct iodbprm {
        long datano;        /* diagnosis data number */
        short type;         /* type information */
        short axis;         /* axis information */
        short info;         /* attribute */
        short unit;         /* unit */
        struct {
            long prm_val;   /* diagnosis data value */
            long dec_val;   /* place of decimal point */
        } data[32];
} IODBPRM;
]]></pre>

                        <dt>datano</dt>
                            <dd>diagnosis data number which was read is stored.</dd>
                        <dt>type</dt>
                            <dd>Type information of diagnosis data which was read is stored.</dd>
                            <dd><table class="dd">
                                <tr>    <td align="right">0</td>    <td>:</td>    <td>byte type</td>                             </tr>
                                <tr>    <td align="right">1</td>    <td>:</td>    <td>word type</td>                             </tr>
                                <tr>    <td align="right">2</td>    <td>:</td>    <td>2-word type</td>                           </tr>
                                <tr>    <td align="right">3</td>    <td>:</td>    <td>bit type (8 bit)</td>                      </tr>
                                <tr>    <td align="right">4</td>    <td>:</td>    <td>bit type (1 bit : except Series 150i)</td> </tr>
                                <tr>    <td align="right">5</td>    <td>:</td>    <td>real type (only Series 150i, 300i) </td>   </tr>
                                <tr>    <td align="right">-1</td>   <td>:</td>    <td>invalid diagnosis data</td>                </tr>
                            </table></dd>
                        <dt>axis</dt>
                            <dd>Axis information of diagnosis data which was read is stored.</dd>
                            <table>
                                <tr>
                                    <td><dd/><dd/>bit 0</td>    <td>:</td>    <td>axis attribute</td>
                                    <table class="dd">
                                        <tr>    <td><dd/><dd/><dd/>0</td>    <td>:</td>    <td>without axis</td> </tr>
                                        <tr>    <td><dd/><dd/><dd/>1</td>    <td>:</td>    <td>with axis</td>    </tr>
                                    </table>
                                </tr>
                                <tr>
                                    <td><dd/><dd/>bit 1</td>    <td>:</td>    <td>spindle data</td>
                                    <table class="dd">
                                        <tr>    <td><dd/><dd/><dd/>0</td>    <td>:</td>    <td>no spindle</td>  </tr>
                                        <tr>    <td><dd/><dd/><dd/>1</td>    <td>:</td>    <td>spindle</td>     </tr>
                                    </table>
                                </tr>
                                <tr>
                                    <td><dd/><dd/>bit 2,..,15</td>    <td>:</td>    <td>(reserve)</td>
                                </tr>
                            </table>
                        <dt>info</dt>
                            <dd>Axis information of diagnosis data which was read is stored.</dd>
                            <table>
                                <tr>
                                    <td><dd/><dd/>bit 0</td>    <td>:</td>    <td>sign</td>
                                    <table class="dd">
                                        <tr>    <td><dd/><dd/><dd/>0</td>    <td>:</td>    <td>with sign</td>    </tr>
                                        <tr>    <td><dd/><dd/><dd/>1</td>    <td>:</td>    <td>without sign</td> </tr>
                                    </table>
                                </tr>
                                <tr>
                                    <td><dd/><dd/>bit 1,..,15</td>    <td>:</td>    <td>(reserve)</td>
                                </tr>
                            </table>
                        <dt>unit</dt>
                            <dd>Unit of diagnosis data which was read is stored.</dd>
                            <table>
                                <tr>
                                    <td><dd/><dd/>bit 0, 1</td>    <td>:</td>    <td>unit</td>
                                    <table class="dd">
                                        <tr>    <td><dd/><dd/><dd/>0</td>    <td>:</td>    <td>without unit</td> </tr>
                                        <tr>    <td><dd/><dd/><dd/>1</td>    <td>:</td>    <td>%</td>            </tr>
                                        <tr>    <td><dd/><dd/><dd/>2</td>    <td>:</td>    <td>RPM    </td>      </tr>
                                    </table>
                                </tr>
                                <tr>
                                    <td><dd/><dd/>bit 2,..,15</td>    <td>:</td>    <td>(reserve)</td>
                                </tr>
                            </table>
                        <dt>data</dt>
                            <dd>Value of diagnosis data which was read is stored.</dd>
                            <table>
                                <tr>    <td><dd/><dd/>prm_val</td>    <td>:</td>    <td>Value of diagnosis data</td> </tr>
                                <tr>    <td><dd/><dd/>dec_val</td>    <td>:</td>    <td>Place of decimal point (only available for real type)</td> </tr>
                            </table>
                    </content>
                </item>
            </vc>

        </common>


        <!-- is Argument Start -->
        <is>
            <hssb>
                <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>prm_no</name>
                    <type>in</type>
                    <content>
                        <p>
                            Specify the pointer to the array of the diagnosis data numbers.
                        </p>
                        <p>
See the "MAINTENANCE MANUAL" of CNC about available diagnosis number. It can be got by <a href="misc/cnc_rddiagnum.htm" target="_parent">cnc_rddiagnum</a> function and <a href="misc/cnc_rddiaginfo.htm" target="_parent">cnc_rddiaginfo</a> function.
                        </p>
                    </content>
                </item>
                <item>
                    <name>num</name>
                    <type>in</type>
                    <content>
                        <p>
                            Specify the number of the diagnosis data to be read.
                        </p>
                    </content>
                </item>
                <item>
                    <name>param</name>
                    <type>out</type>
                    <content>
                        <p>
                            Specify the pointer to the array of IODBPRM structure to store the diagnosis data. The number of array must be equal to "num".
                        </p>
The IODBPRM structure is as follows.
<pre><![CDATA[
typedef struct iodbprm {
        long datano;        /* diagnosis data number */
        short type;         /* type information */
        short axis;         /* axis information */
        short info;         /* attribute */
        short unit;         /* unit */
        struct {
            long prm_val;   /* diagnosis data value */
            long dec_val;   /* place of decimal point */
        } data[32];
} IODBPRM;
]]></pre>
                        <dl>
                        <dt>datano</dt>
                            <dd>diagnosis data number which was read is stored.</dd>
                        <dt>type</dt>
                            <dd>Type information of diagnosis data which was read is stored.
                            <table class="dd">
                                <tr>    <td>0</td>    <td>:</td>    <td>byte type</td>                             </tr>
                                <tr>    <td>1</td>    <td>:</td>    <td>word type</td>                             </tr>
                                <tr>    <td>2</td>    <td>:</td>    <td>2-word type</td>                           </tr>
                                <tr>    <td>3</td>    <td>:</td>    <td>bit type (8 bit)</td>                      </tr>
                                <tr>    <td>4</td>    <td>:</td>    <td>bit type (1 bit)</td> </tr>
                                <tr>    <td>5</td>    <td>:</td>    <td>real type </td>   </tr>
                                <tr>    <td>-1</td>   <td>:</td>    <td>invalid diagnosis data</td>                </tr>
                            </table></dd>
                        <dt>axis</dt>
                            <dd>Axis information of diagnosis data which was read is stored.
                            <table class="dd">
                                <colgroup valign="top"/>
                                <colgroup valign="top"/>
                                <colgroup valign="top"/>
                                <tr>
                                    <td>bit 0</td>    <td>:</td>    <td>axis attribute
                                    <table class="dd">
                                        <tr>    <td>0</td>    <td>:</td>    <td>without axis</td> </tr>
                                        <tr>    <td>1</td>    <td>:</td>    <td>with axis</td>    </tr>
                                    </table></td>
                                </tr>
                                <tr>
                                    <td>bit 1</td>    <td>:</td>    <td>spindle data
                                    <table class="dd">
                                        <tr>    <td>0</td>    <td>:</td>    <td>no spindle</td>  </tr>
                                        <tr>    <td>1</td>    <td>:</td>    <td>spindle</td>     </tr>
                                    </table></td>
                                </tr>
                                <tr>
                                    <td>bit 3,..,15</td>    <td>:</td>    <td>(reserve)</td>
                                </tr>
                            </table></dd>
                        <dt>info</dt>
                            <dd>Axis information of diagnosis data which was read is stored.
                            <table class="dd">
                                <colgroup valign="top"/>
                                <colgroup valign="top"/>
                                <colgroup valign="top"/>
                                <tr>
                                    <td><dd/><dd/>bit 0</td>    <td>:</td>    <td>sign
                                    <table class="dd">
                                        <tr>    <td>0</td>    <td>:</td>    <td>with sign</td>    </tr>
                                        <tr>    <td>1</td>    <td>:</td>    <td>without sign</td> </tr>
                                    </table></td>
                                </tr>
                                <tr>
                                    <td>bit 1,..,15</td>    <td>:</td>    <td>(reserve)</td>
                                </tr>
                            </table></dd>
                        <dt>unit</dt>
                            <dd>Unit of diagnosis data which was read is stored.
                            <table class="dd">
                                <colgroup valign="top"/>
                                <colgroup valign="top"/>
                                <colgroup valign="top"/>
                                <tr>
                                    <td>bit 0, 1</td>    <td>:</td>    <td>unit
                                    <table class="dd">
                                        <tr>    <td>0</td>    <td>:</td>    <td>without unit</td> </tr>
                                        <tr>    <td>1</td>    <td>:</td>    <td>%</td>            </tr>
                                        <tr>    <td>2</td>    <td>:</td>    <td>RPM    </td>      </tr>
                                    </table></td>
                                </tr>
                                <tr>
                                    <td>bit 2,..,15</td>    <td>:</td>    <td>(reserve)</td>
                                </tr>
                            </table></dd>
                        <dt>data</dt>
                            <dd>Value of diagnosis data which was read is stored.
                            <table class="dd">
                                <tr>    <td>prm_val</td>    <td>:</td>    <td>Value of diagnosis data</td> </tr>
                                <tr>    <td>dec_val</td>    <td>:</td>    <td>Place of decimal point (only available for real type)</td> </tr>
                            </table></dd>
                        </dl>
                    </content>
                </item>

                </vc>
            </hssb>
        </is>
        <!-- is Argument End -->
    </argument>



    <errcode>
        <item>
            <name>EW_LENGTH</name>
            <content>
                Data block length error<br/>
                The number of diagnosis data (num) is 0 or less.
            </content>
        </item>
    </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>
        <is>
            <hssb>The extended driver/library function is necessary.</hssb>
        </is>
    </option>



    <parameter></parameter>



    <mode></mode>



    <support>
        <m>
            <fs0ia>X</fs0ia>
            <fs0ib>E</fs0ib>
            <fs15>X</fs15>
            <fs15i>E</fs15i>
            <fs16>X</fs16>
            <fs18>X</fs18>
            <fs21>X</fs21>
            <fs16ia>E</fs16ia>
            <fs18ia>E</fs18ia>
            <fs21ia>E</fs21ia>
            <fs16ib>E</fs16ib>
            <fs18ib>E</fs18ib>
            <fs21ib>E</fs21ib>
            <fs30i>O</fs30i>
        </m>
        <t>
            <fs0ia>X</fs0ia>
            <fs0ib>E</fs0ib>
            <fs15>X</fs15>
            <fs15i>X</fs15i>
            <fs16>X</fs16>
            <fs18>X</fs18>
            <fs21>X</fs21>
            <fs16ia>E</fs16ia>
            <fs18ia>E</fs18ia>
            <fs21ia>E</fs21ia>
            <fs16ib>E</fs16ib>
            <fs18ib>E</fs18ib>
            <fs21ib>E</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>E</fs16i>
            <fs18i>E</fs18i>
        </p>
        <l>
            <fs16i>E</fs16i>
            <fs18i>X</fs18i>
        </l>
        <w>
            <fs16i>X</fs16i>
            <fs18i>X</fs18i>
        </w>
        <pw>
            <d>E</d>
            <h>E</h>
        </pw>
        <add><b></b></add>
        <is>
            <!-- M -->
            <m>
                <fs30is>O</fs30is>
            </m>
            <!-- T -->
            <t>
                <fs30is>O</fs30is>
            </t>
        </is>
    </support>



    <reference>
        <item>
            <name>cnc_diagnoss</name>
            <file>misc/cnc_diagnoss.htm</file>
        </item>
        <item>
            <name>cnc_diagnosr</name>
            <file>misc/cnc_diagnosr.htm</file>
        </item>
        <item>
            <name>cnc_rddiaginfo</name>
            <file>misc/cnc_rddiaginfo.htm</file>
        </item>
        <item>
            <name>cnc_rddiagnum</name>
            <file>misc/cnc_rddiagnum.htm</file>
        </item>
    </reference>



    <example>
       <vc>
The following program reads the diagnosis data No.300 and No.410, and displays them.
(Series 160i/180i/210i, 0i, Power Mate i)

#include "fwlib32.h"

void example()
{
        IODBPRM prm[2];
        long prmno[2];

        prmno[0] = 300;
        prmno[1] = 410;
        ret = cnc_rddiag_ext( h, prmno, 2, prm ) ;
        if ( !ret ) {
                printf( "No.300:\n" );
                printf( "  1st axis = %d\n", prm[0].data[0].prm_val );
                printf( "  2nd axis = %d\n", prm[0].data[1].prm_val );
                printf( "  3rd axis = %d\n", prm[0].data[2].prm_val );

                printf( "No.410: = %d\n", prm[1].data[0].prm_val );
        }
}</vc>
    </example>



  </func>
</root>
