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

<root>
  <func>
    <title>cnc_rddynamic2</title>


    <declare>
      <vc>
        <include>#include "fwlib32.h"</include>
        <prottype>FWLIBAPI short WINAPI cnc_rddynamic2( unsigned short FlibHndl, short axis, short length, ODBDY2 *rddynamic );</prottype>
      </vc>
    </declare>



    <doc>
        <cmn>
            <p>Reads various data which changes at CNC operation at a time.</p>
            
            <p>This function is the improved version of the <a href="position/cnc_rddynamic.htm" target="_parent">cnc_rddynamic</a> function. Please use this function because the <a href="position/cnc_rddynamic.htm" target="_parent">cnc_rddynamic</a> function cannot read all alarm status of Series 150i. The data which can be read is as follows.</p>

            <table border="1">
                <tr>
                    <th>Data </th>
                    <th>Function used for reading individually </th>
                </tr>
                <tr>
                    <td>Alarm status </td>
                    <td><a href="misc/cnc_alarm2.htm" target="_parent">cnc_alarm2</a></td>
                </tr>
                <tr>
                    <td>Program number in executing </td>
                    <td><a href="program/cnc_rdprgnum.htm" target="_parent">cnc_rdprgnum</a></td>
                </tr>
                <tr>
                    <td>Program number of the main program </td>
                    <td><a href="program/cnc_rdprgnum.htm" target="_parent">cnc_rdprgnum</a></td>
                </tr>
                <tr>
                    <td>Sequence number </td>
                    <td><a href="program/cnc_rdseqnum.htm" target="_parent">cnc_rdseqnum</a></td>
                </tr>
                <tr>
                    <td>Actual feed rate </td>
                    <td><a href="position/cnc_actf.htm" target="_parent">cnc_actf</a></td>
                </tr>
                <tr>
                    <td>Actual spindle speed </td>
                    <td><a href="position/cnc_acts.htm" target="_parent">cnc_acts</a></td>
                </tr>
                <tr>
                    <td>Absolute position data of controlled axis (2)</td>
                    <td><a href="position/cnc_absolute2.htm" target="_parent">cnc_absolute2</a></td>
                </tr>
                <tr>
                    <td>Machine position data of controlled axis </td>
                    <td><a href="position/cnc_machine.htm" target="_parent">cnc_machine</a></td>
                </tr>
                <tr>
                    <td>Relative position data of controlled axis (2)</td>
                    <td><a href="position/cnc_relative2.htm" target="_parent">cnc_relative2</a></td>
                </tr>
                <tr>
                    <td>Amount of distance to go of controlled axis </td>
                    <td><a href="position/cnc_distance.htm" target="_parent">cnc_distance</a></td>
                </tr>
            </table>

            <p>The formats of each data are same as "Function used for reading
            individually".
            Refer to each function for details.</p>

                <p>The data concerning the axis is read by specified with axis. Each data is stored in oaxis structure in ODBDY2.</p>

                <p>All axes can be read at a time by specifying ALL_AXES for "axis".
            In that case, various data concerning the axis is stored in each array
            of faxis inside of ODBDY2.</p>

                <p>The decimal point position of the various data concerning the axis
            can be acquired in the <a href="misc/cnc_getfigure.htm" target="_parent">cnc_getfigure</a> function.</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>axis</name>
                    <type>in</type>
                    <content>
                        <p>Specify axis number to read.
                            <table class="dd">
                                <tr>
                                    <td>ALL_AXES</td>
                                    <td>:</td>
                                    <td>ALL_AXES : for all axes(ALL_AXES : -1)</td>
                                </tr>
                                <tr>
                                    <td>1,..,m</td>
                                    <td>:</td>
                                    <td>for each axis(m : number of controlled axis)</td>
                                </tr>
                            </table>
                        </p>
                    </content>
                </item>
                <item>
                    <name>length</name>
                    <type>in</type>
                    <content>
                        <p>Specify the length of the data block(size of ODBDY2 structure)</p>
                        <p><b>ODBDY2</b>
                            <table>
                            <colgroup align="left" valign="top"/>
                            <colgroup align="left" valign="top"/>
                            <colgroup align="left" valign="top"/>
                                <tr>
                                    <th>for each axis</th>
                                    <th>for all axes</th>
                                </tr>
                                <tr>
                                    <td valign="top"><img src="position/dyn2.gif"/></td>
                                    <td valign="top"><img src="position/dyna2.gif"/></td>
                                </tr>
                            </table>
                        </p>
                        <p>n = Maximum controlled axes (The data for current controlled axes are valid.) </p>
                    </content>
                </item>
                <item>
                    <name>rddynamic</name>
                    <type>out</type>
                    <content>
                        <p>Pointer to the ODBDY2 structure including various data. The ODBDY2 structure is as follows.</p>

