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

<root>
  <func>


    <title>pmc_wrpmcrng</title>



    <declare>
      <vc>
        <include>#include "fwlib32.h"</include>
        <prottype>FWLIBAPI short WINAPI pmc_wrpmcrng(unsigned short FlibHndl, short length,IODBPMC *buf);</prottype>
      </vc>
    </declare>



    <doc>
        <cmn>
            <p>
                Writes the PMC data of the specified PMC address/range.<br/>
                <br/>
                This function is used to exchange the data between the application on
                MMC function and LADDER software on PMC.
            </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>length</name>
                    <type>in</type>
                    <content>
                        Specify the data block length.
                        <table class="dd">
                            <tr>
                                <td>data_type is 0(byte type)</td>
                                <td>:</td>
                                <td>length = 8 + N</td>
                            </tr>
                            <tr>
                                <td>data_type is 1(word type)</td>
                                <td>:</td>
                                <td>length = 8 + N &#215; 2</td>
                            </tr>
                            <tr>
                                <td>data_type is 2(long type)</td>
                                <td>:</td>
                                <td>length = 8 + N &#215; 4</td>
                            </tr>
                        </table>
                        * N is the number of written data.
                    </content>
                </item>
                <item>
                    <name>buf</name>
                    <type>in</type>
                    <content>
                        <p>
                            Pointer to the IODBPMC structure.<br/>
                            The IODBPMC structure is as follows.
                        </p>
<pre>
typedef struct  iodbpmc {
    short   type_a ;    /* Kind of PMC address */
    short   type_d ;    /* Type of the PMC data */
    short   datano_s ;  /* Start PMC address number */
    short   datano_e ;  /* End PMC address number */
    union {
        char    cdata[N] ;/* The PMC data(byte type) */
        short   idata[N] ;/*             (word type) */
        long    ldata[N] ;/*             (long type) */
    } u ;           /* N is the number of written data */
} IODBPMC ;
</pre>
                        <dl>
                            <dt>type_a</dt>
                                <dd>Specify the identification code corresponding to the kind of the PMC address.</dd>
                            <dt>type_d</dt>
                                <dd>Specify the type of the PMC data.<br/>
                                    It must be the same one as the type of data of the PMC side.</dd>
                                <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>Long type</td>
                                    </tr>
                                </table>
                            <dt>datano_s</dt>
                                <dd>Specify the start PMC address number.</dd>
                            <dt>datano_e</dt>
                                <dd>Specify the end PMC address number.</dd>
                        </dl>
                        See "The referenceable range of PMC data" of "Read PMC data(area specified)
                        (<a href="Pmc/pmc_rdpmcrng.htm" target="_parent">pmc_rdpmcrng</a>)" about the kind of the
                        PMC address, the start address, and the end address.
                    </content>
                </item>

                <add>
                    <p class="label">Example of specifying argument</p>
                    <ol>
                        <li>250 is written in D0100(It is assumed the word type)</li>
                            <table class="dd">
                                <tr>
                                    <td>buf.type_a</td>
                                    <td>9</td>
                                </tr>
                                <tr>
                                    <td>buf.type_d</td>
                                    <td>1</td>
                                </tr>
                                <tr>
                                    <td>buf.datano_s</td>
                                    <td>100</td>
                                </tr>
                                <tr>
                                    <td>buf.datano_e</td>
                                    <td>101</td>
                                </tr>
                                <tr>
                                    <td>length</td>
                                    <td>8+2&#215;1 (=10)</td>
                                </tr>
                                <tr>
                                    <td>buf.u.idata[0]</td>
                                    <td>250</td>
                                </tr>
                            </table>
             
                        <li>0 is written all of R0200,..,R0209(It is assumed byte type)</li>
                            <table class="dd">
                                <tr>
                                    <td>buf.type_a</td>
                                    <td>5</td>
                                </tr>
                                <tr>
                                    <td>buf.type_d</td>
                                    <td>0</td>
                                </tr>
                                <tr>
                                    <td>buf.datano_s</td>
                                    <td>200</td>
                                </tr>
                                <tr>
                                    <td>buf.datano_e</td>
                                    <td>209</td>
                                </tr>
                                <tr>
                                    <td>length</td>
                                    <td>8+1&#215;10 (=18)</td>
                                </tr>
                                <tr>
                                    <td>buf.u.cdata[0]<br/>
                                    ,..,buf.u.cdata[9]</td>
                                    <td>0 all</td>
                                </tr>
                            </table>
                    </ol>
                </add>
            </vc>
        </common>
    </argument>



    <errcode>
        <item>
            <name>EW_NOPMC</name>
            <content>
                There is no PMC.
            </content>
        </item>
        <item>
            <name>EW_LENGTH</name>
            <content>
                Data block length error<br/>
                Size of IODBPMC structure(length) is wrong.
            </content>
        </item>
        <item>
            <name>EW_RANGE</name>
            <content>
                Address range error<br/>
                Address range error PMC address number(datano_s,datano_e) is wrong.
            </content>
        </item>
        <item>
            <name>EW_ATTRIB</name>
            <content>
                Data attribute error<br/>
                Kind of PMC address(type_a) or type of PMC data (type_d) is wrong.
            </content>
        </item>
        <item class="xis">
            <name>EW_PASSWD</name>
            <content>
                The data of specified range cannot be written because the data is protected. <br/>
                (Series 160i/180i/210i, 0i) 
            </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>
    </option>



    <parameter></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>

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



    <reference>
        <item>
            <name>pmc_rdpmcrng</name>
            <file>Pmc/pmc_rdpmcrng.htm</file>
        </item>
        <item>
            <name>pmc_rdpmcinfo</name>
            <file>Pmc/pmc_rdpmcinfo.htm</file>
        </item>
    </reference>



  </func>
</root>
