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

<root>
  <func>


    <title>cnc_settimer</title>



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



    <doc>
        <cmn>
            <p>Sets the date or time data to the calendar timer device of the CNC unit.</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>buf</name>
                    <type>in</type>
                    <content>
                        <p>
                            Pointer to the IODBTIMER structure including the date or time of CNC.
                        </p>
The IODBTIMER structure is as follows.
<pre>
typedef struct iodbtimer {
        short   type ;          /* Spec. of date or time. */
        short   dummy ;         /* Not used. */
        union {
                struct {
                        short   year ;  /* Year. */
                        short   month ; /* Month. */
                        short   date ;  /* Date. */
                } date ;
                struct {
                        short   hour ;  /* Hour. */
                        short   minute ;/* Minute. */
                        short   second ;/* Second. */
                } time ;
        } data ;
} IODBTIMER ;
</pre>

           <p>Specify one of the following values in "buf.type". (It is impossible to set both date and time simultaneously.)

                <table class="dd" border="1" frame="hsides" rules="groups">
                    <thead>
                    <tr>
                        <th>buf.type</th>
                        <th>Data to be set</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td>0</td>
                        <td>Sets date</td>
                    </tr>
                    <tr>
                        <td>1</td>
                        <td>Sets time</td>
                    </tr>
                    </tbody>
                </table>
                </p>

            <p>Store the date value or time value in each member of "buf.data.date" or "buf.data.time" with binary format as follows.
            <table class="dd" border="1" frame="hsides" rules="groups">
                <thead>
                <tr>
                    <th>Member</th>
                    <th>Setting data</th>
                    <th>Range of value</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td valign="top">buf.data.date.year</td>
                    <td valign="top">Year</td>
                    <td>1987 - 2086(Series 160/180/210, 160i/180i/210i, 0i, Power Mate i)<br/>
                        1986 - 2086(Series 150)<br/>
                        1995 - 2094(Series 150i)<br/>
                        1997 - 2096(Series 300i/310i/320i)</td>
                </tr>
                <tr>
                    <td>buf.data.date.month</td>
                    <td>Month</td>
                    <td>1 - 12</td>
                </tr>
                <tr>
                    <td>buf.data.date.date</td>
                    <td>Date</td>
                    <td>1 - 31</td>
                </tr>
                <tr>
                    <td>buf.data.time.hour</td>
                    <td>Hour</td>
                    <td>0 - 23</td>
                </tr>
                <tr>
                    <td>buf.data.time.minute</td>
                    <td>Minute</td>
                    <td>0 - 59</td>
                </tr>
                <tr>
                    <td>buf.data.time.second</td>
                    <td>Second</td>
                    <td>0 - 59</td>
                </tr>
                </tbody>
            </table>
            </p>
                 <p>That is, the following data can be set for CNC.
            <dl class="dd">
                <dt>Series 160/180/210, 160i/180i/210i, 0i, Power Mate i</dt>
                <dd>from "00:00:00, Jan. 1, 1987" to "23:59:59, Dec. 31, 2086"</dd>
                <dt>Series 150</dt>
                <dd>from "00:00:00, Jan. 1, 1986" to "23:59:59, Dec. 31, 2086"</dd>
                <dt>Series 150i</dt>
                <dd>from "00:00:00, Jan. 1, 1995" to "23:59:59, Dec. 31, 2094"</dd>
                <dt>Series 300i/310i/320i</dt>
                <dd>from "00:00:00, Jan. 1, 1997" to "23:59:59, Dec. 31, 2096"</dd>
            </dl>
                </p>

For Series 160i/180i/210i, 0i, and Power Mate i, this function doesn't check the validity of date format (buf.data.date.*) strictly. For example, "Feb. 31" can be set. In this case, "Feb. 31" is read by <a href="Misc/cnc_gettimer.htm" target="_parent">cnc_gettimer</a> function, and "Feb. 31" is displayed on the setting screen of CNC. <p/>

