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

<root>
  <func>


    <title>cnc_sramget</title>



    <declare>
      <vc>
        <include>#include "fwlib32.h"</include>
        <prottype>
            FWLIBAPI short WINAPI cnc_sramget(unsigned short FlibHndl, short *stat, void *data, long *length);
        </prottype>
      </vc>
    </declare>



    <doc>
        <cmn>
            Reads the S-RAM data from CNC.<br/>
            The SRAM data which was read by this function should be restored by using the Boot function.(The SRAM data cannot be restored while the system is running).<br/>
            It is necessary to make the file having the file name which was acquired by <a href="Misc/cnc_getsraminfo.htm" target="_parent">cnc_getsraminfo</a> function to restore the SRAM data by using the Boot function.<br/>
            Refer to the following for the method of making the file for the S-RAM data.<p/>
            The procedure of reading S-RAM data and storing the data to the file is as follows. <p/>

            <p><img src="Misc/sramget.gif"></img></p>

            The total size which can be read finally is S-RAM size(sramsize) acquired by the <a href="Misc/cnc_getsraminfo.htm" target="_parent">cnc_getsraminfo</a> function. <p/>

            When you store the read SRAM data to the file, please store the divided S-RAM data into the files whose names were acquired by <a href="Misc/cnc_getsraminfo.htm" target="_parent">cnc_getsraminfo</a> function in order of the file names.<br/>
            The size of one file is calculated from information of <a href="Misc/cnc_getsraminfo.htm" target="_parent">cnc_getsraminfo</a> as follows. 
            <blockquote>
                    <table>

<tr> <td></td>                       <td></td>  <td align="center">Size of S-RAM data (sramsize)</td> </tr>
<tr> <td>Size of one file</td> <td>=</td> <td><hr/></td> </tr>
<tr> <td></td>                       <td></td>  <td align="center">Number of file division (dibnumber)</td> </tr>
                    </table><p/>
                <ul>
                    <table>
                        <tr> <td rowspan="5" valign="top">Ex.)</td> <td colspan="3">i Series(1Mbyte S-RAM)</td> </tr>
                        <tr> <td>Information acquired by <a href="Misc/cnc_getsraminfo.htm" target="_parent">cnc_getsraminfo</a></td></tr>
                        <tr><td>
                        <table class="dd">
                            <tr><td>sramsize</td>         <td>=</td> <td>1Mbyte(1048576byte) = 1024Kbyte</td> </tr>
                            <tr><td>divnumber</td>        <td>=</td> <td>2</td>                               </tr>
                            <tr><td>fname[0]</td>         <td>=</td> <td>"SRAM1_0A.FDB"</td>                  </tr>
                            <tr><td>fname[1]</td>         <td>=</td> <td>"SRAM1_0B.FDB"</td>                  </tr>
                            <tr><td>Size of one file</td> <td>=</td> <td>1024Kbyte / 2 = 512Kbyte</td>          </tr>
                            <tr><td><p/></td></tr>
                        </table></td></tr>
                        <tr><td>Make the file whose size is 512 Kbyte in order of SRAM1_0A.FDB, SRAM1_0B.FDB.</td></tr>
                    </table>
                </ul>
            </blockquote>
        </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>stat</name>
                    <type>out</type>
                    <content>
                        <p>Specify the address of the variable by which the reading state of S-RAM is stored.</p>
                       <table class="dd">
                            <tr>
                                <td>0</td>
                                <td>:</td>
                                <td>End of reading process</td>
                            </tr>
                            <tr>
                                <td>1</td>
                                <td>:</td>
                                <td>Reading process continued</td>
                            </tr>
                        </table>
                        <p>Call the <a href="Misc/cnc_sramgetend.htm" target="_parent">cnc_sramgetend</a> function in case of stat=0. </p>
                    </content>
                </item>
                <item>
                    <name>data</name>
                    <type>out</type>
                    <content>
                        <p>Pointer to the variable to which the reading data is stored.<br/>
                        Specify the pointer of the variable to which the S-RAM data is stored.
                        </p>
                    </content>
                </item>
                <item>
                    <name>length</name>
                    <type>in/out</type>
                    <content>
                        <p>
                        Pointer to the variable to which the data length was set.<br/>
                        Specify the size in byte which you want to read to the variable. After executing this function, the size of data which was actually read is set.<br/>
                        The maximum size which can be read at a time is S-RAM size (sramsize) acquired by the <a href="Misc/cnc_getsraminfo.htm" target="_parent">cnc_getsraminfo</a> function.
                        </p>
                    </content>
                </item>
            </vc>
        </common>
    </argument>



    <errcode>
        <item>
            <name>EW_FUNC</name>
            <content>Unavailable or <a href="Misc/cnc_sramgetstart.htm" target="_parent">cnc_sramgetstart</a> function has not been executed</content>
        </item>
        <item>
            <name>EW_LENGTH</name>
            <content>Number of data(length) is wrong. (The value of 0 or less was specified). </content>
        </item>
        <item>
            <name>EW_BUFFER</name>
            <content>Buffer empty/full<br/>Retry because the buffer is empty.</content>
        </item>
        <item>
            <name>EW_REJECT</name>
            <content>CNC is not in "Emergency" state.</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>
        <add></add>
    </option>



    <parameter></parameter>



    <mode>
        <cmn>
        This function can be used in any CNC mode.
            <ul>
                <li>Set the 'Emergency' state when reading the contents of S-RAM.<br/>
Do not operate the system while reading when the system (FAPT etc.) does not have "Emergency" state.
If the system is operated, the contents of the S-RAM data is not guaranteed. </li>
            </ul>
        </cmn>
        <add></add>
    </mode>



    <support>
        <m>
            <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>X</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>X</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>O</fs16i>
            <fs18i>O</fs18i>
        </w>
        <pw>
            <d>O</d>
            <h>O</h>
        </pw>
        <add><b></b></add>
    </support>



    <reference>
        <item>
            <name>cnc_getsraminfo</name>
            <file>Misc/cnc_getsraminfo.htm</file>
        </item>
        <item>
            <name>cnc_sramgetstart</name>
            <file>Misc/cnc_sramgetstart.htm</file>
        </item>
        <item>
            <name>cnc_sramgetend</name>
            <file>Misc/cnc_sramgetend.htm</file>
        </item>
    </reference>



    <example></example>



  </func>
</root>