<pre>
typedef struct odbdy2 {
    short  dummy ;     /* not used                */
    short  axis ;      /* axis number             */
    long   alarm ;     /* alarm status            */
    long   prgnum ;    /* current program number  */
    long   prgmnum ;   /* main program number     */
    long   seqnum ;    /* current sequence number */
    long   actf ;      /* actual feedrate         */
    long   acts ;      /* actual spindle speed    */
    union {
        struct {
            long  absolute[MAX_AXIS] ; /* absolute */
            long  machine[MAX_AXIS] ;  /* machine  */
            long  relative[MAX_AXIS] ; /* relative */
            long  distance[MAX_AXIS] ; /* distance to go */
        } faxis ; /* In case of all axes */
        struct {
            long  absolute ; /* absolute */
            long  machine ;  /* machine  */
            long  relative ; /* relative */
            long  distance ; /* distance to go */
        } oaxis ; /* In case of 1 axis */
    } pos ;
} ODBDY2 ;            /* MAX_AXIS is the maximum controlled axes. */
</pre>
                        <ul>
                            <dl>
                                <dt>dummy</dt>
                                <dd>Not used</dd>
                                <dt>axis</dt>
                                <dd>Axis number<br/>The read axis number is returned.</dd>
                                <dt>alarm</dt>
                                <dd>Alarm status<br/>The meaning of each bit is as follows.
                                    <ul><br/><li>Series 150i</li>
                                        <table>
                                            <tr><td>#00</td><td>:</td><td>Background P/S</td></tr>
                                            <tr><td>#01</td><td>:</td><td>Foreground P/S</td></tr>
                                            <tr><td>#02</td><td>:</td><td>Overheat alarm</td></tr>
                                            <tr><td>#03</td><td>:</td><td>Sub-CPU error</td></tr>
                                            <tr><td>#04</td><td>:</td><td>Syncronized error</td></tr>
                                            <tr><td>#05</td><td>:</td><td>Parameter switch on</td></tr>
                                            <tr><td>#06</td><td>:</td><td>Overtravel,Ext. data</td></tr>
                                            <tr><td>#07</td><td>:</td><td>PMC error</td></tr>
                                            <tr><td>#08</td><td>:</td><td>External alarm message</td></tr>
                                            <tr><td>#09</td><td>:</td><td>(Not used)</td></tr>
                                            <tr><td>#10</td><td>:</td><td>Serious P/S</td></tr>
                                            <tr><td>#11</td><td>:</td><td>(Not used)</td></tr>
                                            <tr><td>#12</td><td>:</td><td>Servo alarm</td></tr>
                                            <tr><td>#13</td><td>:</td><td>I/O error</td></tr>
                                            <tr><td>#14</td><td>:</td><td>Power off parameter set</td></tr>
                                            <tr><td>#15</td><td>:</td><td>(Not used)</td></tr>
                                            <tr><td>#16</td><td>:</td><td>(Not used)</td></tr>
                                            <tr><td>#17</td><td>:</td><td>(Not used)</td></tr>
                                            <tr><td>#18</td><td>:</td><td>(Not used)</td></tr>
                                            <tr><td>#19</td><td>:</td><td>Macro alarm</td></tr>
                                            <tr><td>#20</td><td>:</td><td>System alarm </td></tr>
                                            <tr><td>#21,..,#31</td><td>:</td><td>(Not used)</td></tr>
                                        </table>
                                    </ul>
                                    <ul><br/><li>Series 160i/180i/210i, 0i, Power Mate i (Ethernet Only)</li>
                                        <table>
                                            <tr><td>#00</td><td>:</td><td>P/S alarm 100</td></tr>
                                            <tr><td>#01</td><td>:</td><td>P/S alarm 000</td></tr>
                                            <tr><td>#02</td><td>:</td><td>P/S alarm 101</td></tr>
                                            <tr><td>#03</td><td>:</td><td>P/S alarm except above </td></tr>
                                            <tr><td>#04</td><td>:</td><td>Overtravel alarm </td></tr>
                                            <tr><td>#05</td><td>:</td><td>Overheat alarm </td></tr>
                                            <tr><td>#06</td><td>:</td><td>Servo alarm </td></tr>
                                            <tr><td>#07</td><td>:</td><td>System alarm </td></tr>
                                            <tr><td>#08</td><td>:</td><td>APC alarm </td></tr>
                                            <tr><td>#09</td><td>:</td><td>Spindle alarm </td></tr>
                                            <tr><td>#10</td><td>:</td><td>P/S alarm 5000, Punch press alarm </td></tr>
                                            <tr><td>#11</td><td>:</td><td>Laser alarm </td></tr>
                                            <tr><td>#12</td><td>:</td><td>(Not used)</td></tr>
                                            <tr><td>#13</td><td>:</td><td>Rigid tap alarm </td></tr>
                                            <tr><td>#14</td><td>:</td><td>(Not used)</td></tr>
                                            <tr><td>#15</td><td>:</td><td>External alarm message </td></tr>
                                            <tr><td>#16,..,#31</td><td>:</td><td>(Not used)</td></tr>
                                        </table>
                                    </ul>
                                    <ul><br/><li>Series 300i</li>
                                        <table>
                                            <tr><td>#00</td> <td>:</td> <td>Parameter switch on</td>          <td>(SW)</td> </tr>
                                            <tr><td>#01</td> <td>:</td> <td>Power off parameter set</td>      <td>(PW)</td> </tr>
                                            <tr><td>#02</td> <td>:</td> <td>I/O error</td>                    <td>(IO)</td> </tr>
                                            <tr><td>#03</td> <td>:</td> <td>Foreground P/S</td>               <td>(PS)</td> </tr>
                                            <tr><td>#04</td> <td>:</td> <td>Overtravel,External data</td>     <td>(OT)</td> </tr>
                                            <tr><td>#05</td> <td>:</td> <td>Overheat alarm</td>               <td>(OH)</td> </tr>
                                            <tr><td>#06</td> <td>:</td> <td>Servo alarm</td>                  <td>(SV)</td> </tr>
                                            <tr><td>#07</td> <td>:</td> <td>Data I/O error</td>               <td>(SR)</td> </tr>
                                            <tr><td>#08</td> <td>:</td> <td>Macro alarm</td>                  <td>(MC)</td> </tr>
                                            <tr><td>#09</td> <td>:</td> <td>Spindle alarm</td>                <td>(SP)</td> </tr>
                                            <tr><td>#10</td> <td>:</td> <td>Other alarm</td>                  <td>(DS)</td> </tr>
                                            <tr><td>#11</td> <td>:</td> <td>Alarm concerning Malfunction prevent functions</td>      <td>(IE)</td> </tr>
                                            <tr><td>#12</td> <td>:</td> <td>Background P/S</td>               <td>(BG)</td> </tr>
                                            <tr><td>#13</td> <td>:</td> <td>Syncronized error</td>            <td>(SN)</td> </tr>
                                            <tr><td>#14</td> <td>:</td> <td>(reserved)</td>                   <td></td>     </tr>
                                            <tr><td>#15</td> <td>:</td> <td>External alarm message</td>       <td>(EX)</td> </tr>
                                            <tr><td>#16</td> <td>:</td> <td>(reserved)</td>                   <td></td>     </tr>
                                            <tr><td>#17</td> <td>:</td> <td>(reserved)</td>                   <td></td>     </tr>
                                            <tr><td>#18</td> <td>:</td> <td>(reserved)</td>                   <td></td>     </tr>
                                            <tr><td>#19</td> <td>:</td> <td>PMC error </td>                   <td>(PC)</td> </tr>
                                            <tr><td>#20 to 31</td> <td>:</td> <td>(Not used)</td> </tr>
                                        </table>
                                    </ul>
                                </dd>
                                <dt>prgnum</dt>
                                <dd>Program number under execution <br/>
                                    (It is the selected program number while automatic operation stopping)</dd>
                                <dt>prgmnum</dt>
                                <dd>Main program number </dd>
                                <dt>seqnum</dt>
                                <dd>Current sequence number </dd>
                                <dt>actf</dt>
                                <dd>Actual feed rate of the controlled axes </dd>
                                <dt>acts</dt>
                                <dd>Actual spindle speed data (It is invalid in Power Mate i-H)</dd>
                                <dt>absolute</dt>
                                <dd>Absolute position of the controlled axes </dd>
                                <dt>machine</dt>
                                <dd>Machine position of the controlled axes </dd>
                                <dt>relative</dt>
                                <dd>Relative position of the controlled axes </dd>
                                <dt>distance</dt>
                                <dd>Amount of distance to go of the controlled axes </dd>
                            </dl>
                        </ul>
                    </content>
                </item>
            </vc>
        </common>
    </argument>



    <errcode>
        <item>
            <name>EW_LENGTH</name>
            <content>
                data block length error<br/>
                Size of ODBDY structure(length) is illegal.
            </content>
        </item>
        <item>
            <name>EW_ATTRIB</name>
            <content>
                data attribute error<br/>The specification of axis number (axis) is improper.
            </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, 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>
        <type>
            <li>Series 150i</li>
            <ul>
                2202#2,#3,#4,#5,#6,#7 (influenced by setting)
            </ul>
        </type>
    </parameter>



    <mode>
    </mode>



    <support>
        <m>
            <fs0ia>X</fs0ia>
            <fs0ib>E</fs0ib>
            <fs15>X</fs15>
            <fs15i>O</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>
    </support>



    <reference>
        <item>
            <name>cnc_rddynamic</name>
            <file>position/cnc_rddynamic.htm</file>
        </item>
        <item>
            <name>cnc_alarm2</name>
            <file>misc/cnc_alarm2.htm</file>
        </item>
        <item>
            <name>cnc_rdprgnum</name>
            <file>program/cnc_rdprgnum.htm</file>
        </item>
        <item>
            <name>cnc_rdseqnum</name>
            <file>program/cnc_rdseqnum.htm</file>
        </item>
        <item>
            <name>cnc_actf</name>
            <file>position/cnc_actf.htm</file>
        </item>
        <item>
            <name>cnc_acts</name>
            <file>position/cnc_acts.htm</file>
        </item>
        <item>
            <name>cnc_absolute</name>
            <file>position/cnc_absolute.htm</file>
        </item>
        <item>
            <name>cnc_machine</name>
            <file>position/cnc_machine.htm</file>
        </item>
        <item>
            <name>cnc_relative</name>
            <file>position/cnc_relative.htm</file>
        </item>
        <item>
            <name>cnc_distance</name>
            <file>position/cnc_distance.htm</file>
        </item>
    </reference>



    <example>
<vc>
The following program reads the dynamic data of all axes (number of axes = MAX_AXIS) and displays them on the screen.

#include "fwlib32.h"

void example( void )
{
    struct odbdy2 buf ;
    unsigned int idx ;
    cnc_rddynamic2( h, -1, sizeof(buf), &#38;buf ) ;
    printf( "Current program = %d   Main program = %d\n",
                    buf.prgnum, buf.prgmnum ) ;
    printf( "Sequence number = %ld\n", buf.seqnum ) ;
    printf( "actf = %ld   acts = %ld\n", buf.actf, buf.acts ) ;
    printf( "Alarm status = %ld\n", buf.alarm ) ;
    printf( "AXIS Absolute  Relative  Machine   Distance\n" ) ;
    printf( "----+---------+---------+---------+--------\n" ) ;
    for ( idx = 0 ; idx &#60; MAX ; idx++ )
        printf( "  %u  %8ld  %8ld  %8ld  %8ld\n", idx,
            buf.pos.faxis.absolute[idx],
            buf.pos.faxis.relative[idx],
            buf.pos.faxis.machine[idx],
            buf.pos.faxis.distance[idx] ) ;
}
</vc>
    </example>



  </func>
</root>