For Series 150/150i, 300i/310i/320i, this function check the validity of date format (buf.data.date.*) strictly. When you try setting "Apr. 31" or "Feb. 29 (not in a leap year)", this function returns EW_DATA. <p/>

                    </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>buf</name>
                        <type>in</type>
                        <content>
                            <p>
                                Pointer to the IODBTIMER structure including the date or time of CNC.
                            </p>
The IODBTIMER structure is as follows.
<pre>
typedef struct iodbtimer {
        short   type ;          /* Spec. of date or time. */
        short   dummy ;         /* Not used. */
        union {
                struct {
                        short   year ;  /* Year. */
                        short   month ; /* Month. */
                        short   date ;  /* Date. */
                } date ;
                struct {
                        short   hour ;  /* Hour. */
                        short   minute ;/* Minute. */
                        short   second ;/* Second. */
                } time ;
        } data ;
} IODBTIMER ;
</pre>

               <p>Specify one of the following values in "buf.type". (It is impossible to set both date and time simultaneously.)

                    <table class="dd" border="1" frame="hsides" rules="groups">
                        <thead>
                        <tr>
                            <th>buf.type</th>
                            <th>Data to be set</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>0</td>
                            <td>Sets date</td>
                        </tr>
                        <tr>
                            <td>1</td>
                            <td>Sets time</td>
                        </tr>
                        </tbody>
                    </table>
                    </p>

                <p>Store the date value or time value in each member of "buf.data.date" or "buf.data.time" with binary format as follows.
                <table class="dd" border="1" frame="hsides" rules="groups">
                    <thead>
                    <tr>
                        <th>Member</th>
                        <th>Setting data</th>
                        <th>Range of value</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td valign="top">buf.data.date.year</td>
                        <td valign="top">Year</td>
                        <td>1997 - 2096</td>
                    </tr>
                    <tr>
                        <td>buf.data.date.month</td>
                        <td>Month</td>
                        <td>1 - 12</td>
                    </tr>
                    <tr>
                        <td>buf.data.date.date</td>
                        <td>Date</td>
                        <td>1 - 31</td>
                    </tr>
                    <tr>
                        <td>buf.data.time.hour</td>
                        <td>Hour</td>
                        <td>0 - 23</td>
                    </tr>
                    <tr>
                        <td>buf.data.time.minute</td>
                        <td>Minute</td>
                        <td>0 - 59</td>
                    </tr>
                    <tr>
                        <td>buf.data.time.second</td>
                        <td>Second</td>
                        <td>0 - 59</td>
                    </tr>
                    </tbody>
                </table>
                </p>
                <p>
This function check the validity of date format (IODBTIMER1) strictly. When you try setting "Apr. 31" or "Feb. 29 (not in a leap year)", this function returns EW_DATA. 
                </p>
                </content>
                </item>
                </vc>
            </hssb>
        </is>
        <!-- is Argument End -->
    </argument>



    <errcode>
        <item>
            <name>EW_NUMBER</name>
            <content>
                  Incorrect spec. of date or time "buf.type".
            </content>
        </item>
        <item>
            <name>EW_DATA</name>
            <content>Incorrect date or time data.</content>
        </item>
        <item>
            <name>EW_REJECT</name>
            <content>
                     Failed to set the data to the calendar timer device.<br/>
                     Any hardware may be out of order. 
            </content>
        </item>
        <add></add>
        <is>
            <item>
                <name>EW_NUMBER</name>
                <content>
                Incorrect spec. of date or time "buf.type".
                </content>
            </item>
            <item>
                <name>EW_DATA</name>
                <content>Incorrect date or time data.</content>
            </item>
            <item>
                <name>EW_REJECT</name>
                <content>
                         Failed to set the data to the calendar timer device.<br/>
                         Any hardware may be out of order. 
                </content>
            </item>
        </is>
    </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>
        <add><b></b></add>
        <is>
            <!-- M -->
            <m>
                <fs30is>O</fs30is>
            </m>
            <!-- T -->
            <t>
                <fs30is>O</fs30is>
            </t>
        </is>
    </support>



    <reference>
        <item>
            <name>cnc_gettimer</name>
            <file>Misc/cnc_gettimer.htm</file>
        </item>
    </reference>



    <example></example>



  </func>
</root>
