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

<root>
  <func>
    <title>cnc_wrpmacro</title>


    <declare>

      <vc>
        <include>#include "fwlib32.h"</include>
        <prottype>FWLIBAPI short WINAPI cnc_wrpmacro(unsigned short FlibHndl, long number, long mcr_val, short dec_val);</prottype>
      </vc>

    </declare>





    <doc>
        <cmn>
            <p>Writes the P code macro variable (variable for the macro-executor) specified by "number". The data must be stored in "mcr_val","dec_val" with signed binary format.</p>

            <p>It is possible to exchange the type of P code macro variable by <a href="ncdata/cnc_setpmactype.htm" target="_parent">cnc_setpmactype</a> function. In case of the integer type variable, this indication is invalid and always regarded as the decimal form floating-point type.</p>


            <ul>
                <li>decimal form floating-point type (data format=M*10**(-E))</li>
                <table>
                    <colgroup valign="top">
                    <colgroup valign="top">
                    <colgroup valign="top">
                    <tr>
                        <td>mcr_val</td>
                        <td>:</td>
                        <td>value of variable (=M)<br/>
                        4-byte binary data with sign<br/>
                        (available range: 999999999,..,-999999999, integer type:-32768,..,32767)</td>
                    </tr>
                    <tr>
                        <td>dec_val</td>
                        <td>:</td>
                        <td>number of places of decimals (=E)<br/>
                        2-byte binary data with sign<br/>
                        (available range:-128,..,127, integer type : 0)</td>
                    </tr>
                    </colgroup>
                    </colgroup>
                    </colgroup>
                </table>
                <br/>
                <li>binary form floating-point type (data format=M*2**(-E))</li>
                <table>
                    <colgroup valign="top">
                    <colgroup valign="top">
                    <colgroup valign="top">
                    <tr>
                        <td>mcr_val</td>
                        <td>:</td>
                        <td>numerical part of variable (=M)<br/>
                        4-byte binary data with sign<br/>
                        (available range:No limitation)</td>
                    </tr>
                    <tr>
                        <td>dec_val</td>
                        <td>:</td>
                        <td>exponent part of variable (=E))<br/>
                        2-byte binary data with sign<br/>
                        (available range:-128,..,127)</td>
                    </tr>
                    </colgroup>
                    </colgroup>
                    </colgroup>
                </table>

            </ul>

            <p>The value of an undefined variable is called "vacant", and it is expressed as follows both at decimal form floating-point type and at binary form floating-point type.</p>

            <blockquote>
                <p>mcr_val = 0<br/>
                dec_val = -1</p>
            </blockquote>

            <p>See the "PROGRAMING MANUAL" of the macro-executor for details of the P code macro variable.</p>

        </cmn>
    </doc>





    <argument>
        <common>
            <cmn>
                <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>number</name>
                    <type>in</type>
                    <content>
                        <p>Specify the P code macro variable number. See the description of <a href="ncdata/cnc_rdpmacroinfo.htm" target="_parent">cnc_rdpmacroinfo</a> function about the available range.</p>
                    </content>
                </item>
                <item>
                    <name>mcr_val</name>
                    <type>in</type>
                    <content>
                        <p>Specify the value of variable/numerical part of variable.</p>
                    </content>
                </item>
                <item>
                    <name>dec_val</name>
                    <type>in</type>
                    <content>
                        <p>Specify the number of places of decimals/exponent part of variable.</p>
                    </content>
                </item>
            </cmn>

        </common>

    </argument>





    <errcode>
        <item>
            <name>EW_NUMBER</name>
            <content>Data number error<br/>P code macro variable number(number) is wrong.</content>
        </item>
        <item>
            <name>EW_DATA</name>
            <content>Data error<br/>Value of P code macro variable(mcr_val, dec_val) is out of available range.</content>
        </item>
        <item>
            <name>EW_NOOPT</name>
            <content>No option<br/>This function needs the macro-executor option.</content>
        </item>
        <item class="xis">
            <name>EW_PASSWD</name>
            <content>Specified P code macro variable cannot be written because the data is protected.<br/>
                    ( Series 160i/180i/210i, 0i )</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>
        <need>The macro-executor function.</need>
        <type class="xis">
            <li>Series 160/180, 160i/180i</li>
            This function is related to the high-speed cycle cutting option.
        </type>
    </option>







    <parameter>
        <add>
            <p>But, this function is related to the compile parameter of the macro-executor. See the "PROGRAMING MANUAL" of the macro-executor for details of the compile parameter.</p>
        </add>
    </parameter>






    
    <mode>
    </mode>




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

        <is>
            <m>
                <fs30is>O</fs30is>
            </m>
            <t>
                <fs30is>O</fs30is>
            </t>
        </is>
    </support>







    
    <reference>
        <item>
            <name>cnc_rdpmacro</name>
            <file>ncdata/cnc_rdpmacro.htm</file>
        </item>
        <item>
            <name>cnc_rdpmacror</name>
            <file>ncdata/cnc_rdpmacror.htm</file>
        </item>
        <item>
            <name>cnc_wrpmacror</name>
            <file>ncdata/cnc_wrpmacror.htm</file>
        </item>
        <item>
            <name>cnc_rdpmacror2</name>
            <file>ncdata/cnc_rdpmacror2.htm</file>
        </item>
        <item>
            <name>cnc_wrpmacror2</name>
            <file>ncdata/cnc_wrpmacror2.htm</file>
        </item>
        <item>
            <name>cnc_rdpmacroinfo</name>
            <file>ncdata/cnc_rdpmacroinfo.htm</file>
        </item>
        <item>
            <name>cnc_getpmactype</name>
            <file>ncdata/cnc_getpmactype.htm</file>
        </item>
        <item>
            <name>cnc_setpmactype</name>
            <file>ncdata/cnc_setpmactype.htm</file>
        </item>
    </reference>






    
    <example>
<vc>
The following program writes the specified value in the specified P code macro
variable.

#include "fwlib32.h"

/* number is variable number to be written. */
/* value is value to be written. */
/* dec is decimal digit number. */
short example( long number, long value, short dec )
{
        short ret ;
        ret = cnc_wrpmacro( h, number, value, dec ) ;
        return ( ret ) ;
}
</vc>
    </example>



  </func>
</root>
