




                劇劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劉
                劆                                          劆
                劆      俥俙俶倀俠 俹倧倵倕倰 俵倎倲倕      劆
                劆                                          劆
                劆          儔僀僽儔儕娭悢愢柧彂            劆
                劆                                          劆
                劆                                          劆
                劋劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劊


                                亅栚  師亅

                娭悢堦棗                        ....... 2
                儔僀僽儔儕偺栠傝抣              ....... 5
                捠怣娭學                        ....... 7
                惂屼幉娭學                      ....... 11
                僾儘僌儔儉娭學                  ....... 33
                俶俠梡僨乕僞僼傽僀儖娭學        ....... 66
                憖嶌棜楌僨乕僞娭學              ....... 112
                幉堏摦惂屼娭學                  ....... 129
                偦偺懠                          ....... 149
                俹俵俠娭學                      ....... 195

娭悢堦棗


 捠怣娭學
-------------------------------------------------------------------------------
  娭悢柤                婡  擻  撪  梕
-------------------------------------------------------------------------------
  ( 1) cnc_allclibhndl  儔僀僽儔儕僴儞僪儖偺庢摼
  ( 2) cnc_allclibhndl2 儔僀僽儔儕僴儞僪儖偺庢摼2
  ( 3) cnc_freelibhndl  儔僀僽儔儕僴儞僪儖偺夝曻
-------------------------------------------------------------------------------


 惂屼幉娭學
-------------------------------------------------------------------------------
  娭悢柤                婡  擻  撪  梕
-------------------------------------------------------------------------------
  ( 1) cnc_actf         惂屼幉偺幚懍搙乮俥乯偺儕乕僪
  ( 2) cnc_absolute     惂屼幉偺愨懳埵抲偺儕乕僪
  ( 3) cnc_machine      惂屼幉偺婡夿埵抲偺儕乕僪
  ( 4) cnc_relative     惂屼幉偺憡懳埵抲偺儕乕僪
  ( 5) cnc_distance     惂屼幉偺巆堏摦検偺儕乕僪
  ( 6) cnc_skip         惂屼幉偺僗僉僢僾埵抲偺儕乕僪
  ( 7) cnc_srvdelay     惂屼幉偺僒乕儃抶傟検偺儕乕僪
  ( 8) cnc_accdecdly    惂屼幉偺壛尭懍抶傟検偺儕乕僪
  ( 9) cnc_rddynamic    僟僀僫儈僢僋僨乕僞偺堦妵儕乕僪
  (10) cnc_wrrelpos     惂屼幉偺憡懳埵抲偺僆儕僕儞乛僾儕僙僢僩
-------------------------------------------------------------------------------


 僾儘僌儔儉娭學
-------------------------------------------------------------------------------
  娭悢柤                婡  擻  撪  梕
-------------------------------------------------------------------------------
  ( 1) cnc_dwnstart     搊榐梡俶俠巜椷僨乕僞偺弌椡偺奐巒
  ( 2) cnc_download     搊榐梡俶俠巜椷僨乕僞偺弌椡
  ( 3) cnc_dwnend       搊榐梡俶俠巜椷僨乕僞偺弌椡偺廔椆
  ( 4) cnc_upstart      俶俠巜椷僨乕僞偺儕乕僪偺奐巒
  ( 5) cnc_upload       俶俠巜椷僨乕僞偺儕乕僪
  ( 6) cnc_upend        俶俠巜椷僨乕僞偺儕乕僪偺廔椆
  ( 7) cnc_search       巜掕僾儘僌儔儉偺僒乕僠
  ( 8) cnc_delall       慡僾儘僌儔儉偺嶍彍
  ( 9) cnc_delete       巜掕僾儘僌儔儉偺嶍彍
  (10) cnc_rdprogdir    僾儘僌儔儉僨傿儗僋僩儕偺儕乕僪
  (11) cnc_rdproginfo   僾儘僌儔儉忣曬偺儕乕僪
  (12) cnc_rdprgnum     幚峴拞偺僾儘僌儔儉斣崋偺儕乕僪
  (13) cnc_rdseqnum     幚峴拞偺僔乕働儞僗斣崋偺儕乕僪
  (14) cnc_rdexecprog   幚峴拞僾儘僌儔儉偺儕乕僪
  (15) cnc_wrmdiprog    俵俢俬塣揮梡僾儘僌儔儉偺弌椡
  (16) cnc_rdmdipntr    俵俢俬塣揮梡幚峴億僀儞僞偺儕乕僪
  (17) cnc_wrmdipntr    俵俢俬塣揮梡幚峴億僀儞僞偺儔僀僩
  (18) cnc_seqsrch      僔乕働儞僗斣崋偺僒乕僠
  (19) cnc_rewind       僇乕僜儖偺摢弌偟
-------------------------------------------------------------------------------



 俶俠梡僼傽僀儖僨乕僞娭學
-------------------------------------------------------------------------------
  娭悢柤                婡  擻  撪  梕
-------------------------------------------------------------------------------
  ( 1) cnc_rdtofs       岺嬶僆僼僙僢僩検偺儕乕僪
  ( 2) cnc_wrtofs       岺嬶僆僼僙僢僩検偺儔僀僩
  ( 3) cnc_rdtofsr      岺嬶僆僼僙僢僩検偺儕乕僪乮斖埻巜掕乯
  ( 4) cnc_wrtofsr      岺嬶僆僼僙僢僩検偺儔僀僩乮斖埻巜掕乯
  ( 5) cnc_rdtofsinfo   岺嬶僆僼僙僢僩忣曬偺儕乕僪
  ( 6) cnc_rdparam      僷儔儊乕僞偺儕乕僪
  ( 7) cnc_wrparam      僷儔儊乕僞偺儔僀僩
  ( 8) cnc_rdparar      僷儔儊乕僞偺儕乕僪乮斖埻巜掕乯
  ( 9) cnc_wrparas      僷儔儊乕僞偺儔僀僩乮暋悢屄巜掕乯
  (10) cnc_rdparainfo   僷儔儊乕僞忣曬偺儕乕僪
  (11) cnc_rdsetr       僙僢僥傿儞僌僨乕僞偺儕乕僪乮斖埻巜掕乯
  (12) cnc_wrsets       僙僢僥傿儞僌僨乕僞偺儔僀僩乮暋悢屄巜掕乯
  (13) cnc_rdmacro      僇僗僞儉儅僋儘曄悢偺儕乕僪
  (14) cnc_wrmacro      僇僗僞儉儅僋儘曄悢偺儔僀僩
  (15) cnc_rdmacror     僇僗僞儉儅僋儘曄悢偺儕乕僪乮斖埻巜掕乯
  (16) cnc_wrmacror     僇僗僞儉儅僋儘曄悢偺儔僀僩乮斖埻巜掕乯
  (17) cnc_rdmacroinfo  僇僗僞儉儅僋儘曄悢忣曬偺儕乕僪
  (18) cnc_getmactype   僇僗僞儉儅僋儘曄悢僞僀僾偺庢摼
  (19) cnc_setmactype   僇僗僞儉儅僋儘曄悢僞僀僾偺愝掕
-------------------------------------------------------------------------------


 憖嶌棜楌僨乕僞
-------------------------------------------------------------------------------
  娭悢柤                婡  擻  撪  梕
-------------------------------------------------------------------------------
  ( 1) cnc_stopophis    棜楌僨乕僞偺僒儞僾儕儞僌偺掆巭
  ( 2) cnc_startophis   棜楌僨乕僞偺僒儞僾儕儞僌偺嵞奐
  ( 3) cnc_rdophisno    憖嶌棜楌僨乕僞悢偺儕乕僪
  ( 4) cnc_rdophistry   憖嶌棜楌僨乕僞偺儕乕僪
  ( 5) cnc_rdalmhisno   傾儔乕儉棜楌僨乕僞悢偺儕乕僪
  ( 6) cnc_rdalmhistry  傾儔乕儉棜楌僨乕僞偺儕乕僪
  ( 7) cnc_clearophis   憖嶌棜楌僨乕僞偺僋儕傾
  ( 8) cnc_rdhissgnl    憖嶌棜楌懳徾怣崋偺儕乕僪
  ( 9) cnc_wrhissgnl    憖嶌棜楌懳徾怣崋偺愝掕
-------------------------------------------------------------------------------


 幉堏摦惂屼娭學
-------------------------------------------------------------------------------
  娭悢柤                婡  擻  撪  梕
-------------------------------------------------------------------------------
 *( 1) cnc_opdi         怣崋憖嶌巜椷
 *( 2) cnc_refpoint     儕僼傽儗儞僗揰暅婣
 *( 3) cnc_abspoint     傾僽僜儕儏乕僩堏摦巜椷
 *( 4) cnc_incpoint     僀儞僋儗儊儞僞儖堏摦巜椷
 *( 5) cnc_dwell        僪僁僄儖
 *( 6) cnc_coordre      嵗昗宯愝掕
 *( 7) cnc_exebufstat   幚峴僶僢僼傽忬懺偺撉庢

 *( 8) cnc_finstate     幚峴姰椆忬懺偺撉庢
 *( 9) cnc_setfin       幚峴姰椆忬懺偺夝彍
-------------------------------------------------------------------------------
 * 偙偺娭悢偼丄Power Mate-D 偱偼巊梡偱偒傑偣傫丅


 偦偺懠
-------------------------------------------------------------------------------
  娭悢柤                婡  擻  撪  梕
-------------------------------------------------------------------------------
  ( 1) cnc_sysinfo      俠俶俠僔僗僥儉忣曬偺儕乕僪
  ( 2) cnc_sysconfig    俠俶俠僔僗僥儉峔惉忣曬偺儕乕僪
  ( 3) cnc_statinfo     俠俶俠僗僥乕僞僗忣曬偺儕乕僪
  ( 4) cnc_alarm        傾儔乕儉僗僥乕僞僗偺儕乕僪
  ( 5) cnc_rdalminfo    傾儔乕儉忣曬偺儕乕僪
  ( 6) cnc_modal        儌乕僟儖僨乕僞偺儕乕僪
  ( 7) cnc_diagnoss     僟僀傾僌僲乕僘僨乕僞偺儕乕僪
  ( 8) cnc_diagnosr     僟僀傾僌僲乕僘僨乕僞偺儕乕僪乮斖埻巜掕乯
  ( 9) cnc_getfigure    嵟戝桳岠寘悢丄彫悢揰埲壓寘悢偺儕乕僪
  (10) cnc_rdcurrent    僒乕儃挷惍梡幚揹棳偺儕乕僪
  (11) cnc_rdsrvspeed   僒乕儃挷惍梡幚懍搙偺儕乕僪
  (12) cnc_rdloopgain   僒乕儃挷惍梡儖乕僾僎僀儞偺儕乕僪
  (13) cnc_rdopmsg      僆儁儗乕僞儊僢僙乕僕偺儕乕僪
  (14) cnc_rdopnlsgnl   僜僼僩僆儁僷僱偺弌椡怣崋僀儊乕僕偺儕乕僪
  (15) cnc_wropnlsgnl   僜僼僩僆儁僷僱偺弌椡怣崋偺儔僀僩
  (16) cnc_rdopnlgnrl   僜僼僩僆儁僷僱偺斈梡弌椡怣崋僀儊乕僕偺儕乕僪
  (17) cnc_wropnlgnrl   僜僼僩僆儁僷僱偺斈梡弌椡怣崋偺儔僀僩
  (18) cnc_rdopnlgsname 僜僼僩僆儁僷僱偺斈梡怣崋柤徧偺儕乕僪
  (19) cnc_wropnlgsname 僜僼僩僆儁僷僱偺斈梡怣崋柤徧偺愝掕
-------------------------------------------------------------------------------


 俹俵俠娭學
-------------------------------------------------------------------------------
  娭悢柤                婡  擻  撪  梕
-------------------------------------------------------------------------------
  ( 1) pmc_rdpmcrng     PMC偺擟堄僨乕僞偺儕乕僪(斖埻巜掕)
  ( 2) pmc_wrpmcrng     PMC偺擟堄僨乕僞偺儔僀僩(斖埻巜掕)
  ( 3) pmc_rdpmcinfo    PMC僨乕僞忣曬偺儕乕僪
-------------------------------------------------------------------------------

儔僀僽儔儕偺栠傝抣


+-----------+---------------------------+-----------------------------------+
|   栠傝抣  |         堄      枴        |           愢柧丒懳張曽朄          |
+-----------+---------------------------+-----------------------------------+
| EW_ITHIGHT| 僀儞僥儕僕僃儞僩僞乕儈僫儖| 僨傿僗僋撪偺僨乕僞傪攋夡偡傞嫲傟偑|
|  (-13)    | 偺掅壏傾儔乕儉            | 偁傝傑偡丄揹尮傪愗偭偰偟偽傜偔偟偰|
|           |                           | 偐傜嵞婲摦偟偰壓偝偄丅            |
+-----------+---------------------------+-----------------------------------+
| EW_ITHIGHT| 僀儞僥儕僕僃儞僩僞乕儈僫儖| 僨傿僗僋撪偺僨乕僞傪攋夡偡傞嫲傟偑|
|  (-12)    | 偺崅壏傾儔乕儉            | 偁傝傑偡丄揹尮傪愗偭偰偟偽傜偔偟偰|
|           |                           | 偐傜嵞婲摦偟偰壓偝偄丅            |
+-----------+---------------------------+-----------------------------------+
| EW_BUS    | 僶僗僄儔乕                | Power Mate 偺僶僗僄儔乕偱偡丅     |
|  (-11)    |                           | 僒乕價僗/扴摉晹彁偵偍栤崌偣壓偝偄 |
+-----------+---------------------------+-----------------------------------+
| EW_SYSTEM2| 僔僗僥儉僄儔乕(2)         | Power Mate 偺僔僗僥儉僄儔乕偱偡丅 |
|  (-10)    |                           | 僒乕價僗/扴摉晹彁偵偍栤崌偣壓偝偄 |
+-----------+---------------------------+-----------------------------------+
| EW_HSSB   | 俫俽俽俛偺捠怣僄儔乕      | 俫俽俽俛偺僔儕傾儖働乕僽儖傑偨偼  |
|  (- 9)    |                           | 俬乛俥儃乕僪傪妋擣偟偰偔偩偝偄丅  |
+-----------+---------------------------+-----------------------------------+
| EW_SYSTEM | 僔僗僥儉僄儔乕            | Power Mate 偺僔僗僥儉僄儔乕偱偡丅 |
|  (- 5)    |                           | 僒乕價僗/扴摉晹彁偵偍栤崌偣壓偝偄 |
+-----------+---------------------------+-----------------------------------+
| EW_BUSY   | 價僕傿                    | Power Mate 偺張棟偑廔椆偡傞傑偱懸 |
|  (- 1)    |                           | 偮偐丄儕僩儔僀偟偰偔偩偝偄丅      |
+-----------+---------------------------+-----------------------------------+
| EW_OK     | 惓忢廔椆                  |                                   |
|  (  0)    |                           |                                   |
+-----------+---------------------------+-----------------------------------+
| EW_FUNC   | 僄儔乕乮娭悢枹幚峴丄      | 娭悢偺幚峴偵昁梫側摿掕偺娭悢偑慜傕|
|  (  1)    |         巊梡晄壜乯        | 偭偰幚峴偝傟偰偄傑偣傫丅          |
|           |                           | 傑偨偼丄偦偺娭悢偼巊梡偱偒傑偣傫丅|
+-----------+---------------------------+-----------------------------------+
| EW_LENGTH | 僄儔乕乮僨乕僞僽儘僢僋挿丄| 僨乕僞僽儘僢僋挿丄僨乕僞屄悢傪挷嵏|
|  (  2)    |         僨乕僞屄悢偺岆傝乯| 廋惓偟偰偔偩偝偄丅                |
+-----------+---------------------------+-----------------------------------+
| EW_NUMBER | 僄儔乕乮僨乕僞斣崋偺岆傝乯| 僨乕僞斣崋傪挷嵏丄廋惓偟偰偔偩偝偄|
|  (  3)    |                           |                                   |
+-----------+---------------------------+-----------------------------------+
| EW_ATTRIB | 僄儔乕乮僨乕僞懏惈偺岆傝乯| 僨乕僞懏惈傪挷嵏丄廋惓偟偰偔偩偝偄|
|  (  4)    |                           |                                   |
+-----------+---------------------------+-----------------------------------+
|           |                           | 僨乕僞傪挷嵏丄廋惓偟偰偔偩偝偄丅  |
|           |                           |   丒巜掕僾儘僌儔儉偺嶍彍          |
| EW_DATA   | 僄儔乕乮僨乕僞偺岆傝乯    |   丒巜掕僾儘僌儔儉偺僒乕僠        |
|  (  5)    |                           |   丒俶俠巜椷僨乕僞偺擖椡偺奐巒    |
|           |                           | 偱偼丄巜掕僾儘僌儔儉偑尒偮偐傜側偄|
|           |                           | 偲偄偆堄枴偱偡丅                  |
+-----------+---------------------------+-----------------------------------+
| EW_NOOPT  | 僄儔乕乮僆僾僔儑儞側偟乯  | 奩摉偡傞俶俠僆僾僔儑儞偑偁傝傑偣傫|
|  (  6)    |                           |                                   |

+-----------+---------------------------+-----------------------------------+
| EW_PROT   | 僄儔乕乮儔僀僩僾儘僥僋僩乯| 彂偒崬傒嬛巭偱偡丅                |
|  (  7)    |                           |                                   |
+-----------+---------------------------+-----------------------------------+
| EW_OVRFLOW| 僄儔乕乮儊儌儕僆乕僶乕    | Power Mate 偺儊儌儕偑僆乕僶乕僼儘 |
|  (  8)    |         僼儘乕乯          | 偟傑偟偨丅                        |
+-----------+---------------------------+-----------------------------------+
| EW_PARAM  | 僄儔乕乮Power Mate 僷儔儊 | Power Mate 僷儔儊乕僞偺愝掕偵岆傝 |
|  (  9)    |         乕僞偺岆傝乯      | 偑偁傝傑偡丅                      |
+-----------+---------------------------+-----------------------------------+
|           |                           | 僶僢僼傽偑嬻丄傑偨偼僼儖忬懺偱偡丅|
| EW_BUFFER | 僄儔乕乮僶僢僼傽嬻乛僼儖乯| Power Mate 偺張棟偑廔椆偡傞傑偱懸 |
|  ( 10)    |                           | 偮偐丄儕僩儔僀偟偰偔偩偝偄丅      |
+-----------+---------------------------+-----------------------------------+
| EW_PATH   | 僄儔乕乮宯摑斣崋偺岆傝乯  | 宯摑斣崋偵岆傝偑偁傝傑偡丅        |
|  ( 11)    |                           |                                   |
+-----------+---------------------------+-----------------------------------+
| EW_MODE   | 僄儔乕乮Power Mate 偺儌乕 | Power Mate 偺儌乕僪偑堎側傝傑偡丅 |
|  ( 12)    |         僪偺岆傝乯        | Power Mate偺儌乕僪傪曄峏偟偰偔偩  |
|           |                           | 偝偄丅                            |
+-----------+---------------------------+-----------------------------------+
| EW_REJECT |僄儔乕乮俠俶俠懁張棟偺幚峴 | Power Mate偵傛傝張棟偺幚峴偑嫅斲偝|
|  ( 13)    |         嫅斲乯            | 傟傑偟偨丅幚峴忦審傪妋擣偟偰偔偩偝|
|           |                           | 偄丅                              |
+-----------+---------------------------+-----------------------------------+

捠怣娭學
-------------------------------------------------------------------------------
  娭悢柤                婡  擻  撪  梕
-------------------------------------------------------------------------------
  ( 1) cnc_allclibhndl  儔僀僽儔儕僴儞僪儖偺庢摼
  ( 2) cnc_allclibhndl2 儔僀僽儔儕僴儞僪儖偺庢摼俀
  ( 3) cnc_freelibhndl  儔僀僽儔儕僴儞僪儖偺夝曻
-------------------------------------------------------------------------------

  ( 1) 儔僀僽儔儕僴儞僪儖偺庢摼

娭悢柤  cnc_allclibhndl

愰尵    #include        "Fwlib32.h"
        short FAR PASCAL cnc_allclibhndl(unsigned short *FlibHndl);

夝愢    儔僀僽儔儕僴儞僪儖傪庢摼偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 2) 儔僀僽儔儕僴儞僪儖偺庢摼俀

娭悢柤  cnc_allclibhndl2

愰尵    #include        "Fwlib32.h"
        short FAR PASCAL cnc_allclibhndl(long node, unsigned short *FlibHndl);

夝愢    儔僀僽儔儕僴儞僪儖傪庢摼偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅

        node    僨僶僀僗偺僲乕僪斣崋傪巜掕偟傑偡丅乮侽乣俈乯

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 3) 儔僀僽儔儕僴儞僪儖偺夝曻

娭悢柤  cnc_freelibhndl

愰尵    #include        "Fwlib32.h"
        short FAR PASCAL cnc_freelibhndl(unsigned short FlibHndl);

夝愢    儔僀僽儔儕僴儞僪儖傪夝曻偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

惂屼幉娭學
-------------------------------------------------------------------------------
  娭悢柤                婡  擻  撪  梕
-------------------------------------------------------------------------------
  ( 1) cnc_actf         惂屼幉偺幚懍搙乮俥乯偺儕乕僪
  ( 2) cnc_absolute     惂屼幉偺愨懳埵抲偺儕乕僪
  ( 3) cnc_machine      惂屼幉偺婡夿埵抲偺儕乕僪
  ( 4) cnc_relative     惂屼幉偺憡懳埵抲偺儕乕僪
  ( 5) cnc_distance     惂屼幉偺巆堏摦検偺儕乕僪
  ( 6) cnc_skip         惂屼幉偺僗僉僢僾埵抲偺儕乕僪
  ( 7) cnc_srvdelay     惂屼幉偺僒乕儃抶傟検偺儕乕僪
  ( 8) cnc_accdecdly    惂屼幉偺壛尭懍抶傟検偺儕乕僪
  ( 9) cnc_rddynamic    僟僀僫儈僢僋僨乕僞偺堦妵儕乕僪
  (10) cnc_wrrelpos     惂屼幉偺憡懳埵抲偺僆儕僕儞乛僾儕僙僢僩
-------------------------------------------------------------------------------

  ( 1) 惂屼幉偺幚懍搙乮俥乯偺儕乕僪

娭悢柤  cnc_actf

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_actf(unsigned short FlibHndl,
                                                        ODBACT *actualfeed);

夝愢    惂屼幉偺幚懍搙乮俥乯傪撉傒弌偟傑偡丅
        幚懍搙偼ODBACT撪偺data偵奿擺偝傟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        actualfeed
                惂屼幉偺幚懍搙傪曉偡ODBACT峔憿懱傊偺億僀儞僞偱偡丅
                ODBACT峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbact {
                        short  dummy[2];                /* 枹巊梡 */
                        long  data;                     /* 幚懍搙乮俥乯*/
                } ODBACT ;

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        壓婰偺NC僾儘僌儔儉偺 O1234/N20 偺僽儘僢僋幚峴拞偵丄埲壓偺僾儘僌儔儉傪
        幚峴偡傞偲 "CURRENT F=1200" 偲昞帵偝傟傑偡丅
        (儈儕擖椡偲偟傑偡丅)

        O1234 ;
        N10 G98 F1200 ;
        N20 G1 X10. Z200.
        N30 ...

#include <stdio.h>
#include "apilib.h"

void example( void )
{
        ODBACT buf ;
        cnc_actf( FlibHndl, &buf ) ;
        printf( "CURRENT F=%ld\n", buf.data ) ;
}

  ( 2) 惂屼幉偺愨懳埵抲偺儕乕僪

娭悢柤  cnc_absolute

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_absolute(unsigned short FlibHndl, short axis,
                                       short length, ODBAXIS *absolute);

夝愢    axis偱巜掕偝傟偨幉偺愨懳埵抲傪撉傒弌偟傑偡丅
        愨懳埵抲偼ODBAXIS撪偺data[0]偵奿擺偝傟傑偡丅

        axis偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝慡幉偺撉傒庢傝傪堦搙偵峴偆偙偲偑偱
        偒傑偡丅偦偺嵺丄奺幉偺愨懳埵抲偼ODBAXIS撪偺data攝楍偵奿擺偝傟傑偡丅

        愨懳埵抲偺彫悢揰埵抲偼丄cnc_getfigure()娭悢偱庢摼偱偒傑偡丅

        儕乕僪偟偨愨懳埵抲偵偼岺嬶挿曗惓検媦傃僒乕儃/壛尭懍抶傟検偑忢偵娷傑
        傟偰偄傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        axis    儕乕僪偡傞幉斣崋傪巜掕偟傑偡丅
                        ALL_AXES : 慡幉巜掕(ALL_AXES : -1)
                          1乣m   : 侾幉巜掕(m :尰嵼偺惂屼幉悢)

        length  僨乕僞僽儘僢僋挿乮ODBAXIS峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅

                               堦幉巜掕                       慡幉巜掕
                ODBAXIS  0劇劅劅劅劉        劅          0劇劅劅劅劉        劅
                          劆dummy 劆        仾           劆dummy 劆        仾
                         2劌劅劅劅劎        劆          2劌劅劅劅劎        劆
                          劆type  劆      length         劆type  劆      length
                         4劌劅劅劅劏劅劅劅劉劆          4劌劅劅劅劏劅劅劅劉劆
                          劆  data[0]     劆伀           劆  data[0]     劆劆
                         8劋劅劅劅劅劅劅劅劊劅          8劌劅劅劅劅劅劅劅劎劆
                                                         乣              乣劆
                                                4+4x(n-1)劌劅劅劅劅劅劅劅劎劆
                                                         劆  data[n-1]   劆伀
                                                    4+4xn劋劅劅劅劅劅劅劅劊劅
                n 偼丄惂屼幉悢偲側傝傑偡丅

        absolute
                奺惂屼幉偺愨懳埵抲傪曉偡ODBAXIS峔憿懱傊偺億僀儞僞偱偡丅
                ODBAXIS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbaxis {
                        short   dummy ;                 /* 枹巊梡 */
                        short   type ;                  /* 幉斣崋 */
                        long    data[MAX_AXIS] ;        /* 惂屼幉偺愨懳埵抲 */
                } ODBAXIS ;                      /* MAX_AXIS : 嵟戝惂屼幉悢 */

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅

        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBAXIS峔憿懱偺僒僀僘(length)偑晄惓偱偡丅
                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(axis)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        俁幉僔僗僥儉偱丄奺幉偺愨懳嵗昗抣偑偦傟偧傟
                戞侾幉          120.005
                戞俀幉          -50.119
                戞俁幉            0.080
        偺帪偵埲壓偺僾儘僌儔儉傪幚峴偡傞偲
                1:  120005
                2:  -50119
                3:      80
        偲昞帵偝傟傑偡丅(儈儕擖椡丄愝掕扨埵偼 IS-B 偱偁傞偲偟傑偡丅)

#include <stdio.h>
#include "apilib.h"
void example( void )
{
        ODBAXIS iodbaxis buf ;
        cnc_absolute( FlibHndl, -1, 4+4*3, &buf ) ;
        printf( "1:%8ld\n2:%8ld\n3:%8ld\n", buf.data[0], buf.data[1],
                buf.data[2] ) ;
}

  ( 3) 惂屼幉偺婡夿埵抲偺儕乕僪

娭悢柤  cnc_machine

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_machine(unsigned short FlibHndl, short axis,
                                              short length, ODBAXIS *machine);

夝愢    axis偱巜掕偝傟偨幉偺婡夿埵抲傪撉傒弌偟傑偡丅
        婡夿埵抲偼ODBAXIS撪偺data[0]偵奿擺偝傟傑偡丅

        axis偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝慡幉偺撉傒庢傝傪堦搙偵峴偆偙偲偑偱
        偒傑偡丅偦偺嵺丄奺幉偺婡夿埵抲偼ODBAXIS撪偺data攝楍偵奿擺偝傟傑偡丅

        婡夿埵抲偺彫悢揰埵抲偼丄cnc_getfigure()娭悢偱庢摼偱偒傑偡丅

        儕乕僪偟偨婡夿埵抲偵偼僒乕儃/壛尭懍抶傟検偑忢偵娷傑傟偰偄傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        axis    儕乕僪偡傞幉斣崋傪巜掕偟傑偡丅
                        ALL_AXES : 慡幉巜掕(ALL_AXES : -1)
                          1乣m   : 侾幉巜掕(m :尰嵼偺惂屼幉悢)

        length  僨乕僞僽儘僢僋挿乮ODBAXIS峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅

                               堦幉巜掕                       慡幉巜掕
                ODBAXIS  0劇劅劅劅劉        劅          0劇劅劅劅劉        劅
                          劆dummy 劆        仾           劆dummy 劆        仾
                         2劌劅劅劅劎        劆          2劌劅劅劅劎        劆
                          劆type  劆      length         劆type  劆      length
                         4劌劅劅劅劏劅劅劅劉劆          4劌劅劅劅劏劅劅劅劉劆
                          劆  data[0]     劆伀           劆  data[0]     劆劆
                         8劋劅劅劅劅劅劅劅劊劅          8劌劅劅劅劅劅劅劅劎劆
                                                         乣              乣劆
                                                4+4x(n-1)劌劅劅劅劅劅劅劅劎劆
                                                         劆  data[n-1]   劆伀
                                                    4+4xn劋劅劅劅劅劅劅劅劊劅
                n 偼丄惂屼幉悢偲側傝傑偡丅

        machine
                奺惂屼幉偺婡夿埵抲傪曉偡ODBAXIS峔憿懱傊偺億僀儞僞偱偡丅
                ODBAXIS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbaxis {
                        short   dummy ;                 /* 枹巊梡 */
                        short   type ;                  /* 幉斣崋 */
                        long    data[MAX_AXIS] ;        /* 惂屼幉偺婡夿埵抲 */
                } ODBAXIS ;                      /* MAX_AXIS : 嵟戝惂屼幉悢 */

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅

        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBAXIS峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(axis)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        戞俀幉偺婡夿嵗昗抣偑 -26.5593 偺帪偵埲壓偺僾儘僌儔儉傪幚峴偡傞偲
        "MACHINE 2: -265593" 偲昞帵偝傟傑偡丅(僀儞僠弌椡丄愝掕扨埵偼 IS-B
        偱偁傞偲偟傑偡丅)

#include <stdio.h>
#include "apilib.h"

void example( void )
{
        ODBAXIS buf ;
        cnc_machine( FlibHndl, 2, 4+4*1, &buf ) ;
        printf( "MACHINE 2:%8ld\n", buf.data[0] ) ;
}

  ( 4) 惂屼幉偺憡懳埵抲偺儕乕僪

娭悢柤  cnc_relative

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_relative(unsigned short FlibHndl, short axis,
                                       short length, ODBAXIS *relative);

夝愢    axis偱巜掕偝傟偨幉偺憡懳埵抲傪撉傒弌偟傑偡丅
        憡懳埵抲偼ODBAXIS撪偺data[0]偵奿擺偝傟傑偡丅

        axis偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝慡幉偺撉傒庢傝傪堦搙偵峴偆偙偲偑偱
        偒傑偡丅偦偺嵺丄奺幉偺憡懳埵抲偼ODBAXIS撪偺data攝楍偵奿擺偝傟傑偡丅

        憡懳埵抲偺彫悢揰埵抲偼丄cnc_getfigure()娭悢偱庢摼偱偒傑偡丅

        儕乕僪偟偨憡懳埵抲偵偼岺嬶挿曗惓検媦傃僒乕儃/壛尭懍抶傟検偑忢偵娷傑
        傟偰偄傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        axis    儕乕僪偡傞幉斣崋傪巜掕偟傑偡丅
                        ALL_AXES : 慡幉巜掕(ALL_AXES : -1)
                          1乣m   : 侾幉巜掕(m :尰嵼偺惂屼幉悢)

        length  僨乕僞僽儘僢僋挿乮ODBAXIS峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅

                               堦幉巜掕                       慡幉巜掕
                ODBAXIS  0劇劅劅劅劉        劅          0劇劅劅劅劉        劅
                          劆dummy 劆        仾           劆dummy 劆        仾
                         2劌劅劅劅劎        劆          2劌劅劅劅劎        劆
                          劆type  劆      length         劆type  劆      length
                         4劌劅劅劅劏劅劅劅劉劆          4劌劅劅劅劏劅劅劅劉劆
                          劆  data[0]     劆伀           劆  data[0]     劆劆
                         8劋劅劅劅劅劅劅劅劊劅          8劌劅劅劅劅劅劅劅劎劆
                                                         乣              乣劆
                                                4+4x(n-1)劌劅劅劅劅劅劅劅劎劆
                                                         劆  data[n-1]   劆伀
                                                    4+4xn劋劅劅劅劅劅劅劅劊劅
                n 偼丄惂屼幉悢偲側傝傑偡丅

        relative
                奺惂屼幉偺憡懳埵抲傪曉偡ODBAXIS峔憿懱傊偺億僀儞僞偱偡丅
                ODBAXIS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbaxis {
                        short   dummy ;                 /* 枹巊梡 */
                        short   type ;                  /* 幉斣崋 */
                        long    data[MAX_AXIS] ;        /* 惂屼幉偺憡懳埵抲 */
                } ODBAXIS ;                      /* MAX_AXIS : 嵟戝惂屼幉悢 */

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅

        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBAXIS峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(axis)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        戞係幉(夞揮幉)偺憡懳嵗昗抣偑 900.051 偺帪偵埲壓偺僾儘僌儔儉傪幚峴偡傞
        偲 "RELATIVE 4:  900051" 偲昞帵偝傟傑偡丅(愝掕扨埵偼 IS-B 偱偁傞偲偟
        傑偡丅)

#include <stdio.h>
#include "apilib.h"

void example( void )
{
        ODBAXIS buf ;
        cnc_relative( FlibHndl, 4, 4+4*1, &buf ) ;
        printf( "RELATIVE 4:%8ld\n", buf.data[0] ) ;
}

  ( 5) 惂屼幉偺巆堏摦検偺儕乕僪

娭悢柤  cnc_distance

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_distance(unsigned short FlibHndl, short axis,
                                       short length, ODBAXIS *distance);

夝愢    axis偱巜掕偝傟偨幉偺巆堏摦検傪撉傒弌偟傑偡丅
        巆堏摦検偼ODBAXIS撪偺data[0]偵奿擺偝傟傑偡丅

        axis偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝慡幉偺撉傒庢傝傪堦搙偵峴偆偙偲偑偱
        偒傑偡丅偦偺嵺丄奺幉偺巆堏摦検偼ODBAXIS撪偺data攝楍偵奿擺偝傟傑偡丅

        巆堏摦検偺彫悢揰埵抲偼丄cnc_getfigure()娭悢偱庢摼偱偒傑偡丅

        幚嵺偺巆堏摦検偺俀攞偺抣偑撉傒弌偝傟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        axis    儕乕僪偡傞幉斣崋傪巜掕偟傑偡丅
                        ALL_AXES : 慡幉巜掕(ALL_AXES : -1)
                          1乣m   : 侾幉巜掕(m :尰嵼偺惂屼幉悢)

        length  僨乕僞僽儘僢僋挿乮ODBAXIS峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅

                               堦幉巜掕                       慡幉巜掕
                ODBAXIS  0劇劅劅劅劉        劅          0劇劅劅劅劉        劅
                          劆dummy 劆        仾           劆dummy 劆        仾
                         2劌劅劅劅劎        劆          2劌劅劅劅劎        劆
                          劆type  劆      length         劆type  劆      length
                         4劌劅劅劅劏劅劅劅劉劆          4劌劅劅劅劏劅劅劅劉劆
                          劆  data[0]     劆伀           劆  data[0]     劆劆
                         8劋劅劅劅劅劅劅劅劊劅          8劌劅劅劅劅劅劅劅劎劆
                                                         乣              乣劆
                                                4+4x(n-1)劌劅劅劅劅劅劅劅劎劆
                                                         劆  data[n-1]   劆伀
                                                    4+4xn劋劅劅劅劅劅劅劅劊劅
                n 偼丄惂屼幉悢偲側傝傑偡丅

        distance
                奺惂屼幉偺巆堏摦検傪曉偡ODBAXIS峔憿懱傊偺億僀儞僞偱偡丅
                ODBAXIS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbaxis {
                        short   dummy ;                 /* 枹巊梡 */
                        short   type ;                  /* 幉斣崋 */
                        long    data[MAX_AXIS] ;        /* 惂屼幉偺巆堏摦検 */
                } ODBAXIS ;                      /* MAX_AXIS : 嵟戝惂屼幉悢 */

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅

        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBAXIS峔憿懱偺僒僀僘(length)偑晄惓偱偡丅
                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(axis)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        係幉僔僗僥儉偱丄奺幉偺巆堏摦検偑偦傟偧傟
                戞侾幉          -17.300 (捈慄幉)
                戞俀幉           30.009 (捈慄幉)
                戞俁幉           -0.180 (夞揮幉)
                戞係幉            4.000 (捈慄幉)
        偺帪偵埲壓偺僾儘僌儔儉傪幚峴偡傞偲
                1:  -34600
                2:   60018
                3:    -360
                4:    8000
        偲昞帵偝傟傑偡丅(儈儕擖椡丄愝掕扨埵偼 IS-B 偱偁傞偲偟傑偡丅)
#include <stdio.h>
#include "apilib.h"
void example( void )
{
        ODBAXIS buf ;
        unsigned int idx ;
        cnc_distance( FlibHndl, -1, 4+4*4, &buf ) ;
        for ( idx = 0 ; idx < 4 ; idx++ )
                printf( "%u:%8ld\n", idx, buf.data[idx] ) ;
}

  ( 6) 惂屼幉偺僗僉僢僾埵抲偺儕乕僪

娭悢柤  cnc_skip

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_skip(unsigned short FlibHndl, short axis,
                                           short length, ODBAXIS *skip);

夝愢    axis偱巜掕偝傟偨幉偺僗僉僢僾埵抲傪撉傒弌偟傑偡丅
        僗僉僢僾埵抲偼ODBAXIS撪偺data[0]偵奿擺偝傟傑偡丅

        axis偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝慡幉偺撉傒庢傝傪堦搙偵峴偆偙偲偑偱
        偒傑偡丅偦偺嵺丄奺幉偺僗僉僢僾埵抲偼ODBAXIS撪偺data攝楍偵奿擺偝傟傑偡丅

        僗僉僢僾埵抲偺彫悢揰埵抲偼丄cnc_getfigure()娭悢偱庢摼偱偒傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        axis    儕乕僪偡傞幉斣崋傪巜掕偟傑偡丅
                        ALL_AXES : 慡幉巜掕(ALL_AXES : -1)
                          1乣m   : 侾幉巜掕(m :尰嵼偺惂屼幉悢)

        length  僨乕僞僽儘僢僋挿乮ODBAXIS峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅

                               堦幉巜掕                       慡幉巜掕
                ODBAXIS  0劇劅劅劅劉        劅          0劇劅劅劅劉        劅
                          劆dummy 劆        仾           劆dummy 劆        仾
                         2劌劅劅劅劎        劆          2劌劅劅劅劎        劆
                          劆type  劆      length         劆type  劆      length
                         4劌劅劅劅劏劅劅劅劉劆          4劌劅劅劅劏劅劅劅劉劆
                          劆  data[0]     劆伀           劆  data[0]     劆劆
                         8劋劅劅劅劅劅劅劅劊劅          8劌劅劅劅劅劅劅劅劎劆
                                                         乣              乣劆
                                                4+4x(n-1)劌劅劅劅劅劅劅劅劎劆
                                                         劆  data[n-1]   劆伀
                                                    4+4xn劋劅劅劅劅劅劅劅劊劅
                n 偼丄惂屼幉悢偲側傝傑偡丅

        skip
                奺惂屼幉偺僗僉僢僾埵抲傪曉偡ODBAXIS峔憿懱傊偺億僀儞僞偱偡丅
                ODBAXIS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbaxis {
                        short   dummy ;             /* 枹巊梡 */
                        short   type ;              /* 幉斣崋 */
                        long    data[MAX_AXIS] ;    /* 惂屼幉偺僗僉僢僾埵抲 */
                } ODBAXIS ;                      /* MAX_AXIS : 嵟戝惂屼幉悢 */

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅

                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBAXIS峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(axis)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼戞侾幉偲戞俀幉偺僗僉僢僾埵抲傪昞帵偟傑偡丅

#include <stdio.h>
#include "apilib.h"

void example( void )
{
        ODBAXIS buf ;
        unsigned int idx ;
        cnc_skip( FlibHndl, 1, 4+4*1, &buf ) ;
        printf( "SKIP 1:%8ld\n", buf.data[0] ) ;
        cnc_skip( FlibHndl, 2, 4+4*1, &buf ) ;
        printf( "SKIP 2:%8ld\n", buf.data[0] ) ;
}

  ( 7) 惂屼幉偺僒乕儃抶傟検偺儕乕僪

娭悢柤  cnc_srvdelay

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_srvdelay(unsigned short FlibHndl, short axis,
                                        short length, ODBAXIS *srvdelay);

夝愢    axis偱巜掕偝傟偨幉偺僒乕儃抶傟検傪撉傒弌偟傑偡丅
        僒乕儃抶傟検偼ODBAXIS撪偺data[0]偵奿擺偝傟傑偡丅

        axis偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝慡幉偺撉傒庢傝傪堦搙偵峴偆偙偲偑偱
        偒傑偡丅偦偺嵺丄奺幉偺僒乕儃抶傟検偼ODBAXIS撪偺data攝楍偵奿擺偝傟傑偡丅

        僒乕儃抶傟検偺彫悢揰埵抲偼丄cnc_getfigure()娭悢偱庢摼偱偒傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        axis    儕乕僪偡傞幉斣崋傪巜掕偟傑偡丅
                        ALL_AXES : 慡幉巜掕(ALL_AXES : -1)
                          1乣m   : 侾幉巜掕(m :尰嵼偺惂屼幉悢)

        length  僨乕僞僽儘僢僋挿乮ODBAXIS峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅

                               堦幉巜掕                       慡幉巜掕
                ODBAXIS  0劇劅劅劅劉        劅          0劇劅劅劅劉        劅
                          劆dummy 劆        仾           劆dummy 劆        仾
                         2劌劅劅劅劎        劆          2劌劅劅劅劎        劆
                          劆type  劆      length         劆type  劆      length
                         4劌劅劅劅劏劅劅劅劉劆          4劌劅劅劅劏劅劅劅劉劆
                          劆  data[0]     劆伀           劆  data[0]     劆劆
                         8劋劅劅劅劅劅劅劅劊劅          8劌劅劅劅劅劅劅劅劎劆
                                                         乣              乣劆
                                                4+4x(n-1)劌劅劅劅劅劅劅劅劎劆
                                                         劆  data[n-1]   劆伀
                                                    4+4xn劋劅劅劅劅劅劅劅劊劅
                n 偼丄惂屼幉悢偲側傝傑偡丅

        srvdelay
                奺惂屼幉偺僒乕儃抶傟検傪曉偡ODBAXIS峔憿懱傊偺億僀儞僞偱偡丅
                ODBAXIS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbaxis {
                        short   dummy ;             /* 枹巊梡 */
                        short   type ;              /* 幉斣崋 */
                        long    data[MAX_AXIS] ;    /* 惂屼幉偺僒乕儃抶傟検 */
                } ODBAXIS ;                      /* MAX_AXIS : 嵟戝惂屼幉悢 */

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅

                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBAXIS峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(axis)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼慡幉暘(幉悢=MAX)偺僒乕儃抶傟検傪昞帵偟傑偡丅

#include <stdio.h>
#include "apilib.h"
void example( void )
{
        ODBAXIS buf ;
        unsigned int idx ;
        cnc_srvdelay( FlibHndl, -1, 4+4*MAX, &buf ) ;
        for ( idx = 0 ; idx < MAX ; idx++ )
                printf( "%u:%8ld\n", idx, buf.data[idx] ) ;
}

  ( 8) 惂屼幉偺壛尭懍抶傟検偺儕乕僪

娭悢柤  cnc_accdecdly

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_accdecdly(unsigned short FlibHndl,
                                short axis, short length, ODBAXIS *accdecdly);

夝愢    axis偱巜掕偝傟偨幉偺壛尭懍抶傟検傪撉傒弌偟傑偡丅
        壛尭懍抶傟検偼ODBAXIS撪偺data[0]偵奿擺偝傟傑偡丅

        axis偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝慡幉偺撉傒庢傝傪堦搙偵峴偆偙偲偑偱
        偒傑偡丅偦偺嵺丄奺幉偺壛尭懍抶傟検偼ODBAXIS撪偺data攝楍偵奿擺偝傟傑偡丅

        壛尭懍抶傟検偺彫悢揰埵抲偼丄cnc_getfigure()娭悢偱庢摼偱偒傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        axis    儕乕僪偡傞幉斣崋傪巜掕偟傑偡丅
                        ALL_AXES : 慡幉巜掕(ALL_AXES : -1)
                          1乣m   : 侾幉巜掕(m :尰嵼偺惂屼幉悢)

        length  僨乕僞僽儘僢僋挿乮ODBDY峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅

                               堦幉巜掕                       慡幉巜掕
                ODBDY    0劇劅劅劅劉        劅          0劇劅劅劅劉        劅
                          劆dummy 劆        仾           劆dummy 劆        仾
                         2劌劅劅劅劎        劆          2劌劅劅劅劎        劆
                          劆type  劆      length         劆type  劆      length
                         4劌劅劅劅劏劅劅劅劉劆          4劌劅劅劅劏劅劅劅劉劆
                          劆  data[0]     劆伀           劆  data[0]     劆劆
                         8劋劅劅劅劅劅劅劅劊劅          8劌劅劅劅劅劅劅劅劎劆
                                                         乣              乣劆
                                                4+4x(n-1)劌劅劅劅劅劅劅劅劎劆
                                                         劆  data[n-1]   劆伀
                                                    4+4xn劋劅劅劅劅劅劅劅劊劅
                n 偼丄惂屼幉悢偲側傝傑偡丅

        accdecdly
                奺惂屼幉偺壛尭懍抶傟検傪曉偡ODBAXIS峔憿懱傊偺億僀儞僞偱偡丅
                ODBAXIS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbaxis {
                        short   dummy ;             /* 枹巊梡 */
                        short   type ;              /* 幉斣崋 */
                        long    data[MAX_AXIS] ;    /* 惂屼幉偺壛尭懍抶傟検 */
                } ODBAXIS ;                      /* MAX_AXIS : 嵟戝惂屼幉悢 */

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅

                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBAXIS峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(axis)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼慡幉暘(幉悢=MAX)偺壛尭懍抶傟検傪昞帵偟傑偡丅

#include <stdio.h>
#include "apilib.h"
void example( void )
{
        ODBAXIS buf ;
        unsigned int idx ;
        cnc_accdecdly( FlibHndl, -1, 4+4*MAX, &buf ) ;
        for ( idx = 0 ; idx < MAX ; idx++ )
                printf( "%u:%8ld\n", idx, buf.data[idx] ) ;
}

  ( 9) 僟僀僫儈僢僋僨乕僞偺堦妵儕乕僪

娭悢柤  cnc_rddynamic

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rddynamic(unsigned short FlibHndl,
                                short axis, short length, ODBDY *rddynamic);

夝愢    俠俶俠偺塣揮偵敽偄曄壔偡傞奺庬僨乕僞傪堦搙偵撉傒弌偟傑偡丅
        撉傒庢傟傞僨乕僞偼師偺捠傝偱偡丅

                僨乕僞                          屄暿偵撉傒偩偡帪偵巊梡偡傞娭悢
                -------------------------------+-------------------------------
                傾儔乕儉僗僥乕僞僗              cnc_alarm
                幚峴拞偺僾儘僌儔儉斣崋          cnc_rdprgnum
                儊僀儞僾儘僌儔儉斣崋            cnc_rdprgnum
                僔乕働儞僗斣崋                  cnc_rdseqnum
                幚懍搙                          cnc_actf
                惂屼幉偺愨懳埵抲乮幉巜掕偵廬偆乯cnc_absolute
                惂屼幉偺婡夿埵抲乮幉巜掕偵廬偆乯cnc_machine
                惂屼幉偺憡懳埵抲乮幉巜掕偵廬偆乯cnc_relative
                惂屼幉偺巆堏摦検乮幉巜掕偵廬偆乯cnc_distance

        奺僨乕僞偺撪梕偼忋偺乽屄暿偵撉傒偩偡帪偵巊梡偡傞娭悢乿偺傕偺偲摨堦偱
        偡丅僨乕僞偺宍幃側偳偵娭偟偰偼奺娭悢偺夝愢傪嶲徠偟偰偔偩偝偄丅

        幉偵娭偡傞僨乕僞偼丄axis偱巜掕偝傟偨幉僨乕僞傪撉傒弌偟傑偡丅
        奺僨乕僞偼ODBDY撪偺oaxis峔憿懱偵奿擺偝傟傑偡丅

        axis偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝慡幉偺撉傒庢傝傪堦搙偵峴偆偙偲偑偱
        偒傑偡丅偦偺嵺丄幉偵娭偡傞奺庬僨乕僞偼ODBDY撪偺faxis峔憿懱撪偺奺攝楍偵
        奿擺偝傟傑偡丅

        幉偵娭偡傞僨乕僞偺彫悢揰埵抲偼丄cnc_getfigure()娭悢偱庢摼偱偒傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        axis    儕乕僪偡傞幉斣崋傪巜掕偟傑偡丅
                        ALL_AXES : 慡幉巜掕(ALL_AXES : -1)
                          1乣m   : 侾幉巜掕(m :尰嵼偺惂屼幉悢)

        length  僨乕僞僽儘僢僋挿乮ODBDY峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅

                               堦幉巜掕                       慡幉巜掕
                ODBAXIS  0劇劅劅劅劉        劅          0劇劅劅劅劉        劅
                          劆dummy 劆        仾           劆dummy 劆        仾
                         2劌劅劅劅劎        劆          2劌劅劅劅劎        劆
                          劆axis  劆        劆           劆axis  劆        劆
                         4劌劅劅劅劎        劆          4劌劅劅劅劎        劆
                          劆alarm 劆        劆           劆alarm 劆        劆
                         6劌劅劅劅劎        劆          6劌劅劅劅劎        劆

                          劆prgnum劆        劆           劆prgnum劆        劆
                         8劌劅劅劅劎        劆          8劌劅劅劅劎        劆
                          劆prgmnum       length         劆prgmnum       length
                        10劌劅劅劅劏劅劅劅劉劆         10劌劅劅劅劏劅劅劅劉劆
                          劆  seqnum      劆劆           劆 seqnum       劆劆
                        14劌劅劅劅劅劅劅劅劎劆         14劌劅劅劅劅劅劅劅劎劆
                          劆  actf        劆劆           劆 actf         劆劆
                        18劌劅劅劅劅劅劅劅劎劆         18劌劅劅劅劅劅劅劅劎劆
                          劆  acts        劆劆           劆 acts         劆劆
                        22劌劅劅劅劅劅劅劅劎劆         22劌劅劅劅劅劅劅劅劎劆
                          劆  absolute    劆劆           劆 absolute[0]  劆劆
                        26劌劅劅劅劅劅劅劅劎劆         26劌劅劅劅劅劅劅劅劎劆
                          劆  machine     劆劆           乣              乣劆
                        30劌劅劅劅劅劅劅劅劎劆 22+4x(n-1)劌劅劅劅劅劅劅劅劎劆
                          劆  relative    劆劆           劆 absolute[n-1]劆劆
                        34劌劅劅劅劅劅劅劅劎劆     22+4xn劌劅劅劅劅劅劅劅劎劆
                          劆  distance    劆伀           劆 machine[0]   劆劆
                        38劋劅劅劅劅劅劅劅劊劅 22+4x(n+1)劌劅劅劅劅劅劅劅劎劆
                                                         乣              乣劆
                                              22+4x(2n-1)劌劅劅劅劅劅劅劅劎劆
                                                         劆 machine[n-1] 劆劆
                                                  22+4x2n劌劅劅劅劅劅劅劅劎劆
                                                         劆 relative[0]  劆劆
                                              22+4x(2n+1)劌劅劅劅劅劅劅劅劎劆
                                                         乣              乣劆
                                              22+4x(3n-1)劌劅劅劅劅劅劅劅劎劆
                                                         劆 relative[n-1]劆劆
                                                  22+4x3n劌劅劅劅劅劅劅劅劎劆
                                                         劆 distance[0]  劆劆
                                              22+4x(3n+1)劌劅劅劅劅劅劅劅劎劆
                                                         乣              乣劆
                                              22+4x(4n-1)劌劅劅劅劅劅劅劅劎劆
                                                         劆 distance[n-1]劆伀
                                                  22+4x4n劋劅劅劅劅劅劅劅劊劅

                n 偼丄嵟戝惂屼幉悢乮桳岠僨乕僞偼惂屼幉悢暘乯偱偡丅

        rddynamic
                奺庬僨乕僞傪妉摼偡傞ODBDY峔憿懱傊偺億僀儞僞偱偡丅
                ODBDY峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbdy {
                        short  dummy ;     /* not used                */
                        short  axis ;      /* axis number             */
                        short  alarm ;     /* alarm status            */
                        short  prgnum ;    /* current program number  */
                        short  prgmnum ;   /* main program number     */
                        long   seqnum ;    /* current sequence number */
                        long   actf ;      /* actual feedrate         */
                        long   acts ;      /* not used                */
                        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 ;
                } ODBDY ;                       /* MAX_AXIS : 嵟戝惂屼幉悢 */

                dummy           枹巊梡

                axis            幉斣崋
                                儕乕僪偟偨幉斣崋傪曉偟傑偡丅

                alarm           傾儔乕儉僗僥乕僞僗
                                奺價僢僩偺堄枴偼師偺捠傝偱偡丅
                                        #15:奜晹傾儔乕儉儊僢僙乕僕
                                        #14:乮枹巊梡乯
                                        #13:乮枹巊梡乯
                                        #12:乮枹巊梡乯
                                        #11:乮枹巊梡乯
                                        #10:俹乛俽俆侽侽侽斣戜
                                        #09:乮枹巊梡乯
                                        #08:俙俹俠傾儔乕儉
                                        #07:僔僗僥儉傾儔乕儉
                                        #06:僒乕儃傾儔乕儉
                                        #05:僆乕僶僸乕僩傾儔乕儉
                                        #04:僆乕僶僩儔儀儖傾儔乕儉
                                        #03:俹乛俽偦偺懠
                                        #02:俹乛俽侾侽侾
                                        #01:俹乛俽侽侽侽
                                        #00:俹乛俽侾侽侽

                prgnum          幚峴拞偺僾儘僌儔儉斣崋
                                乮帺摦塣揮掆巭拞偼慖戰拞偺斣崋偱偡乯

                prgmnum         儊僀儞僾儘僌儔儉斣崋

                seqnum          幚峴拞偺僔乕働儞僗斣崋

                actf            惂屼幉偺幚懍搙

                absolute        惂屼幉偺愨懳埵抲

                machine         惂屼幉偺婡夿埵抲

                relative        惂屼幉偺憡懳埵抲

                distance        惂屼幉偺巆堏摦検

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅

                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBDY峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(axis)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼慡幉暘(幉悢=MAX)偺僟僀僫儈僢僋僨乕僞傪撉傒偩偟偰
        夋柺偵昞帵偟傑偡丅

#include <stdio.h>
#include "apilib.h"

void example( void )
{
        struct odbdy buf ;
        unsigned int idx ;
        cnc_rddynamic( FlibHndl, -1, sizeof(buf), &buf ) ;
        printf( "Current program = %d   Main program = %d\n",
                        buf.prgnum, buf.prgmnum ) ;
        printf( "Sequence number = %ld\n", buf.seqnum ) ;
        printf( "actf = %ld   ", buf.actf ) ;
        printf( "Alarm status = %d\n", buf.alarm ) ;
        printf( "AXIS Absolute  Relative  Machine   Distance\n" ) ;
        printf( "----+---------+---------+---------+--------\n" ) ;
        for ( idx = 0 ; idx < 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] ) ;
}

  (10) 惂屼幉偺憡懳埵抲偺僆儕僕儞乛僾儕僙僢僩

娭悢柤  cnc_wrrelpos

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_wrrelpos(unsigned short FlibHndl,
                                               short length, IDBWRR *wrrelpos);

夝愢    type偱巜掕偟偨幉偵懳偟偰憡懳埵抲偺僾儕僙僢僩乮嵞愝掕乯傪峴偄傑偡丅
        僾儕僙僢僩僨乕僞偼IDBWRR撪偺data[0]偵僙僢僩偟傑偡丅

        僾儕僙僢僩僨乕僞偲偟偰侽傪愝掕偡傞偲丄僆儕僕儞乮憡懳埵抲偺侽僋儕傾乯偲
        側傝傑偡丅

        type偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝慡幉偺僾儕僙僢僩傪堦搙偵峴偆偙偲偑
        偱偒傑偡丅偦偺嵺丄奺幉偺僾儕僙僢僩僨乕僞偼IDBWRR撪偺data攝楍偵僙僢僩偟
        傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        length  僨乕僞僽儘僢僋挿乮IDBWRR峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅

                               堦幉巜掕                       慡幉巜掕
                IDBWRR   0劇劅劅劅劉        劅          0劇劅劅劅劉        劅
                          劆datano劆        仾           劆datano劆        仾
                         2劌劅劅劅劎        劆          2劌劅劅劅劎        劆
                          劆type  劆      length         劆type  劆      length
                         4劌劅劅劅劏劅劅劅劉劆          4劌劅劅劅劏劅劅劅劉劆
                          劆  data[0]     劆伀           劆  data[0]     劆劆
                         8劋劅劅劅劅劅劅劅劊劅          8劌劅劅劅劅劅劅劅劎劆
                                                         乣              乣劆
                                                4+4x(n-1)劌劅劅劅劅劅劅劅劎劆
                                                         劆  data[n-1]   劆伀
                                                    4+4xn劋劅劅劅劅劅劅劅劊劅
                n 偼丄惂屼幉悢偱偡丅

        wrrelpos
                奺惂屼幉偺憡懳埵抲傪僾儕僙僢僩偡傞IDBWRR峔憿懱傊偺億僀儞僞偱偡丅
                IDBERR峔憿懱偼師偺捠傝偱偡丅
                typedef struct idbwrr {
                        short   datano;                 /* 枹巊梡 */
                        short   type;                   /* 幉斣崋 */
                        long    data[MAX_AXIS];         /* 僾儕僙僢僩僨乕僞 */
                } IDBWRR ;                       /* MAX_AXIS : 嵟戝惂屼幉悢 */

                type    僾儕僙僢僩偡傞幉斣崋傪巜掕偟傑偡丅
                                ALL_AXES : 慡幉巜掕(ALL_AXES : -1)
                                  1乣m   : 侾幉巜掕(m :尰嵼偺惂屼幉悢)

                data    僾儕僙僢僩偡傞抣傪巜掕偟傑偡丅
                                data[0]乣data[m-1] : 慡幉巜掕

                                data[0]            : 堦幉巜掕

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                IDBWRR峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(type)偺巜掕偑晄揔愗偱偡丅

                EW_DATA         僨乕僞偺岆傝
                                data偺撪梕偑巜掕壜擻斖埻奜偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼侾幉栚偺憡懳埵抲傪僾儕僙僢僩偟傑偡丅

#include <stdio.h>
#include "apilib.h"
#define FIRST_AXIS      1
#define ONE_AXIS_LEN    8

IDBWRR          wrrelpos ;
short           ret ;

wrrelpos.type = FIRST_AXIS ;
wrrelpos.data[0] = 0 ;
ret = cnc_wrrelpos( FlibHndl, ONE_AXIS_LEN, &wrrelpos);
                                     /* 1幉栚偺憡懳埵抲傪僾儕僙僢僩 */

僾儘僌儔儉娭學
-------------------------------------------------------------------------------
  娭悢柤                婡丂擻丂撪丂梕
-------------------------------------------------------------------------------
丂( 1) cnc_dwnstart     搊榐梡俶俠巜椷僨乕僞偺弌椡偺奐巒
丂( 2) cnc_download     搊榐梡俶俠巜椷僨乕僞偺弌椡
  ( 3) cnc_dwnend       搊榐梡俶俠巜椷僨乕僞偺弌椡偺廔椆
丂( 4) cnc_upstart      俶俠巜椷僨乕僞偺儕乕僪偺奐巒
丂( 5) cnc_upload       俶俠巜椷僨乕僞偺儕乕僪
丂( 6) cnc_upend        俶俠巜椷僨乕僞偺儕乕僪偺廔椆
丂( 7) cnc_search       巜掕僾儘僌儔儉偺僒乕僠
丂( 8) cnc_delall       慡僾儘僌儔儉偺嶍彍
丂( 9) cnc_delete       巜掕僾儘僌儔儉偺嶍彍
  (10) cnc_rdprogdir    僾儘僌儔儉僨傿儗僋僩儕偺儕乕僪
  (11) cnc_rdproginfo   僾儘僌儔儉忣曬偺儕乕僪
  (12) cnc_rdprgnum     幚峴拞偺僾儘僌儔儉斣崋偺儕乕僪
  (13) cnc_rdseqnum     幚峴拞偺僔乕働儞僗斣崋偺儕乕僪
  (14) cnc_rdexecprog   幚峴拞僾儘僌儔儉偺儕乕僪
  (15) cnc_wrmdiprog    俵俢俬塣揮梡僾儘僌儔儉偺弌椡
  (16) cnc_rdmdipntr    俵俢俬塣揮梡幚峴億僀儞僞偺儕乕僪
  (17) cnc_wrmdipntr    俵俢俬塣揮梡幚峴億僀儞僞偺儔僀僩
  (18) cnc_seqsrch      僔乕働儞僗斣崋偺僒乕僠
  (19) cnc_rewind       僇乕僜儖偺摢弌偟
-------------------------------------------------------------------------------

  ( 1) 搊榐梡俶俠巜椷僨乕僞偺弌椡偺奐巒

娭悢柤  cnc_dwnstart

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_dwnstart(unsigned short FlibHndl);

夝愢    CNC懁偵NC巜椷僨乕僞(NC僾儘僌儔儉)偺搊榐(僟僂儞儘乕僪)奐巒傪梫媮偟傑偡丅
        乮僟僂儞儘乕僪傪峴偆慜偵昁偢幚峴偡傞昁梫偑偁傝傑偡丅乯

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_BUSY         價僕傿
                                丒cnc_dwnstart娭悢傪幚峴嵪傒偱偡丅
                                丂cnc_dwnend娭悢偵偰慜夞偺弌椡傪廔
                                  椆偝偣偰偔偩偝偄丅
                                丒CNC偑僶僢僋僌儔僂儞僪曇廤拞
                                丂CNC懁偺棤曇廤傪廔椆偝偣偰偔偩偝偄丅
                                丒CNC偑傾儔乕儉乮PS000,PS101乯忬懺
                                丂CNC懁偺傾儔乕儉傪夝彍偟偰偔偩偝偄丅
                                丒CNC偑MDI儌乕僪
                                丂CNC偺儌乕僪傪MDI埲奜偵偟偰偔偩偝偄丅

                EW_PROT         儔僀僩僾儘僥僋僩
                                丒僾儘僥僋僩KEY(DI)偑ON偵側偭偰偄傑偡

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻偟偔偼CNC僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅

                        0000#0                    -+- 愝掕偺塭嬁傪庴偗傑偡
                        3201#2,#6               丂-+
                        3202#0,#4               丂-+
                        3290#7                  丂-+

CNC儌乕僪       杮婡擻偵偼埲壓偺儌乕僪偑娭學偟傑偡丅
                MDI 埲奜偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        乽搊榐梡NC巜椷僨乕僞偺弌椡(cnc_download)乿偺巊梡椺傪嶲徠偟偰偔偩偝偄丅

  ( 2) 搊榐梡俶俠巜椷僨乕僞偺弌椡

娭悢柤  cnc_download

愰尵    #include        "Fwlib32.h
        FWLIBAPI short WINAPI cnc_download(unsigned short FlibHndl, char *data,
                                                                short number);

夝愢    搊榐梡俶俠巜椷僨乕僞偺弌椡乮僟僂儞儘乕僪乯傪峴偄傑偡丅

        CNC懁偺僨乕僞張棟偑抶傟偰僨乕僞偑弌椡偱偒側偄応崌偼弌椡偱偒傞傑偱儔僀僽
        儔儕偺拞偱懸偪傑偡丅

        僟僂儞儘乕僪傪峴偆庤弴傪埲壓偵帵偟傑偡丅

                劇劅劅劅劅劅劅劅劅劅劉
                劆  cnc_dwnstart()丂劆  僟僂儞儘乕僪偺奐巒
                劋劅劅劅劅劍劅劅劅劅劊丂乮昁偢峴偭偰偔偩偝偄乯
          劇劅劅劅劅劅劅仺伀
          劆    劇劅劅劅劅劏劅劅劅劅劉
          劆    劆  cnc_download()丂劆丂僟僂儞儘乕僪僨乕僞偺弌椡
          劆  丂劋劅劅劅劅劍劅劅劅劅劊
          劆  丂丂丂丂丂丂伀
          劆Yes 劇劅劅劅劅劏劅劅劅劅劉
          劋劅劅劎枹弌椡偺僨乕僞偁傝劆
              丂劋劅劅劅劅劍劅劅劅劅劊
              丂丂丂丂丂丂伀No
                劇劅劅劅劅劏劅劅劅劅劉
                劆   cnc_dwnend() 丂劆丂僟僂儞儘乕僪偺廔椆
                劋劅劅劅劅劅劅劅劅劅劊丂乮昁偢峴偭偰偔偩偝偄乯

        弌椡僨乕僞偺僼僅乕儅僢僩
        ~~~~~~~~~~~~~~~~~~~~~~~~
        CNC懁偵搊榐偡傞NC僾儘僌儔儉偼埲壓偺傛偆側僼僅乕儅僢僩偺ASCII僐乕僪偺
        暥帤楍偱偡丅

                LF Oxxxx LF 僽儘僢僋1 LF 僽儘僢僋2 LF ... LF Mxx LF %

                偨偩偟  LF      0x0A ('\n')
                        Oxxxx   僾儘僌儔儉斣崋
                        Mxx     僾儘僌儔儉枛旜偺俵僐乕僪(M02,M30側偳)

        僾儘僌儔儉慡懱偺愭摢偵偼 LF 傪丄枛旜偵偼 '%' 傪晅壛偟偰偔偩偝偄丅
        愭摢偺 LF 傛傝傕慜偵偁傞僨乕僞偼柍帇偝傟傑偡丅搊榐偡傞僾儘僌儔儉偺
        愭摢偵偼昁偢傾僪儗僗 'O' 偵懕偗偰僾儘僌儔儉斣崋傪巜掕偟偰偔偩偝偄丅
        椺偊偽丄

                O1234 ;
                G1 F0.3 W10. ;
                M30 ;
                %

        偲偄偆僾儘僌儔儉傪搊榐偡傞帪偼丄


                "\nO1234\nG1F0.3W10.\nM30\n%"

        傪 cnc_download娭悢偱揮憲偟傑偡丅揮憲傪暋悢夞偵暘偗傞偙偲傕壜擻偱偡丅
        忋偺椺偱偼

                "\n"
                "O1234\n"
                "G1F0.3W10.\n"
                "M30\n"
                "%"

        偺傛偆偵侾僽儘僢僋偢偮揮憲偡傞偙偲傕偱偒傑偡丅偝傜偵丄侾僽儘僢僋傪暋
        悢夞偵暘偗偰揮憲偡傞偙偲傕壜擻偱偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        data    俶俠巜椷僨乕僞偺愭摢傾僪儗僗傪巜掕偟傑偡丅

        number  俶俠巜椷僨乕僞偺暥帤悢傪巜掕偟傑偡丅(1乣256)

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_RESET        儕僙僢僩丄掆巭梫媮
                                亀RESET or STOP亁 偑墴偝傟傑偟偨丅
                                cnc_dwnend娭悢傪僐乕儖偟偰偔偩偝偄丅

                EW_FUNC         cnc_dwnstart娭悢偑幚峴偝傟偰偄傑偣傫丅

                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                僨乕僞僽儘僢僋挿(number)偑256僶僀僩傪挻偊偰偄
                                傑偡丅

                EW_DATA         僨乕僞偺岆傝
                                丒摨堦偺僾儘僌儔儉斣崋偑婛偵搊榐偝傟偰偄傞丅
                                丒摨堦偺僾儘僌儔儉斣崋偑NC懁偱慖戰偝傟偰偄傞丅
                                丒NC僾儘僌儔儉偱巊梡偱偒側偄暥帤偑専弌偝傟偨丅
                                丒TV僠僃僢僋桳岠偺帪丄僽儘僢僋撪偺暥帤悢(僽儘僢
                                  僋枛旜偺LF傪娷傓)偑婏悢偺僽儘僢僋偑専弌偝傟偨

                EW_PROT         儔僀僩僾儘僥僋僩
                                CNC偺僷儔儊乕僞乮8000斣戜/9000斣戜僾儘僥僋僩丄
                                埫崋壔乯偑彂偒崬傒嬛巭偺愝掕偵側偭偰偄傑偡丅

                EW_OVRFLOW      儊儌儕僆乕僶乕僼儘乕
                                俶俠懁偺嬻偒梕検偑懌傝傑偣傫偺偱丄梕検傪妋曐偟
                                偰偔偩偝偄丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅


CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻偟偔偼CNC僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅
                        0000#0                    -+- 愝掕偺塭嬁傪庴偗傑偡
                        3201#2,#6               丂-+
                        3202#0,#4               丂-+
                        3290#7                  丂-+

CNC儌乕僪       杮婡擻偵偼埲壓偺儌乕僪偑娭學偟傑偡丅
                MDI 埲奜偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼師偺NC僾儘僌儔儉傪CNC懁偵搊榐偟傑偡丅
        O1234 ;
        M3 S1200 ;
        G0 Z0 ;
        G0 X0 Y0 ;
        G1 F500 X120. Y-30. ;
        M30 ;

#include "apilib.h"
short example( void )
{
        char *prg[] = {
                "\n",
                "O1234\n",
                "M3 S1200\n",
                "G0 Z0\n",
                "G0 X0 Y0\n",
                "G1 F500 X120. Y-30.\n",
                "M30\n",
                "%"
        } ;
        short ret, idx ;
        ret = cnc_dwnstart( FlibHndl ) ;
        if ( ret ) return ( ret ) ;
        for ( idx = 0 ; idx < sizeof(prg)/sizeof(char *) ; idx++ ) {
                ret = cnc_download( FlibHndl, prg[idx], strlen( prg[idx] ) ) ;
                if ( ret ) {
                        cnc_dwnend( FlibHndl ) ;
                        return ( ret ) ;
                }
        }
        ret = cnc_dwnend( FlibHndl ) ;
        return ( ret ) ;
}

  ( 3) 搊榐梡俶俠巜椷僨乕僞偺弌椡偺廔椆

娭悢柤  cnc_dwnend

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_dwnend(unsigned short FlibHndl);

夝愢    CNC懁偵NC僾儘僌儔儉偺搊榐廔椆傪捠抦偟傑偡丅
        乮僟僂儞儘乕僪廔椆屻偵昁偢巊梡偡傞昁梫偑偁傝傑偡乯

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_FUNC         cnc_dwnstart娭悢偑幚峴偝傟偰偄傑偣傫丅

                EW_DATA         僨乕僞偺岆傝
                                丒摨堦偺僾儘僌儔儉斣崋偑婛偵搊榐偝傟偰偄傞丅
                                丒摨堦偺僾儘僌儔儉斣崋偑NC懁偱慖戰偝傟偰偄傞丅
                                丒NC僾儘僌儔儉偱巊梡偱偒側偄暥帤偑専弌偝傟偨丅
                                丒TV僠僃僢僋桳岠偺帪丄僽儘僢僋撪偺暥帤悢(僽儘僢
                                  僋枛旜偺LF傪娷傓)偑婏悢偺僽儘僢僋偑専弌偝傟偨

                EW_PROT         儔僀僩僾儘僥僋僩
                                CNC偺僷儔儊乕僞乮8000斣戜/9000斣戜僾儘僥僋僩丄
                                埫崋壔乯偑彂偒崬傒嬛巭偺愝掕偵側偭偰偄傑偡丅

                EW_OVRFLOW      儊儌儕僆乕僶乕僼儘乕
                                俶俠懁偺嬻偒梕検偑懌傝傑偣傫偺偱丄梕検傪妋曐偟
                                偰偔偩偝偄丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻偟偔偼CNC僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅
                        0000#0                    -+- 愝掕偺塭嬁傪庴偗傑偡
                        3201#2,#6               丂-+
                        3202#0,#4               丂-+
                        3290#7                  丂-+

CNC儌乕僪       杮婡擻偵偼埲壓偺儌乕僪偑娭學偟傑偡丅
                MDI 埲奜偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        乽搊榐梡NC巜椷僨乕僞偺弌椡(cnc_download)乿偺巊梡椺傪嶲徠偟偰偔偩偝偄丅

  ( 4) 俶俠巜椷僨乕僞偺儕乕僪偺奐巒

娭悢柤  cnc_upstart

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_upstart(unsigned short FlibHndl,
                                                                short number);

夝愢    俶俠巜椷僨乕僞偺儕乕僪乮傾僢僾儘乕僪乯偺奐巒傪儔僀僽儔儕偵捠抦偟傑偡丅
        乮傾僢僾儘乕僪傪峴偆慜偵昁偢幚峴偡傞昁梫偑偁傝傑偡乯

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        number  僾儘僌儔儉斣崋傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_BUSY         價僕傿
                                丒cnc_upstart娭悢傪幚峴嵪傒偱偡丅
                                丂cnc_upend娭悢偵偰慜夞偺弌椡傪廔椆偝偣偰偔偩
                                  偝偄丅
                                丒CNC偑傾儔乕儉(PS000,PS101)忬懺
                                丂CNC懁偺傾儔乕儉傪夝彍偟偰偔偩偝偄丅

                EW_DATA         僨乕僞偺岆傝
                                僾儘僌儔儉斣崋(number)偑尒偮偐傝傑偣傫丄傑偨偼
                                晄惓偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        乽NC巜椷僨乕僞偺儕乕僪(cnc_upload)乿偺巊梡椺傪嶲徠偟偰偔偩偝偄丅

  ( 5) 俶俠巜椷僨乕僞偺儕乕僪

娭悢柤  cnc_upload

愰尵    #include        "Fwlib32.h
        FWLIBAPI short WINAPI cnc_upload(unsigned short FlibHndl,
                                        ODBUP *upld, unsigned short *number);

夝愢    CNC偺僥乕僾婰壇乮僾儘僌儔儉儊儌儕乯偵搊榐偝傟偰偄傞俶俠巜椷僨乕僞偺儕乕
        僪乮傾僢僾儘乕僪乯傪峴偄傑偡丅

        傾僢僾儘乕僪傪峴偆庤弴傪埲壓偵帵偟傑偡丅

                劇劅劅劅劅劅劅劅劅劅劉
                劆  cnc_upstart()丂 劆  傾僢僾儘乕僪偺奐巒
                劋劅劅劅劅劍劅劅劅劅劊丂乮昁偢峴偭偰偔偩偝偄乯
          劇劅劅劅劅劅劅仺伀
          劆    劇劅劅劅劅劏劅劅劅劅劉
          劆    劆  cnc_upload()丂  劆丂俶俠巜椷僨乕僞偺擖椡
          劆  丂劋劅劅劅劅劍劅劅劅劅劊
          劆  丂丂丂丂丂丂伀
          劆 No 劇劅劅劅劅劏劅劅劅劅劉
          劋劅劅劎 嵟屻偺僨乕僞='%'?劆
              丂劋劅劅劅劅劍劅劅劅劅劊
              丂丂丂丂丂丂伀Yes
                劇劅劅劅劅劏劅劅劅劅劉
                劆   cnc_upend()  丂劆丂傾僢僾儘乕僪偺廔椆
                劋劅劅劅劅劅劅劅劅劅劊丂乮昁偢峴偭偰偔偩偝偄乯

        擖椡僨乕僞偺僼僅乕儅僢僩
        ~~~~~~~~~~~~~~~~~~~~~~~~
        CNC懁偐傜撉傒崬傑傟傞NC僾儘僌儔儉偼埲壓偺傛偆側僼僅乕儅僢僩偺ASCII
        僐乕僪偺暥帤楍偱偡丅

                % LF Oxxxx LF 僽儘僢僋1 LF 僽儘僢僋2 LF ... LF Mxx LF %

                偨偩偟  LF      0x0A ('\n')
                        Oxxxx   僾儘僌儔儉斣崋
                        Mxx     僾儘僌儔儉枛旜偺俵僐乕僪(M02,M30側偳)

        僶僢僼傽偵彂偒崬傑傟偨暥帤楍偺廔抂偵偼 null暥帤('\x00')偑晅壛偝傟傑
        偣傫丅撉傒崬傑傟偨NC僾儘僌儔儉偺枛旜偼 '%' 偱偡丅偙偺 '%' 傪撉傒崬傒
        偺廔椆忦審偲偟偰偔偩偝偄丅
        偙偺枛旜偺 '%' 偑憲傜傟偰偒偨屻偵偝傜偵撉傒崬傒傪幚峴偡傞偲丄壗傕撉傒
        庢傟傑偣傫丅
        椺偊偽丄

                O1234 ;
                G1 F0.3 W10. ;
                M30 ;
                %

        偲偄偆僾儘僌儔儉傪杮娭悢偱撉傒崬傓偲丄


                僶僢僼傽僒僀僘偑廫暘戝偒偄応崌
                1夞栚           "%\nO1234\nG1F0.3W10.\nM30\n%"  (24暥帤)
                2夞栚埲崀       ""                              (0暥帤)

        偲偄偆暥帤楍偑摼傜傟傑偡丅僶僢僼傽僒僀僘偑24僶僀僩傛傝傕抁偄応崌偼師
        偺傛偆偵側傝傑偡丅

                僶僢僼傽僒僀僘偑10僶僀僩偺応崌
                1夞栚           "%\nO1234\nG1"  (10暥帤)
                2夞栚           "F0.3W10.\nM"   (10暥帤)
                3夞栚           "30\n%"         (4暥帤)
                4夞栚埲崀       ""              (0暥帤)

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        upld    俶俠巜椷僨乕僞傪曉偡ODBUP峔憿懱傊偺億僀儞僞偱偡丅
                ODBUP峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbup {
                        short   dummy[2] ;              /* 枹巊梡 */
                        char    data[MAX_RBUF] ;        /* 俶俠巜椷僨乕僞 */
                } ODBUP ;                       (MAX_RBUF : 嵟戝儕乕僪暥帤悢)

                ODBUP峔憿懱偺儕乕僪僶僢僼傽僒僀僘 MAX_RBUF 偺僨僼僅儖僩抣偼 256
                偱偡丅

                ODBUP      0劇劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劉
                            劆             dummy[0]             劆
                           2劌劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劎
                            劆             dummy[1]             劆
                           4劌劅劅劅劅劅劅劅劅劍劅劅劅劅劅劅劅劅劊
                            劆data[0] 丂      劆
                           5劌劅劅劅劅劅劅劅劅劎
                            乣                乣
                4+MAX_RBUF-1劌劅劅劅劅劅劅劅劅劎
                            劆data[MAX_RBUF-1]劆
                4+MAX_RBUF  劋劅劅劅劅劅劅劅劅劊

        number  撉傒庢傞暥帤悢傪巜掕偡傞曄悢偺傾僪儗僗傪巜掕偟傑偡丅
                偙偺曄悢(*number) 偵懳偟偰侾夞偱擖椡偡傞暥帤悢傪僙僢僩偟偰偔偩
                偝偄丅
                儕乕僪廔椆屻丄偙偺曄悢(*number) 偵幚嵺偵撉傒庢偭偨暥帤悢偑嵞僙
                僢僩偝傟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_FUNC         cnc_upstart娭悢偑幚峴偝傟偰偄傑偣傫丅

                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝

                                俶俠巜椷僨乕僞偺撉傒庢傝暥帤悢(*number)偵 0 偑
                                巜掕偝傟偰偄傑偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼CNC懁偵搊榐偝傟偰偄傞NC僾儘僌儔儉傪撉傒崬傒丄偦偺
        撪梕傪夋柺偵昞帵偟傑偡丅

#include <stdio.h>
#include "apilib.h"
#define BUFSIZE 40
/* number is NC program number to be read. */
short example( short number )
{
        char buf[BUFSIZE+4] ;
        short ret, number ;
        ret = cnc_upstart( FlibHndl ) ;
        if ( ret ) return ( ret ) ;
        for (;;) {
                number = BUFSIZE - 1 ;
                ret = cnc_upload( FlibHndl, (ODBUP *)(&buf), &number ) ;
                if ( ret ) {
                        cnc_upend( FlibHndl ) ;
                        return ( ret ) ;
                }
                buf[4+number] = '\x00' ;
                printf( "%s", &buf[4] ) ;
                if ( buf[4+number-1] == '%' ) break ;
        }
        putchar( '\n' ) ;
        ret = cnc_upend( FlibHndl ) ;
        return ( ret ) ;
}

  ( 6) 俶俠巜椷僨乕僞偺儕乕僪偺廔椆

娭悢柤  cnc_upend

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_upend(unsigned short FlibHndl);

夝愢    俶俠巜椷僨乕僞偺儕乕僪乮傾僢僾儘乕僪乯偺廔椆傪儔僀僽儔儕偵捠抦偟傑偡丅
        乮傾僢僾儘乕僪傪峴偭偨屻丄昁偢幚峴偡傞昁梫偑偁傝傑偡乯

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_FUNC         cnc_upstart娭悢偑幚峴偝傟偰偄傑偣傫丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        乽NC巜椷僨乕僞偺擖椡(cnc_upload)乿偺巊梡椺傪嶲徠偟偰偔偩偝偄丅

  ( 7) 巜掕僾儘僌儔儉偺僒乕僠

娭悢柤  cnc_search

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_search(unsigned short FlibHndl,
                                                                short number);

夝愢    CNC偺僾儘僌儔儉儊儌儕偵搊榐偝傟偰偄傞僾儘僌儔儉斣崋傪僒乕僠偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        number  僾儘僌儔儉斣崋傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_BUSY         價僕傿
                                丒"OP"怣崋僆儞拞乮EDIT,MEMORY 儌乕僪偺傒乯
                                丂壛岺僾儘僌儔儉傪塣揮拞偱偡丅
                                丒僟僂儞儘乕僪(cnc_dwnend)偵偰張棟傪廔椆偝偣偰
                                  偔偩偝偄丅
                                丒CNC偑傾儔乕儉乮PS000,PS101乯忬懺
                                丂CNC懁偺傾儔乕儉傪夝彍偟偰偔偩偝偄丅

                EW_DATA         僨乕僞偺岆傝
                                僾儘僌儔儉(number)偑NC撪偵懚嵼偟傑偣傫丄傑偨偼
                                晄惓偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       CNC偺儌乕僪偵傛傝丄摦嶌撪梕偑曄傢傝傑偡丅
                        EDIT,MEMORY 儌乕僪丗僼僅傾僌儔僂儞僪僒乕僠
                        忋婰埲奜偺儌乕僪丂丗僶僢僋僌儔僂儞僪僒乕僠
                乮僼僅傾僌儔僂儞僪僒乕僠丗慖戰拞僾儘僌儔儉偺嵞愝掕傪峴偄傑偡乯
                乮僶僢僋僌儔僂儞僪僒乕僠丗巜掕僾儘僌儔儉偺懚嵼妋擣傪峴偄傑偡乯

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼巜掕偝傟偨斣崋偺僾儘僌儔儉傪僒乕僠偟丄寢壥傪昞帵偟
        傑偡丅

#include <stdio.h>
#include "apilib.h"

/* num is program number to be searched. */
void example( short num )

{
        short ret ;
        ret = cnc_search( FlibHndl, num ) ;
        switch ( ret ) {
                case EW_OK:
                        printf( "PROGRAM O%d have been searched.\n", num ) ;
                case EW_DATA:
                        printf( "PROGRAM O%d doesn't exist.\n", num ) ;
                case EW_PROT:
                        printf( "PROTECTED.\n" ) ;
                case EW_BUSY:
                        printf( "REJECTED.\n" ) ;
        }
}

  ( 8) 慡僾儘僌儔儉偺嶍彍

娭悢柤  cnc_delall

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_delall(unsigned short FlibHndl);

夝愢    CNC偵搊榐偝傟偰偄傞偡傋偰偺僾儘僌儔儉斣崋傪嶍彍偟傑偡丅

        僾儘僥僋僩偝傟偰偄傞僾儘僌儔儉偵懳偡傞嶍彍偼峴傢傟傑偣傫丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_BUSY         價僕傿
                                丒CNC懁偑僶僢僋僌儔僂儞僪曇廤拞
                                丂僶僢僋僌儔僂儞僪曇廤傪廔椆偝偣偰偔偩偝偄丅
                                丒僟僂儞儘乕僪丄徠崌幚峴拞
                                丂cnc_dwnend偵偰張棟傪廔椆偝偣偰偔偩偝偄丅
                                丒CNC偑傾儔乕儉(PS000,PS101)忬懺
                                丂CNC懁偺傾儔乕儉傪夝彍偟偰偔偩偝偄丅
                                丒CNC 偑 MEMORY,MDI 儌乕僪
                                丂儌乕僪傪 MEMORY,MDI 埲奜偵曄峏偟偰偔偩偝偄丅
                                丒"OP"怣崋僆儞拞乮EDIT,MEMORY 儌乕僪偺傒乯
                                丂壛岺僾儘僌儔儉傪塣揮拞偱偡丅

                EW_PROT         儔僀僩僾儘僥僋僩
                                丒僾儘僥僋僩KEY(DI)偑ON偵側偭偰偄傑偡
                                丒CNC偺僷儔儊乕僞乮8000斣戜/9000斣戜僾儘僥僋僩丄
                                  埫崋壔乯偑彂偒崬傒嬛巭偺愝掕偵側偭偰偄傑偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       杮婡擻偵偼埲壓偺儌乕僪偑娭學偟傑偡丅
                MEM, MDI 埲奜偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼慡僾儘僌儔儉傪嶍彍偟丄寢壥傪昞帵偟傑偡丅

#include <stdio.h>
#include "apilib.h"

void example( void )
{

        short ret ;
        ret = cnc_delall( FlibHndl ) ;
        switch ( ret ) {
                case EW_OK:
                        printf( "ALL PROGRAMS has been deleted.\n", num ) ;
                case EW_PROT:
                        printf( "PROTECTED.\n" ) ;
                case EW_BUSY:
                        printf( "REJECTED.\n" ) ;
        }
}

  ( 9) 巜掕僾儘僌儔儉偺嶍彍

娭悢柤  cnc_delete

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_delete(unsigned short FlibHndl,
                                                                short number);

夝愢    CNC懁偵搊榐偝傟偰偄傞摿掕偺壛岺僾儘僌儔儉(NC巜椷僨乕僞)傪嶍彍偟傑偡丅

        僾儘僥僋僩偝傟偰偄傞僾儘僌儔儉偵懳偡傞嶍彍偼峴傢傟傑偣傫丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        number  僾儘僌儔儉斣崋傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_BUSY         價僕傿
                                丒CNC懁偑僶僢僋僌儔僂儞僪曇廤拞
                                丂僶僢僋僌儔僂儞僪曇廤傪廔椆偝偣偰偔偩偝偄丅
                                丒僟僂儞儘乕僪丄徠崌幚峴拞
                                丂cnc_dwnend偵偰張棟傪廔椆偝偣偰偔偩偝偄丅
                                丒CNC偑傾儔乕儉(PS000,PS101)忬懺
                                丂CNC懁偺傾儔乕儉傪夝彍偟偰偔偩偝偄丅
                                丒CNC 偑 MDI 儌乕僪
                                丂儌乕僪傪 MDI 埲奜偵曄峏偟偰偔偩偝偄丅
                                丒"OP"怣崋僆儞拞乮EDIT,MEMORY 儌乕僪偺傒乯
                                丂壛岺僾儘僌儔儉傪塣揮拞偱偡丅
                                丒僼僅傾僌儔僂儞僪偱慖戰偝傟偰偄傞僾儘僌儔儉
                                丂慖戰拞偺僾儘僌儔儉傪曄峏偟偰偔偩偝偄丅

                EW_PROT         儔僀僩僾儘僥僋僩
                                丒僾儘僥僋僩KEY(DI)偑ON偵側偭偰偄傑偡
                                丒CNC偺僷儔儊乕僞乮8000斣戜/9000斣戜僾儘僥僋僩丄
                                  埫崋壔乯偑彂偒崬傒嬛巭偺愝掕偵側偭偰偄傑偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       杮婡擻偵偼埲壓偺儌乕僪偑娭學偟傑偡丅
                MDI 埲奜偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼巜掕偝傟偨斣崋偺僾儘僌儔儉傪嶍彍偟丄寢壥傪昞帵偟
        傑偡丅


#include <stdio.h>
#include "apilib.h"

/* num is program number to be deleted. */
void example( short num )
{
        short ret ;
        ret = cnc_delete( FlibHndl, num ) ;
        switch ( ret ) {
                case EW_OK:
                        printf( "PROGRAM O%d has been deleted.\n", num ) ;
                case EW_DATA:
                        printf( "PROGRAM O%d doesn't exist.\n", num ) ;
                case EW_PROT:
                        printf( "PROTECTED.\n" ) ;
                case EW_BUSY:
                        printf( "REJECTED.\n" ) ;
        }
}

  (10) 僾儘僌儔儉僨傿儗僋僩儕偺儕乕僪

娭悢柤  cnc_rdprogdir

愰尵    #include        "Fwlib32.h
        FWLIBAPI short WINAPI cnc_rdprogdir(unsigned short FlibHndl,
                short type, short datano_s, short datano_e, short length,
                                                        PRGDIR *prgdir);

夝愢    CNC懁偵搊榐偝傟偰偄傞慡偰偺壛岺僾儘僌儔儉偺僾儘僌儔儉斣崋堦棗傪撉傒
        偩偟傑偡丅

        巜掕偝傟偨斖埻偺僾儘僌儔儉斣崋丄僐儊儞僩丄巊梡暥帤悢傪ASCII暥帤楍宍幃
        偱撉傒偩偟傑偡丅datano_s, datano_e 偵偦傟偧傟撉傒偩偟奐巒僾儘僌儔儉斣
        崋丄撉傒偩偟廔椆僾儘僌儔儉斣崋傪僙僢僩偟傑偡丅慡偰偺僾儘僌儔儉傪撉傒
        偩偡偵偼 datano_s=1, datano_e=9999 偲偟傑偡丅type 偱撉傒偩偡僾儘僌儔
        儉堦棗偺宍幃傪巜掕偟傑偡

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        type    撉傒弌偡僾儘僌儔儉堦棗偺宍幃傪巜掕偟傑偡丅
                        0 : 僾儘僌儔儉斣崋偺傒
                        1 : 僾儘僌儔儉斣崋偲僐儊儞僩
                        2 : 僾儘僌儔儉斣崋丄僐儊儞僩偍傛傃巊梡暥帤悢
        datano_s
                奐巒僾儘僌儔儉斣崋傪巜掕偟傑偡丅

        datano_e
                廔椆僾儘僌儔儉斣崋傪巜掕偟傑偡丅

        length  僽儘僢僋挿(僶僢僼傽僒僀僘)傪巜掕偟傑偡丅

        prgdir  僾儘僌儔儉僨傿儗僩僋儕傪曉偡PRGDIR峔憿懱傊偺億僀儞僞偱偡丅
                PRGDIR峔憿懱偼師偺捠傝偱偡丅
                typedef struct prgdir {
                        char    prg_data[MAX_PBUF] ;    /* 僨傿儗僩僋儕僨乕僞 */
                } PRGDIR ;                      (MAX_PBUF : 嵟戝儕乕僪暥帤悢)

        儕乕僪僨乕僞偺僼僅乕儅僢僩
        ~~~~~~~~~~~~~~~~~~~~~~~~~~
        CNC懁偐傜撉傒崬傑傟傞僾儘僌儔儉僨傿儗僋僩儕忣曬偼埲壓偺傛偆側僼僅乕儅僢
        僩偺ASCII僐乕僪偺暥帤楍偱偡丅

        type=0  Oxxxx Oxxxx ... %

        type=1  % LF Oxxxx (僐儊儞僩) LF Oxxxx (僐儊儞僩) LF ... LF %

        type=2  Oxxxx (僐儊儞僩) 巊梡暥帤悢 Oxxxx (僐儊儞僩) 巊梡暥帤悢 ... %

                偨偩偟  LF              0x0A ('\n')
                        Oxxxx           僾儘僌儔儉斣崋丅徃弴偵僜乕僩偝傟傑偡丅

                                        悢帤晹暘偼愭峴偡傞'0'偑徣棯偝傟偨ASCII
                                        暥帤楍偱偡丅("O1"乣"O9999")
                        巊梡暥帤悢      愭峴偡傞'0'偑徣棯偝傟偨ASCII暥帤楍偱偡丅
                                        偙偺悢抣偼80暥帤扨埵偵愗傝忋偘傜傟偰偄
                                        傑偡丅
                        僐儊儞僩        僾儘僌儔儉斣崋偺捈屻偵婰壇偝傟偰偄傞
                                        傕偺偑奿擺偝傟傑偡丅僐儊儞僩杮懱偺嵟戝
                                        挿偼48暥帤偱偡丅(慜屻偺僇僢僐傪娷傔傞
                                        偲嵟戝50暥帤)48暥帤埲忋偺僐儊儞僩偑婰
                                        壇偝傟偰偄傞応崌偼丄48暥帤傪墇偊偨晹暘
                                        偼弌椡偝傟傑偣傫丅僾儘僌儔儉偵僐儊儞僩
                                        偑側偄応崌偼僇僢僐偺傒("()")偑奿擺偝傟
                                        傑偡丅

        偄偢傟偺巜掕偱傕丄僾儘僌儔儉偑慡偔搊榐偝傟偰偄側偄応崌傗丄巜掕偝傟偨斖
        埻偺僾儘僌儔儉偑懚嵼偟側偄応崌偼 '%' 偺傒偑弌椡偝傟傑偡丅

        僶僢僼傽偵彂偒崬傑傟偨暥帤楍偺廔抂偵偼null暥帤('\x00')偼晅壛偝傟傑偣傫丅

        CNC懁偵埲壓偺僾儘僌儔儉偑搊榐偝傟偰偄傞帪丄datano_s=1, datano_e=9999
        偲偟偰杮娭悢傪幚峴偟偨帪偵撉傒庢傟傞撪梕偼師偺傛偆偵側傝傑偡丅

                僾儘僌儔儉斣崋(僐儊儞僩)        暥帤悢
                -------------------------------+------
                O0012 (TEST) ;                  420
                O0200 (WORK1) ;                 352
                O0201 ;                         537
                O9001 (SUB-PRO1) ;              781

        type    撉傒庢傟傞撪梕
        -------+-----------------------------------------------------------
        0       "O12O200O201O9001%"
        1       "%\nO12(TEST)\nO200(WORK1)\nO201()\nO9001(SUB-PRO1)\n%"
        2       "O12(TEST)420O200(WORK1)352O201()537O9001(SUB-PRO1)781%"

        僶僢僼傽僒僀僘(length)偑彫偝偄応崌偼丄巜掕偝傟偨挿偝傑偱撉傒偩偝傟傑偡丅
        僶僢僼傽僒僀僘偑15僶僀僩偺応崌偼埲壓偺捠傝偱偡丅

        type    撉傒庢傟傞撪梕
        -------+-----------------------------------------------------------
        0       "O12O200O201O900"
        1       "%\nO12(TEST)\nO20"
        2       "O12(TEST)420O20"

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                僽儘僢僋挿(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                奐巒僾儘僌儔儉斣崋(datano_s)丄廔椆僾儘僌儔儉斣

                                崋(datano_e)偑晄惓偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                弌椡僼僅乕儅僢僩(type)偑晄惓偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼巜掕偝傟偨斖埻偺NC僾儘僌儔儉偺搊榐忬嫷傪撉傒偩偟丄
        僾儘僌儔儉斣崋堦棗傪昞帵偟傑偡丅

#include <stdio.h>
#include <string.h>
#include "apilib.h"
#define BUFSIZE 256

/* start/end specify program number range. */
short example( short start, short end )
{
        char buf[BUFSIZE] ;
        short ret, idx ;
        memset( buf, '\x00', BUFSIZE ) ;
        ret = cnc_rdprogdir( FlibHndl, 0, start, end, BUFSIZE-1,
                                (struct prgdir *)(&buf) ) ;
        if ( ret ) {
                printf( "ERROR: %d\n", ret ) ;
                return ( ret ) ;
        }
        for ( idx = 0 ; idx < strlen( buf ) ; idx++ ) {
                if ( buf[idx] == 'O' ) putchar( '\n' ) ;
                putchar( buf[idx] ) ;
        }
        putchar( '\n' ) ;
}

  (11) 僾儘僌儔儉忣曬偺儕乕僪

娭悢柤  cnc_rdproginfo

愰尵    #include        "Fwlib32.h
        FWLIBAPI short WINAPI cnc_rdproginfo(unsigned short FlibHndl,
                                short type, short length, ODBNC *prginfo);

夝愢    CNC懁偵婛偵搊榐偝傟偰偄傞壛岺僾儘僌儔儉偺娗棟僨乕僞傪撉傒偩偟傑偡丅

        壛岺僾儘僌儔儉偺娗棟僨乕僞偼丄
                搊榐偝傟偰偄傞僾儘僌儔儉偺悢
                搊榐壜擻側僾儘僌儔儉偺巆傝悢
                巊梡嵪傒偺儊儌儕椞堟(僉儍儔僋僞悢)
                巊梡壜擻側儊儌儕椞堟偺巆傝悢(僉儍儔僋僞悢)
        偱偡丅偙傟傜偺忣曬傪僶僀僫儕宍幃丄傑偨偼ASCII暥帤楍宍幃偱庢摼偱偒傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        type    弌椡僼僅乕儅僢僩傪巜掕偟傑偡丅
                        0 : 僶僀僫儕
                        1 : ASCII

        length  僨乕僞僽儘僢僋挿傪巜掕偟傑偡丅
                        12 : 僶僀僫儕
                        31 : ASCII

        prginfo 僾儘僌儔儉僨傿儗僩僋儕傪曉偡ODBNC峔憿懱傊偺億僀儞僞偱偡丅
                ODBNC峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbnc {
                     union {
                        struct {
                             short   reg_prg ;   /* 搊榐嵪僾儘僌儔儉悢 */
                             short   unreg_prg ; /* 枹搊榐僾儘僌儔儉悢 */
                             long    used_mem ;  /* 巊梡嵪儊儌儕椞堟(暥帤悢) */
                             long    unused_mem ;/* 枹巊梡儊儌儕椞堟(暥帤悢) */
                        } bin ;
                        char asc[31] ;           /* ASCII宍幃梡僶僢僼傽 */
                     } u ;
                } ODBNC ;

                type=0 偺帪
                        峔憿懱偺奺儊儞僶偵僶僀僫儕宍幃偱抣偑奿擺偝傟傑偡丅
                        prginfo.bin.reg_prg     搊榐嵪僾儘僌儔儉悢
                        prginfo.bin.unreg_prg   枹搊榐僾儘僌儔儉悢
                        prginfo.bin.used_mem    巊梡嵪儊儌儕椞堟乮僉儍儔僋僞悢乯
                        prginfo.bin.unused_mem  枹巊梡儊儌儕椞堟乮僉儍儔僋僞悢乯

                type=1 偺帪
                        prginfo.u.asc 偵埲壓偺宍幃偺ASCII暥帤楍偑奿擺偝傟傑偡丅


                        % LF d1 LF d2 LF d3 LF d4 LF %

                偨偩偟  LF      0x0A ('\n')
                        d1      搊榐嵪傒僾儘僌儔儉悢
                        d2      枹搊榐僾儘僌儔儉悢(搊榐壜擻側巆傝僾儘僌儔儉悢)
                        d3      巊梡嵪儊儌儕椞堟(僉儍儔僋僞悢)
                        d4      枹巊梡儊儌儕椞堟(巊梡壜擻側巆傝儊儌儕椞堟)
                                (僉儍儔僋僞悢)
                d1乣d4 偼愭峴偡傞 '0' 偑徣棯偝傟偨ASCII暥帤楍偱偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                僽儘僢僋挿(length)偑晄惓偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                弌椡僼僅乕儅僢僩(type)偑晄惓偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼NC僾儘僌儔儉偺娗棟僨乕僞傪撉傒偩偟丄夋柺偵昞帵偟傑
        偡丅

#include <stdio.h>
#include "apilib.h"

void example( void )
{
        ODBNC buf ;
        short ret ;
        ret = cnc_rdproginfo( FlibHndl, 0, 12, &buf ) ;
        if ( ret )
                printf( "ERROR: %d\n", ret ) ;
        else {
                printf( "Registered program number   = %d\n",
                        buf.u.bin.reg_prg ) ;
                printf( "Registerable program number = %d\n",
                        buf.u.bin.unreg_prg ) ;
                printf( "Used memory                 = %ld\n",
                        buf.u.bin.used_mem ) ;
                printf( "Free memory                 = %ld\n",
                        buf.u.bin.unused_mem ) ;
        }
}

  (12) 幚峴拞偺僾儘僌儔儉斣崋偺儕乕僪

娭悢柤  cnc_rdprgnum

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdprgnum(unsigned short FlibHndl,
                                                        ODBPRO *prgnum);

夝愢    CNC懁偱尰嵼慖戰偝傟偰偄傞壛岺僾儘僌儔儉偺僾儘僌儔儉斣崋傪撉傒偩偟傑偡丅

        偦偺帪偵CNC懁偑僒僽僾儘僌儔儉傪幚峴偟偰偄傞応崌偼丄偦偺儊僀儞僾儘僌儔儉
        偺僾儘僌儔儉斣崋傕撉弌偡偙偲偑偱偒傑偡丅偙偺帪丄撉弌偡偙偲偑偱偒傞僾儘
        僌儔儉斣崋偼丄堦斣傕偲偺恊僾儘僌儔儉偺僾儘僌儔儉斣崋偱偡丅幚峴拞偺僾儘
        僌儔儉偑僒僽僾儘僌儔儉偱側偄帪偵偼丄儊僀儞僾儘僌儔儉斣崋偵偼幚峴拞僾儘
        僌儔儉斣崋偑僙僢僩偝傟傑偡丅

        傾僾儕働乕僔儑儞僾儘僌儔儉偱CNC懁偺壛岺僾儘僌儔儉傪娗棟偡傞応崌側偳偵
        巊梡偟傑偡丅

        僾儘僌儔儉斣崋偼晞崋柍偟偺僶僀僫儕宍幃偱 buf.data, buf.mdata 偵奿擺
        偝傟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        prgnum  幚峴拞偺僾儘僌儔儉斣崋傪曉偡ODBPRO峔憿懱傊偺億僀儞僞偱偡丅
                ODBPRO峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbpro {
                     short  dummy[2] ;   /* 枹巊梡 */
                     short  data ;       /* 幚峴拞偺僾儘僌儔儉斣崋 */
                     short  mdata ;      /* 儊僀儞僾儘僌儔儉斣崋 */
                } ODBPRO ;

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        壓婰偺NC僾儘僌儔儉偺 O9876/N210 偺僽儘僢僋幚峴拞偵丄埲壓偺僾儘僌儔儉
        傪幚峴偡傞偲 "CURRENT(O9876)  MAIN(O1234)" 偲昞帵偝傟傑偡丅

#include <stdio.h>
#include "apilib.h"

void example( void )
{
        struct odbpro buf ;

        cnc_rdprgnum( FlibHndl, &buf ) ;
        printf( "CURRENT(O%d)  MAIN(O%d)\n", buf.data, buf.mdata ) ;
}

        O1234 ;                 O5678 ;                 O9876 ;
        N10 M98 P5678 ;         N110 M98 P9876 ;        N210 M45 ;
        N20 M30 ;               N120 M99 ;              N220 M99 ;

  (13) 幚峴拞偺僔乕働儞僗斣崋偺儕乕僪

娭悢柤  cnc_rdseqnum

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdseqnum(unsigned short FlibHndl,
                                                        ODBSEQ *seqnum);

夝愢    CNC懁偱尰嵼慖戰偝傟偰偄傞壛岺僾儘僌儔儉偺尰嵼偺僔乕働儞僗斣崋傪撉傒偩
        偟傑偡丅

        偨偩偟丄壛岺僾儘僌儔儉偺慡僽儘僢僋偵僔乕働儞僗斣崋偑晅偗傜傟偰偄側偄
        帪偼丄幚峴偟偨嵟屻偺僽儘僢僋偺僔乕働儞僗斣崋偑撉傑傟傑偡丅

        傾僾儕働乕僔儑儞僾儘僌儔儉偱CNC懁偱幚峴偟偰偄傞僽儘僢僋偁傞偄偼岺掱傪
        娔帇偟偨傝丄偁傞偄偼扨偵昞帵偡傞応崌側偳偵巊梡偟傑偡丅

        僔乕働儞僗斣崋偼晞崋柍偟偺僶僀僫儕宍幃偱 buf.data 偵奿擺偝傟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        seqnum  幚峴拞偺僔乕働儞僗斣崋傪曉偡ODBSEQ峔憿懱傊偺億僀儞僞偱偡丅
                ODBSEQ峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbseq {
                     short  dummy[2] ;   /* 枹巊梡 */
                     long  data     ;    /* 幚峴拞偺僔乕働儞僗斣崋 */
                } ODBSEQ ;

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        壓婰偺NC僾儘僌儔儉偺 O1234/N30 偺僽儘僢僋幚峴拞偵丄埲壓偺僾儘僌儔儉
        傪幚峴偡傞偲 "CURRENT N30" 偲昞帵偝傟傑偡丅

#include <stdio.h>
#include "apilib.h"

void example( void )
{
        struct odbact buf ;
        cnc_rdseqnum( FlibHndl, &buf ) ;
        printf( "CURRENT N%ld\n", buf.data ) ;
}


        O1234 ;
        N10 M3 S1500 ;
        N20 T12 ;
        N30 G0 X110. ;
        N40 ...

  (14) 幚峴拞僾儘僌儔儉偺儕乕僪

娭悢柤  cnc_rdexecprog

愰尵    #include        "Fwlib32.h
        FWLIBAPI short WINAPI cnc_rdexecprog(unsigned short FlibHndl,
                        unsigned short *length, short *blknum, char *data);

夝愢    幚峴拞僾儘僌儔儉偺撪梕傪巜掕暥帤悢暘撉傒偩偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        length  撉傒弌偡暥帤悢傪巜掕偡傞曄悢偺傾僪儗僗傪巜掕偟傑偡丅
                偙偺曄悢(*length) 偵懳偟偰撉傒庢傞暥帤悢傪僙僢僩偟偰偔偩偝偄丅
                儕乕僪廔椆屻丄偙偺曄悢(*length) 偵幚嵺偵撉傒庢偭偨暥帤悢偑嵞僙
                僢僩偝傟傑偡丅

        blknum  愭撉傒僽儘僢僋悢傪奿擺偡傞曄悢偺傾僪儗僗傪巜掕偟傑偡丅

        data    幚峴拞僾儘僌儔儉撪梕傪奿擺偡傞攝楍偺愭摢傾僪儗僗傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                僽儘僢僋挿(*length)偑晄惓偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (15) 俵俢俬塣揮梡僾儘僌儔儉偺弌椡

娭悢柤  cnc_wrmdiprog

愰尵    #include        "Fwlib32.h
        FWLIBAPI short WINAPI cnc_wrmdiprog(unsigned short FlibHndl,
                                                short length, char *data);

夝愢    俵俢俬塣揮梡僾儘僌儔儉傪CNC偵弌椡(僟僂儞儘乕僪)偟傑偡丅

        弌椡僨乕僞偺僼僅乕儅僢僩
        ~~~~~~~~~~~~~~~~~~~~~~~~
        CNC懁偵搊榐偡傞NC僾儘僌儔儉偼埲壓偺傛偆側僼僅乕儅僢僩偺ASCII僐乕僪偺
        暥帤楍偱偡丅

                LF Oxxxx LF 僽儘僢僋1 LF 僽儘僢僋2 LF ... LF Mxx LF %

                偨偩偟  LF      0x0A ('\n')
                        Oxxxx   僾儘僌儔儉斣崋
                        Mxx     僾儘僌儔儉枛旜偺俵僐乕僪(M02,M30側偳)

        僾儘僌儔儉慡懱偺愭摢偵偼 LF 傪丄枛旜偵偼 '%' 傪晅壛偟偰偔偩偝偄丅
        愭摢偺 LF 傛傝傕慜偵偁傞僨乕僞偼柍帇偝傟傑偡丅搊榐偡傞僾儘僌儔儉偺
        愭摢偵偼昁偢傾僪儗僗 'O' 偵懕偗偰僾儘僌儔儉斣崋傪巜掕偟偰偔偩偝偄丅
        椺偊偽丄

                O1234 ;
                G1 F0.3 W10. ;
                M30 ;
                %

        偲偄偆僾儘僌儔儉傪搊榐偡傞帪偼丄

                "\nO1234\nG1F0.3W10.\nM30\n%"

        傪 cnc_wrmdiprog娭悢偱揮憲偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        length  弌椡偡傞俶俠巜椷僨乕僞偺暥帤悢傪巜掕偟傑偡丅
                        1 乣 199

        data    俶俠巜椷僨乕僞偺愭摢傾僪儗僗傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝

                                僽儘僢僋挿(length)偑晄惓偱偡丅

                EW_DATA         僨乕僞偺岆傝
                                丒NC僾儘僌儔儉偱巊梡偱偒側偄暥帤偑専弌偝傟偨丅
                                丒TV僠僃僢僋桳岠偺帪丄僽儘僢僋撪偺暥帤悢(僽儘僢
                                  僋枛旜偺LF傪娷傓)偑婏悢偺僽儘僢僋偑専弌偝傟偨
                                忋婰偺揰傪妋擣偟偰偔偩偝偄丅

                EW_MODE         CNC儌乕僪偺岆傝
                                MDI儌乕僪偵曄峏偟偰偔偩偝偄丅

                EW_REJECT       CNC懁偺張棟幚峴嫅斲

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       杮婡擻偼 MDI儌乕僪偱巊梡偡傞昁梫偑偁傝傑偡丅

  (16) 俵俢俬塣揮梡幚峴億僀儞僞偺儕乕僪

娭悢柤  cnc_rdmdipntr

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdmdipntr(unsigned short FlibHndl,
                                                                ODBMDIP *mdip);

夝愢    MDI塣揮拞僾儘僌儔儉偵娭楢偡傞幚峴億僀儞僞忣曬傪妉摼偟傑偡丅
        妉摼偱偒傞撪梕偼埲壓偺崁栚偱偡丅
        丒幚峴拞偺僾儘僌儔儉斣崋
                MDI 塣揮偺応崌丄婎杮揑偵 0 偲側傝傑偡丅
                幚峴拞偺僾儘僌儔儉偑僒僽僾儘僌儔儉偺応崌丄僒僽僾儘僌儔儉斣崋偲
                側傝傑偡丅
        丒幚峴僽儘僢僋億僀儞僞
                尰嵼幚峴拞偺僽儘僢僋億僀儞僞偱偡丅
        丒愭撉傒僾儘僌儔儉斣崋
                愭撉傒偟偰偄傞(CNC夋柺忋偱椢怓偱昞帵)僾儘僌儔儉斣崋偱偡丅
                MDI 塣揮偺応崌丄婎杮揑偵 0 偲側傝丄僒僽僾儘僌儔儉傪愭撉傒偟偰偄
                傞応崌丄偦偺僾儘僌儔儉斣崋偲側傝傑偡丅
        丒愭撉傒僽儘僢僋億僀儞僞
                愭撉傒偟偰偄傞僾儘僌儔儉撪偺嵟屻偺僽儘僢僋億僀儞僞偱偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        mdip    幚峴億僀儞僞忣曬傪曉偡ODBMDIP峔憿懱傊偺億僀儞僞偱偡丅
                ODBMDIP峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbmdip {
                     short      mdiprog;        /* 幚峴拞偺僾儘僌儔儉斣崋 */
                     long       mdipntr;        /* 幚峴僽儘僢僋億僀儞僞 */
                     short      crntprog;       /* 愭撉傒僾儘僌儔儉斣崋 */
                     long       crntpntr;       /* 愭撉傒僽儘僢僋億僀儞僞 */
                } ODBMDIP ;

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
丂丂丂          EW_MODE         CNC儌乕僪偺岆傝
                                MDI儌乕僪偵曄峏偟偰偔偩偝偄丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       杮婡擻偼 MDI儌乕僪偱巊梡偡傞昁梫偑偁傝傑偡丅

  (17) 俵俢俬塣揮梡幚峴億僀儞僞偺儔僀僩

娭悢柤  cnc_wrmdipntr

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_wrmdipntr(unsigned short FlibHndl,
                                                                long crntpntr);

夝愢    俵俢俬塣揮梡幚峴奐巒億僀儞僞傪巜掕偟傑偡丅
        (幚峴拞億僀儞僞傪捈愙憖嶌偡傞偙偲偼偱偒傑偣傫)

        摉娭悢傪幚峴偡傞偲偒偼丄愭偵 cnc_wrmdiprog()娭悢偵傛傝丄MDI 僾儘僌儔儉
        傪搊榐偟偰偔偩偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        crntpntr
                幚峴奐巒僽儘僢僋億僀儞僞傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_DATA         僨乕僞偺岆傝
                                幚峴奐巒僽儘僢僋億僀儞僞(crntpntr)偺巜掕偑晄惓
                                偱偡丅

                EW_MODE         CNC儌乕僪偺岆傝
                                MDI儌乕僪偵曄峏偟偰偔偩偝偄丅

                EW_REJECT       CNC懁偺張棟幚峴嫅斲
                                丒曇廤拞
                                丒MDI僾儘僌儔儉偑搊榐偝傟偰偄傑偣傫丅
                                丂cnc_wrmdiprog娭悢傪巊梡偟偰丄偁傜偐偠傔僾儘僌
                                丂儔儉傪搊榐偟偰偔偩偝偄丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       杮婡擻偼 MDI儌乕僪偱巊梡偡傞昁梫偑偁傝傑偡丅

  (18) 僔乕働儞僗斣崋偺僒乕僠

娭悢柤  cnc_seqsrch

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_seqsrch(unsigned short FlibHndl,
                                                                long seq_no);

夝愢    CNC懁偱尰嵼慖戰偝傟偰偄傞壛岺僾儘僌儔儉偵懳偟偰巜掕偟偨僔乕働儞僗斣崋傪
        僒乕僠偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        seq_no  僔乕働儞僗斣崋傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_DATA         僨乕僞偺岆傝
                                巜掕偟偨僔乕働儞僗斣崋偑懚嵼偟傑偣傫丅
                EW_MODE         CNC儌乕僪偺岆傝
                                CNC儌乕僪偺崁傪嶲徠偟偰偔偩偝偄丅
                EW_REJECT       CNC懁偺張棟幚峴嫅斲

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       杮婡擻偼 MEM儌乕僪偱巊梡偡傞昁梫偑偁傝傑偡丅

  (19) 僇乕僜儖偺摢弌偟

娭悢柤  cnc_rewind

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rewind(unsigned short FlibHndl);

夝愢    CNC懁偱尰嵼慖戰偝傟偰偄傞壛岺僾儘僌儔儉偵懳偟偰僇乕僜儖偺摢弌偟傪峴偄傑
        偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_MODE         CNC儌乕僪偺岆傝
                                CNC儌乕僪偺崁傪嶲徠偟偰偔偩偝偄丅
                EW_REJECT       CNC懁偺張棟幚峴嫅斲

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       杮婡擻偵偼埲壓偺儌乕僪偑娭學偟傑偡丅
                MDI 埲奜偺儌乕僪偱巊梡偱偒傑偡丅

俶俠梡僨乕僞僼傽僀儖娭學
-------------------------------------------------------------------------------
  娭悢柤                婡  擻  撪  梕
-------------------------------------------------------------------------------
  ( 1) cnc_rdtofs       岺嬶僆僼僙僢僩検偺儕乕僪
  ( 2) cnc_wrtofs       岺嬶僆僼僙僢僩検偺儔僀僩
  ( 3) cnc_rdtofsr      岺嬶僆僼僙僢僩検偺儕乕僪乮斖埻巜掕乯
  ( 4) cnc_wrtofsr      岺嬶僆僼僙僢僩検偺儔僀僩乮斖埻巜掕乯
  ( 5) cnc_rdtofsinfo   岺嬶僆僼僙僢僩忣曬偺儕乕僪
  ( 6) cnc_rdparam      僷儔儊乕僞偺儕乕僪
  ( 7) cnc_wrparam      僷儔儊乕僞偺儔僀僩
  ( 8) cnc_rdparar      僷儔儊乕僞偺儕乕僪乮斖埻巜掕乯
  ( 9) cnc_wrparas      僷儔儊乕僞偺儔僀僩乮暋悢屄巜掕乯
  (10) cnc_rdparainfo   僷儔儊乕僞忣曬偺儕乕僪
  (11) cnc_rdsetr       僙僢僥傿儞僌僨乕僞偺儕乕僪乮斖埻巜掕乯
  (12) cnc_wrsets       僙僢僥傿儞僌僨乕僞偺儔僀僩乮暋悢屄巜掕乯
  (13) cnc_rdmacro      僇僗僞儉儅僋儘曄悢偺儕乕僪
  (14) cnc_wrmacro      僇僗僞儉儅僋儘曄悢偺儔僀僩
  (15) cnc_rdmacror     僇僗僞儉儅僋儘曄悢偺儕乕僪乮斖埻巜掕乯
  (16) cnc_wrmacror     僇僗僞儉儅僋儘曄悢偺儔僀僩乮斖埻巜掕乯
  (17) cnc_rdmacroinfo  僇僗僞儉儅僋儘曄悢忣曬偺儕乕僪
  (18) cnc_getmactype   僇僗僞儉儅僋儘曄悢僞僀僾偺庢摼
  (19) cnc_setmactype   僇僗僞儉儅僋儘曄悢僞僀僾偺愝掕
-------------------------------------------------------------------------------

  ( 1) 岺嬶僆僼僙僢僩検偺儕乕僪

娭悢柤  cnc_rdtofs

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdtofs(unsigned short FlibHndl, short number,
                                short type, short length, ODBTOFS *tofs);

夝愢    number,type偱巜掕偝傟偨斣崋偺岺嬶僆僼僙僢僩検傪撉傒弌偟傑偡丅
        僆僼僙僢僩検偼晞崋晅偺僶僀僫儕宍幃偱ODBTOFS撪偺data偵奿擺偝傟傑偡丅

        僆僼僙僢僩検偺扨埵偼埲壓偺偲偍傝偱偡丅

                                              捈慄幉     捈慄幉     夞揮幉
                              1004#1 1004#0  儈儕擖椡  僀儞僠擖椡
                               (ISC)  (ISA)       [mm]     [inch]      [deg]
                ---------------------------+----------+----------+----------
           (IS-A)                0      1   0.01       0.001      0.01
           (IS-B)                0      0   0.001      0.0001     0.001
           (IS-C)                1      0   0.0001     0.00001    0.0001
                IS-A 偼丄Power Mate-H 偺応崌偵桳岠偱偡丅
                IS-C 偼丄Power Mate-D 偺応崌偵桳岠偱偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        number  儕乕僪偡傞僆僼僙僢僩斣崋傪巜掕偟傑偡丅
                儕乕僪壜擻側僆僼僙僢僩偺慻悢偼丄cnc_rdtofsinfo()娭悢偱庢摼偱偒
                傑偡丅

        type    儕乕僪偡傞僆僼僙僢僩偺僞僀僾亖侽傪巜掕偟傑偡丅

        length  僨乕僞僽儘僢僋挿乮ODBTOFS峔憿懱偺僒僀僘亖俉乯傪巜掕偟傑偡丅

        tofs    岺嬶僆僼僙僢僩検傪曉偡ODBTOFS峔憿懱傊偺億僀儞僞偱偡丅
                ODBTOFS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbtofs {
                        short   datano ; /* 僆僼僙僢僩斣崋 */
                        short   type ;   /* 僆僼僙僢僩偺僞僀僾 */
                        long    data ;   /* 僆僼僙僢僩検 */
                } ODBTOFS ;

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBTOFS峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                僆僼僙僢僩斣崋(number)偺巜掕偑晄揔愗偱偡丅


                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                僆僼僙僢僩偺僞僀僾(type)偺巜掕偑晄揔愗偱偡丅


CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻嵶偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅
                        1004#0(Power Mate-H 偺応崌)
                        1004#1(Power Mate-D 偺応崌)

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼巜掕偝傟偨岺嬶斣崋偺曗惓検傪撉傒偩偟偰昞帵偟傑偡丅

#include <stdio.h>
#include "apilib.h"

/* tidx is tool index. */
void example( short tidx )
{
        ODBTOFS tofs ;
        short ret ;
        ret = cnc_rdtofs( FlibHndl, tidx, 0, 8, &tofs ) ;
        if ( !ret ) printf( "Z(%d) = %ld\n", tidx, tofs.data ) ;
}

  ( 2) 岺嬶僆僼僙僢僩検偺儔僀僩

娭悢柤  cnc_wrtofs

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_wrtofs(unsigned short FlibHndl, short number,
                                        short type, short length, long data);

夝愢    number,type偱巜掕偝傟偨斣崋偺岺嬶僆僼僙僢僩検傪data偱巜掕偝傟偨抣偵彂偒
        姺偊傑偡丅僆僼僙僢僩検偼晞崋晅偺僶僀僫儕宍幃偱data偵奿擺偟傑偡丅

        僆僼僙僢僩検偺扨埵偼埲壓偺偲偍傝偱偡丅

                                              捈慄幉     捈慄幉     夞揮幉
                              1004#1 1004#0  儈儕擖椡  僀儞僠擖椡
                               (ISC)  (ISA)       [mm]     [inch]      [deg]
                ---------------------------+----------+----------+----------
           (IS-A)                0      1   0.01       0.001      0.01
           (IS-B)                0      0   0.001      0.0001     0.001
           (IS-C)                1      0   0.0001     0.00001    0.0001
                IS-A 偼丄Power Mate-H 偺応崌偵桳岠偱偡丅
                IS-C 偼丄Power Mate-D 偺応崌偵桳岠偱偡丅

        僆僼僙僢僩検偺愝掕壜擻側僨乕僞斖埻偼埲壓偺偲偍傝偱偡丅

                                        捈慄幉         捈慄幉        夞揮幉
                       1004#1 1004#0   儈儕擖椡      僀儞僠擖椡
                        (ISC)  (ISA)        [mm]         [inch]          [deg]
                -------------------+--------------+--------------+--------------
           (IS-A)         0      0  亇 999.99      亇 99.999      亇 999.99
           (IS-B)         0      0  亇 999.999     亇 99.9999     亇 999.999
           (IS-C)         1      0  亇 999.9999    亇 99.99999    亇 999.9999
                IS-A 偼丄Power Mate-H 偺応崌偵桳岠偱偡丅
                IS-C 偼丄Power Mate-D 偺応崌偵桳岠偱偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        number  儔僀僩偡傞僆僼僙僢僩斣崋傪巜掕偟傑偡丅
                儔僀僩壜擻側僆僼僙僢僩偺慻悢偼丄cnc_rdtofsinfo()娭悢偱庢摼偱偒
                傑偡丅

        type    儔僀僩偡傞僆僼僙僢僩偺僞僀僾亖侽傪巜掕偟傑偡丅

        length  僨乕僞僽儘僢僋挿乮亖俉乯傪巜掕偟偰偔偩偝偄丅

        data    岺嬶僆僼僙僢僩検傪愝掕偟偰偔偩偝偄丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅

                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                僒僀僘(length)偑8枹枮偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                僆僼僙僢僩斣崋(number)偺巜掕偑晄揔愗偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                僆僼僙僢僩偺僞僀僾(type)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                        1004#0(Power Mate-H 偺応崌)
                        1004#1(Power Mate-D 偺応崌)

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼巜掕偝傟偨斣崋偺僆僼僙僢僩検傪彂偒姺偊傑偡丅

#include <stdio.h>
#include "apilib.h"

/* tidx is tool index. */
/* offset is new offset value. */
short example( short tidx, long offset )
{
        short ret ;
        ret = cnc_wrtofs( FlibHndl, tidx, 0, 8, offset ) ;
        return ( ret ) ;
}

  ( 3) 岺嬶僆僼僙僢僩検偺儕乕僪乮斖埻巜掕乯

娭悢柤  cnc_rdtofsr

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdtofsr(unsigned short FlibHndl,
                short s_number, short type, short e_number, short length,
                                                        IODBTO *tofsr);

夝愢    s_number,e_number,type偱巜掕偝傟偨斖埻偺岺嬶僆僼僙僢僩検傪撉傒弌偟傑偡丅
        僆僼僙僢僩検偼晞崋晅偺僶僀僫儕宍幃偱IODBTO撪偵奿擺偝傟傑偡丅

        僆僼僙僢僩検偺扨埵偼乽岺嬶僆僼僙僢僩検偺儕乕僪(cnc_rdtofs)乿偲摨偠偱偡丅
        摨娭悢偺夝愢傪嶲徠偟偰偔偩偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        s_number
                儕乕僪傪奐巒偡傞僆僼僙僢僩斣崋傪巜掕偟傑偡丅
                儕乕僪壜擻側僆僼僙僢僩偺慻悢偼丄cnc_rdtofsinfo()娭悢偱庢摼偱偒
                傑偡丅

        e_number
                儕乕僪傪廔椆偡傞僆僼僙僢僩斣崋傪巜掕偟傑偡丅

        type    儕乕僪偡傞僆僼僙僢僩偺僞僀僾傪巜掕偟傑偡乮埲壓嶲徠乯丅

        length  僨乕僞僽儘僢僋挿傪巜掕偟傑偡乮埲壓嶲徠乯丅

        tofsr   岺嬶僆僼僙僢僩検傪曉偡IODBTO峔憿懱傊偺億僀儞僞偱偡丅
                IODBTO峔憿懱偼師偺捠傝偱偡丅
                typedef struct  iodbto {
                    short datano_s;             /* 奐巒僆僼僙僢僩斣崋 */
                    short type;                 /* 僆僼僙僢僩偺僞僀僾 */
                    short datano_e;             /* 廔椆僆僼僙僢僩斣崋 */
                    union {
                        long    m_ofs[N];       /* 屄暿 */
                        long    m_ofs_a[N];     /* 慡懱 */
                    } u ;
                } IODBTO ;      /* N 偼撉傒偩偡僆僼僙僢僩検偺屄悢 */

        type偵巜掕偡傞抣丄偍傛傃僨乕僞僽儘僢僋挿(length)偺巜掕丄撉傒偩偝傟傞曗
        惓検偺庬椶偲奿擺偝傟傞応強偼埲壓偺偲偍傝偱偡丅

        type    length  懏惈    曗惓検偺庬椶    奿擺偝傟傞応強
        -------+-------+-------+---------------+--------------------------
         0      6+4*N   屄暿    岺嬶曗惓検      tofsr.u.m_ofs[i]
        -------+-------+-------+---------------+--------------------------
        -1      6+4*N   慡懱    岺嬶曗惓検      tofsr.u.m_ofs_a[i]
        N 偼撉傒偩偡僆僼僙僢僩偺屄悢丄i=0乣(N-1) 偱偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅

        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBTOFS峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                僆僼僙僢僩斣崋(number)偺巜掕偑晄揔愗偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                僆僼僙僢僩偺僞僀僾(type)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻嵶偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅
                        1004#0(Power Mate-H 偺応崌)
                        1004#1(Power Mate-D 偺応崌)

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼(99慻)偺慡岺嬶曗惓検傪撉傒偩偟偰昞帵偟傑偡丅

#include <stdio.h>
#include <stdlib.h>
#include "apilib.h"
#define MAXTOOL 99

short example( void )
{
        IODBTO *tofsr ;
        short ret, idx ;
        tofsr = (IODBTO *)malloc( 6+4*MAXTOOL ) ;
        ret = cnc_rdtofsr( FlibHndl, 1, 0, MAXTOOL, 6+4*MAXTOOL, tofsr ) ;
        if ( !ret ) {
                printf( "No  Z:offset\n" ) ;
                printf( "---+-------+\n" ) ;
                for ( idx = 0 ; idx < MAXTOOL ; idx++ ) {
                        printf( "%02d%8ld\n",idx, tofsr->u.m_ofs[i] ) ;
                }
        }
        free( tofsr ) ;
        return ( ret ) ;
}

  ( 4) 岺嬶僆僼僙僢僩検偺儔僀僩乮斖埻巜掕乯

娭悢柤  cnc_wrtofsr

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_wrtofsr(unsigned short FlibHndl,
                                                short length, IODBTO *tofsr);

夝愢    datano_s,datano_e,type偱巜掕偝傟偨斖埻偺岺嬶僆僼僙僢僩検傪彂偒姺偊傑偡丅
        僆僼僙僢僩検偼晞崋晅偺僶僀僫儕宍幃偱IODBTO撪偵奿擺偟傑偡丅
        僆僼僙僢僩検偺扨埵/愝掕壜擻僨乕僞斖埻偼乽岺嬶僆僼僙僢僩検偺儔僀僩(cnc_
        wrtofs)乿偲摨偠偱偡丅摨娭悢偺夝愢傪嶲徠偟偰偔偩偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        length  僨乕僞僽儘僢僋挿傪巜掕偟傑偡丅

        tofsr   彂偒姺偊傞岺嬶僆僼僙僢僩検傪巜掕偡傞IODBTO峔憿懱傊偺億僀儞僞偱
                偡丅IODBTO峔憿懱偼師偺捠傝偱偡丅
                typedef struct  iodbto {
                    short datano_s;             /* 奐巒僆僼僙僢僩斣崋 */
                    short type;                 /* 僆僼僙僢僩偺僞僀僾 */
                    short datano_e;             /* 廔椆僆僼僙僢僩斣崋 */
                    union {
                        long    m_ofs[N];       /* 屄暿 */
                        long    m_ofs_a[N];     /* 慡懱 */
                    } u ;
                } IODBTO ;      /* N 偼彂偒姺偊傞僆僼僙僢僩検偺屄悢 */

                datano_s儔僀僩傪奐巒偡傞僆僼僙僢僩斣崋傪巜掕偟傑偡丅
                        儔僀僩壜擻側僆僼僙僢僩偺慻悢偼丄cnc_rdtofsinfo()娭悢偱
                        庢摼偱偒傑偡丅

                datano_e儔僀僩傪廔椆偡傞僆僼僙僢僩斣崋傪巜掕偟傑偡丅

                type    儔僀僩偡傞僆僼僙僢僩偺僞僀僾傪巜掕偟傑偡丅

        type偵巜掕偡傞抣丄偍傛傃僨乕僞僽儘僢僋挿(length)偺巜掕丄彂偒崬傓曗惓検
        偺庬椶偲奿擺応強偼乽岺嬶僆僼僙僢僩検偺儕乕僪(斖埻巜掕)(cnc_rdtofsr)乿偲
        摨偠偱偡丅摨娭悢偺夝愢傪嶲徠偟偰偔偩偝偄丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBTOFS峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝

                                僆僼僙僢僩斣崋(number)偺巜掕偑晄揔愗偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                僆僼僙僢僩偺僞僀僾(type)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                        1004#0(Power Mate-H 偺応崌)
                        1004#1(Power Mate-D 偺応崌)

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼(99慻)偺慡岺嬶曗惓検傪愝掕偟傑偡丅

#include <stdlib.h>
#include <string.h>
#include "apilib.h"
#define MAXTOOL 99

/* offset is array of new offset value. */
short example( long *offset )
{
        IODBTO *tofsr ;
        short ret ;
        tofsr = (IODBTO *)malloc( 6+4*MAXTOOL ) ;
        tofsr->datano_s = 1 ;
        tofsr->datano_e = MAXTOOL ;
        tofsr->type = -1 ;
        memcpy( &(tofsr->u.m_ofs_a[0]), offset, 4*MAXTOOL ) ;
        ret = cnc_wrtofsr( FlibHndl, 6+4*MAXTOOL, tofsr ) ;
        free( tofsr ) ;
        return ( ret ) ;
}

  ( 5) 岺嬶僆僼僙僢僩忣曬偺儕乕僪

娭悢柤  cnc_rdtofsinfo

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdtofsinfo(unsigned short FlibHndl,
                                                        ODBTLINF *tlinf);

夝愢    岺嬶僆僼僙僢僩偺儊儌儕僞僀僾丄偍傛傃巊梡壜擻側屄悢傪撉傒偩偟傑偡丅
        ODBTLINF撪偺ofs_type, use_no偵僶僀僫儕宍幃偱奿擺偝傟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        tlinf   岺嬶僆僼僙僢僩忣曬傪曉偡ODBTLINF峔憿懱傊偺億僀儞僞偱偡丅
                ODBTLINF峔憿懱偼師偺捠傝偱偡丅
                typedef struct  odbtlinf {
                        short   ofs_type;       /* 儊儌儕僞僀僾 */
                        short   use_no;         /* 巊梡壜擻側屄悢 */
                } ODBTLINF ;

                ofs_type
                        僆僼僙僢僩偺儊儌儕僞僀僾偼忢偵侽偲側傝傑偡丅

                use_no  巊梡壜擻側僆僼僙僢僩偺屄悢


栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 6) 僷儔儊乕僞偺儕乕僪

娭悢柤  cnc_rdparam

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdparam(unsigned short FlibHndl,
                short number, short axis, short length, IODBPSD *param);

夝愢    number偱巜掕偝傟偨斣崋丄axis偱巜掕偝傟偨幉乮幉宆偺僷儔儊乕僞偺傒乯偺僷
        儔儊乕僞傪撉傒弌偟傑偡丅
        僨乕僞宍幃偼奺僷儔儊乕僞偵傛傝傑偡偑丄僶僀僩/儚乕僪/俀儚乕僪宍偺僷儔儊
        乕僞偼堦斒偵晞崋晅偺僶僀僫儕宍幃偱偡丅

        axis偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝慡幉偺撉傒庢傝傪堦搙偵峴偆偙偲偑偱
        偒傑偡丅偦偺嵺丄奺幉偺僷儔儊乕僞偼IODBPSD撪偺奺攝楍偵奿擺偝傟傑偡丅

        僷儔儊乕僞偵偼宆偲幉偺懏惈偵傛傝埲壓偺傛偆側庬椶偑偁傝丄僷儔儊乕僞斣崋
        偛偲偵堎側傝傑偡丅cnc_rdparainfo()娭悢偵傛傝丄偙傟傜偺懏惈忣曬傪儕乕僪
        偱偒傑偡丅

        僷儔儊乕僞偺庬椶        栚揑                            僶僀僩僒僀僘
        -----------------------+-------------------------------+------------
        價僢僩宍僷儔儊乕僞      1價僢僩偛偲偵堄枴傪帩偮         1
        價僢僩幉宍僷儔儊乕僞    1價僢僩偛偲偵堄枴傪帩偮(幉枅)   1
        僶僀僩宍僷儔儊乕僞      1僶僀僩挿偺僨乕僞傪婰壇         1
        僶僀僩幉宍僷儔儊乕僞    1僶僀僩挿偺僨乕僞傪婰壇(幉枅)   1
        儚乕僪宍僷儔儊乕僞      2僶僀僩挿偺僨乕僞傪婰壇         2
        儚乕僪幉宍僷儔儊乕僞    2僶僀僩挿偺僨乕僞傪婰壇(幉枅)   2
        俀儚乕僪宍僷儔儊乕僞    4僶僀僩挿偺僨乕僞傪婰壇         4
        俀儚乕僪幉宍僷儔儊乕僞  4僶僀僩挿偺僨乕僞傪婰壇(幉枅)   4

        偨偩偟丄價僢僩宍僷儔儊乕僞傪1價僢僩扨埵偱撉傒偩偡偙偲偼偱偒傑偣傫丅
        摨堦偺僷儔儊乕僞斣崋偵懏偡傞8價僢僩(偮傑傝1僶僀僩)扨埵偱堦搙偵撉傒偩偡
        偙偲偵側傝傑偡丅

        奺僷儔儊乕僞偺徻嵶偵偮偄偰偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        number  儕乕僪偡傞僷儔儊乕僞斣崋傪巜掕偟傑偡丅
                巜掕壜擻側僷儔儊乕僞斣崋偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩
                偝偄丅 傑偨丄cnc_rdparainfo()娭悢偱傕庢摼偱偒傑偡丅

        axis    儕乕僪偡傞幉斣崋傪巜掕偟傑偡丅
                      0      : 幉宍偱側偄僷儔儊乕僞
                      1乣m   : 幉宍僷儔儊乕僞偺侾幉巜掕(m : 嵟戝惂屼幉悢)
                    ALL_AXES : 幉宍僷儔儊乕僞偺慡幉巜掕(ALL_AXES : -1)

        length  僨乕僞僽儘僢僋挿乮IODBPSD峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅
                  丒4+(僷儔儊乕僞偺僶僀僩僒僀僘)*(撉傒偩偡幉悢)


                壓恾偼僷儔儊乕僞偺僒僀僘偑 4僶僀僩偺応崌偱偡丅
                僷儔儊乕僞偺僒僀僘偑 1,2僶僀僩偺応崌偼丄1屄(1幉)偁偨傝偺僨乕僞
                晹偺僒僀僘偑偦傟偧傟 1,2僶僀僩偵側傝傑偡丅

                           幉側偟/堦幉巜掕                    慡幉巜掕
                IODBPSD  0劇劅劅劅劉        劅          0劇劅劅劅劉        劅
                          劆datano劆        仾           劆datano劆        仾
                         2劌劅劅劅劎        劆          2劌劅劅劅劎        劆
                          劆type  劆      length         劆type  劆      length
                         4劌劅劅劅劏劅劅劅劉劆          4劌劅劅劅劏劅劅劅劉劆
                          劆    ldata     劆伀           劆ldatas[0]  :1幉 劆
                         8劋劅劅劅劅劅劅劅劊劅          8劌劅劅劅劅劅劅劅劎劆
                                                         乣              乣劆
                                                4+2x(n-1)劌劅劅劅劅劅劅劅劎劆
                                                         劆ldatas[n-1]:n幉 伀
                                                    4+2xn劋劅劅劅劅劅劅劅劊劅

                n 偼丄惂屼幉悢偲側傝傑偡丅

        param   僷儔儊乕僞傪曉偡IODBPSD峔憿懱傊偺億僀儞僞偱偡丅
                IODBPSD峔憿懱偼師偺捠傝偱偡丅
                typedef struct  iodbpsd {
                    short datano;              /* 僷儔儊乕僞斣崋 */
                    short type;                /* 幉斣崋 */
                    union {
                        char cdata;            /* 價僢僩/僶僀僩宍僷儔儊乕僞 */
                        short idata;           /* 儚乕僪宍僷儔儊乕僞 */
                        long ldata;            /* 俀儚乕僪宍僷儔儊乕僞 */
                        char cdatas[MAX_AXIS]; /* 價僢僩/僶僀僩幉宍僷儔儊乕僞 */
                        short idatas[MAX_AXIS];/* 儚乕僪幉宍僷儔儊乕僞 */
                        long ldatas[MAX_AXIS]; /* 俀儚乕僪幉宍僷儔儊乕僞 */
                    } u ;
                } IODBPSD ;             /* MAX_AXIS : 嵟戝惂屼幉悢 */

                datano  儕乕僪偟偨僷儔儊乕僞斣崋偑奿擺偝傟傑偡丅

                type    儕乕僪偟偨僷儔儊乕僞偺懏惈偑奿擺偝傟傑偡丅
                        幉斣崋
                            0      : 幉宍偱側偄僷儔儊乕僞
                            1乣m   : 幉宍僷儔儊乕僞偺侾幉巜掕(m : 嵟戝惂屼幉悢)
                          ALL_AXES : 幉宍僷儔儊乕僞偺慡幉巜掕(ALL_AXES : -1)

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                IODBPSD峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                僷儔儊乕僞斣崋(number)偺巜掕偑晄揔愗偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝

                                幉斣崋(axis)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼惂屼幉偺幉柤徧傪慡幉暘(幉悢=MAX_AXIS)撉傒偩偟偰昞帵偟
        傑偡丅

#include <stdio.h>
#include <stdlib.h>
#include "apilib.h"

void example( void )
{
        ODBSYS info ;
        IODBPSD param ;
        short ret, idx, axno ;
        cnc_sysinfo( 0, &info ) ;
        axno = atoi( info.axes ) ;
        ret = cnc_rdparam( FlibHndl, 1020, -1, 4+1*MAX_AXIS, &param ) ;
        for ( idx = 0 ; idx < axno ; idx++ ) {
                printf( "#%d", idx+1 ) ;
                if ( param.u.cdatas[idx] == 0 )
                        printf( "\033[7m%c\033[27m\n", idx+'1' ) ;
                else
                        printf( "%c\n", param.u.cdatas[idx] ) ;
        }
}

  ( 7) 僷儔儊乕僞偺儔僀僩

娭悢柤  cnc_wrparam

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_wrparam(unsigned short FlibHndl,
                                                short length, IODBPSD *param);

夝愢    datano偱巜掕偝傟偨斣崋丄type偱巜掕偝傟偨幉乮幉宆偺僷儔儊乕僞偺傒乯偺僷
        儔儊乕僞傪彂偒姺偊傑偡丅
        僨乕僞宍幃偼奺僷儔儊乕僞偵傛傝傑偡偑丄僶僀僩/儚乕僪/俀儚乕僪宍偺僷儔儊
        乕僞偼堦斒偵晞崋晅偺僶僀僫儕宍幃偱偡丅

        type偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝慡幉偺彂偒姺偊傪堦搙偵峴偆偙偲偑偱
        偒傑偡丅偦偺嵺丄奺幉偺僷儔儊乕僞偼IODBPSD撪偺奺攝楍偵奿擺偟傑偡丅

        僷儔儊乕僞偵偼宆偲幉偺懏惈偵傛傝埲壓偺傛偆側庬椶偑偁傝丄僷儔儊乕僞斣崋
        偛偲偵堎側傝傑偡丅cnc_rdparainfo()娭悢偵傛傝丄偙傟傜偺懏惈忣曬傪儕乕僪
        偱偒傑偡丅

        僷儔儊乕僞偺庬椶        栚揑                            僶僀僩僒僀僘
        -----------------------+-------------------------------+------------
        價僢僩宍僷儔儊乕僞      1價僢僩偛偲偵堄枴傪帩偮         1
        價僢僩幉宍僷儔儊乕僞    1價僢僩偛偲偵堄枴傪帩偮(幉枅)   1
        僶僀僩宍僷儔儊乕僞      1僶僀僩挿偺僨乕僞傪婰壇         1
        僶僀僩幉宍僷儔儊乕僞    1僶僀僩挿偺僨乕僞傪婰壇(幉枅)   1
        儚乕僪宍僷儔儊乕僞      2僶僀僩挿偺僨乕僞傪婰壇         2
        儚乕僪幉宍僷儔儊乕僞    2僶僀僩挿偺僨乕僞傪婰壇(幉枅)   2
        俀儚乕僪宍僷儔儊乕僞    4僶僀僩挿偺僨乕僞傪婰壇         4
        俀儚乕僪幉宍僷儔儊乕僞  4僶僀僩挿偺僨乕僞傪婰壇(幉枅)   4

        偨偩偟丄價僢僩宍僷儔儊乕僞傪1價僢僩扨埵偱彂偒姺偊傞偙偲偼偱偒傑偣傫丅
        摨堦偺僷儔儊乕僞斣崋偵懏偡傞8價僢僩(偮傑傝1僶僀僩)傪傑偲傔偰撉傒偩偟丄
        栚揑偺價僢僩傪曄峏偟偰偐傜8價僢僩扨埵偱彂偒姺偊傞偙偲偵側傝傑偡丅

        僷儔儊乕僞偵傛偭偰偼僨乕僞傪彂偒姺偊偨帪偵PS000傾儔乕儉揹尮傪侾搙棊偲偝
        側偗傟偽側傝傑偣傫丄偵側傞応崌偑偁傝傑偡丅

        奺僷儔儊乕僞偺徻嵶偵偮偄偰偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        length  僨乕僞僽儘僢僋挿乮IODBPSD峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅
                  丒4+(僷儔儊乕僞偺僶僀僩僒僀僘)*(彂偒姺偊傞幉悢)

                壓恾偼僷儔儊乕僞偺僒僀僘偑 4僶僀僩偺応崌偱偡丅
                僷儔儊乕僞偺僒僀僘偑 1,2僶僀僩偺応崌偼丄1屄(1幉)偁偨傝偺僨乕僞
                晹偺僒僀僘偑偦傟偧傟 1,2僶僀僩偵側傝傑偡丅

                           幉側偟/堦幉巜掕                    慡幉巜掕
                IODBPSD  0劇劅劅劅劉        劅          0劇劅劅劅劉        劅
                          劆datano劆        仾           劆datano劆        仾

                         2劌劅劅劅劎        劆          2劌劅劅劅劎        劆
                          劆type  劆      length         劆type  劆      length
                         4劌劅劅劅劏劅劅劅劉劆          4劌劅劅劅劏劅劅劅劉劆
                          劆    ldata     劆伀           劆ldatas[0]  :1幉 劆
                         8劋劅劅劅劅劅劅劅劊劅          8劌劅劅劅劅劅劅劅劎劆
                                                         乣              乣劆
                                                4+2x(n-1)劌劅劅劅劅劅劅劅劎劆
                                                         劆ldatas[n-1]:n幉 伀
                                                    4+2xn劋劅劅劅劅劅劅劅劊劅

                n 偼丄惂屼幉悢偲側傝傑偡丅

        param   彂偒姺偊傞僷儔儊乕僞傪巜掕偡傞IODBPSD峔憿懱傊偺億僀儞僞偱偡丅
                IODBPSD峔憿懱偼師偺捠傝偱偡丅
                typedef struct  iodbpsd {
                    short datano;              /* 僷儔儊乕僞斣崋 */
                    short type;                /* 幉斣崋 */
                    union {
                        char cdata;            /* 價僢僩/僶僀僩宍僷儔儊乕僞 */
                        short idata;           /* 儚乕僪宍僷儔儊乕僞 */
                        long ldata;            /* 俀儚乕僪宍僷儔儊乕僞 */
                        char cdatas[MAX_AXIS]; /* 價僢僩/僶僀僩幉宍僷儔儊乕僞 */
                        short idatas[MAX_AXIS];/* 儚乕僪幉宍僷儔儊乕僞 */
                        long ldatas[MAX_AXIS]; /* 俀儚乕僪幉宍僷儔儊乕僞 */
                    } u ;
                } IODBPSD ;             /* MAX_AXIS : 嵟戝惂屼幉悢 */

                datano  儔僀僩偡傞僷儔儊乕僞斣崋傪巜掕偟傑偡丅
                        巜掕壜擻側僷儔儊乕僞斣崋偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠
                        偟偰偔偩偝偄丅
                        傑偨丄cnc_rdparainfo()娭悢偱傕庢摼偱偒傑偡丅

                type    儔僀僩偡傞幉斣崋傪巜掕偟傑偡丅
                            0      : 幉宍偱側偄僷儔儊乕僞
                            1乣m   : 幉宍僷儔儊乕僞偺侾幉巜掕(m : 嵟戝惂屼幉悢)
                          ALL_AXES : 幉宍僷儔儊乕僞偺慡幉巜掕(ALL_AXES : -1)

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                IODBPSD峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                僷儔儊乕僞斣崋(datano)偺巜掕偑晄揔愗偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(type)偺巜掕偑晄揔愗偱偡丅

                EW_NOOPT        僆僾僔儑儞側偟
                (Power Mate)    巜掕偝傟偨僷儔儊乕僞傪巊梡偡傞偨傔偵昁梫側僆僾
                                僔儑儞偑晅壛偝傟偰偄傑偣傫丅


                EW_PROT         彂偒崬傒嬛巭偱偡丅


CNC僆僾僔儑儞   Power Mate偱偼丄摿掕偺僆僾僔儑儞偱巊梡偡傞僷儔儊乕僞偼
                偦偺僆僾僔儑儞偑昁梫側応崌偑偁傝傑偡丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺

        埲壓偺僾儘僌儔儉偼巜掕偝傟偨幉偺僗僩儘乕僋儕儈僢僩偺愝掕抣傪彂偒姺偊傑
        偡丅

#include "apilib.h"

/* axis is axis index. */
/* plus and minus are plus and minus position of stroke limit. */
short example( short axis, long plus, long minus  )
{
        IODBPSD param ;
        short ret ;
        param.datano = 1320 ;
        param.type = axis ;
        param.u.ldata = plus ;
        ret = cnc_wrparam( FlibHndl, 4+4*1, &param ) ;
        if ( ret ) return ( ret ) ;
        param.datano = 1321 ;
        param.type = axis ;
        param.u.ldata = minus ;
        ret = cnc_wrparam( FlibHndl, 4+4*1, &param ) ;
        return ( ret ) ;
}

  ( 8) 僷儔儊乕僞偺儕乕僪乮斖埻巜掕乯

娭悢柤  cnc_rdparar

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdparar(unsigned short FlibHndl,
                                  short *s_number, short axis, short *e_number,
                                                   short *length, void *param);

夝愢    s_number,e_number偱巜掕偝傟偨斖埻偺 axis偱巜掕偝傟偨幉乮幉宆偺僷儔儊乕
        僞偺傒乯偺僷儔儊乕僞傪撉傒弌偟傑偡丅
        僨乕僞宍幃偼奺僷儔儊乕僞偵傛傝傑偡偑丄僶僀僩/儚乕僪/俀儚乕僪宍偺僷儔儊
        乕僞偼堦斒偵晞崋晅偺僶僀僫儕宍幃偱偡丅

        axis偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝丄巜掕偝傟偨斖埻偺幉宍僷儔儊乕僞偼
        慡幉偺撉傒庢傝偑峴傢傟傑偡丅

        僷儔儊乕僞偵偼宆偲幉偺懏惈偵傛傝埲壓偺傛偆側庬椶偑偁傝丄僷儔儊乕僞斣崋
        偛偲偵堎側傝傑偡丅cnc_rdparainfo()娭悢偵傛傝丄偙傟傜偺懏惈忣曬傪儕乕僪
        偱偒傑偡丅

        僷儔儊乕僞偺庬椶        栚揑                            僶僀僩僒僀僘
        -----------------------+-------------------------------+------------
        價僢僩宍僷儔儊乕僞      1價僢僩偛偲偵堄枴傪帩偮         1
        價僢僩幉宍僷儔儊乕僞    1價僢僩偛偲偵堄枴傪帩偮(幉枅)   1
        僶僀僩宍僷儔儊乕僞      1僶僀僩挿偺僨乕僞傪婰壇         1
        僶僀僩幉宍僷儔儊乕僞    1僶僀僩挿偺僨乕僞傪婰壇(幉枅)   1
        儚乕僪宍僷儔儊乕僞      2僶僀僩挿偺僨乕僞傪婰壇         2
        儚乕僪幉宍僷儔儊乕僞    2僶僀僩挿偺僨乕僞傪婰壇(幉枅)   2
        俀儚乕僪宍僷儔儊乕僞    4僶僀僩挿偺僨乕僞傪婰壇         4
        俀儚乕僪幉宍僷儔儊乕僞  4僶僀僩挿偺僨乕僞傪婰壇(幉枅)   4

        偨偩偟丄價僢僩宍僷儔儊乕僞傪1價僢僩扨埵偱撉傒弌偡偙偲偼偱偒傑偣傫丅
        摨堦偺僷儔儊乕僞斣崋偵懏偡傞8價僢僩(偮傑傝1僶僀僩)扨埵偱堦搙偵撉傒弌偡
        偙偲偵側傝傑偡丅

        奺僷儔儊乕僞偺徻嵶偵偮偄偰偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        s_number
                儕乕僪傪奐巒偡傞僷儔儊乕僞斣崋傪巜掕偟傑偡丅
                娭悢偐傜偼丄幚嵺偵儕乕僪偝傟偨嵟弶偺僷儔儊乕僞斣崋偑曉傝傑偡丅

                巜掕壜擻側僷儔儊乕僞斣崋偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩
                偝偄丅 傑偨丄cnc_rdparainfo()娭悢偱傕庢摼偱偒傑偡丅

        e_number
                儕乕僪傪廔椆偡傞僷儔儊乕僞斣崋傪巜掕偟傑偡丅
                娭悢偐傜偼丄幚嵺偵儕乕僪偝傟偨嵟屻偺僷儔儊乕僞斣崋偑曉傝傑偡丅


                側偍丄CNC 懁僜僼僩偺婡擻捛壛側偳偵敽偄丄僷儔儊乕僞傕捛壛偝傟傞
                偙偲偑偁傝傑偡丅撉傒弌偡斖埻撪偵僷儔儊乕僞偑捛壛偝傟偨応崌丄僄
                儔乕偵側偭偨傝(栠傝抣:EW_LENGTH)丄傾僾儕働乕僔儑儞僾儘僌儔儉偺
                張棟偑惓偟偔幚峴偱偒側偔側傞壜擻惈偑偁傝傑偡丅偙偺傛偆側偙偲傪
                旔偗傞偨傔偵丄僷儔儊乕僞斣崋偑楢懕偟偰偄傞晹暘偺傒傪傑偲傔偰撉
                傒弌偟斖埻偵巜掕偡傞傛偆偵偟偰偔偩偝偄丅

        axis    儕乕僪偡傞幉斣崋傪巜掕偟傑偡丅
                      0      : 幉宍偱側偄僷儔儊乕僞
                      1乣m   : 幉宍僷儔儊乕僞偺侾幉巜掕(m : 嵟戝惂屼幉悢)
                    ALL_AXES : 幉宍僷儔儊乕僞偺慡幉巜掕(ALL_AXES : -1)

                側偍丄axis偵壗傪巜掕偟偰傕幉宍偱側偄僷儔儊乕僞偼撉傒弌偝傟傑偡
                偑丄巜掕斖埻撪偵幉宍偺僷儔儊乕僞偑懚嵼偡傞帪丄axis=0傪巜掕偡傞
                偲僄儔乕偲側傝傑偡(栠傝抣:EW_ATTRIB)丅

        length  巜掕偟偨斖埻偺僷儔儊乕僞傪奿擺偡傞偺偵昁梫側僨乕僞僽儘僢僋挿傪
                巜掕偟傑偡丅
                僷儔儊乕僞侾屄偁偨傝偼壓恾偺傛偆偵側傝丄偦傟偑僷儔儊乕僞斣崋弴
                (徃弴)偵巜掕偝傟偨屄悢暘暲傃傑偡偺偱丄巜掕偡傞length偼偦傟傜偺
                崌寁偵側傝傑偡丅
                  丒[4+(奺僷儔儊乕僞偺僶僀僩僒僀僘)*(撉傒偩偡幉悢)]偺崌寁

                娭悢偐傜偼丄幚嵺偵儕乕僪偟偨僒僀僘偑曉傝傑偡偺偱挿傔偵巜掕偡傞
                偙偲偑偱偒傑偡丅

                壓恾偼僷儔儊乕僞偺僒僀僘偑 1僶僀僩偺応崌偱偡丅
                僷儔儊乕僞偺僒僀僘偑 1僶僀僩偱 1屄偁偨傝偺length偑婏悢僶僀僩偵
                側傞応崌偼丄嵟屻偵僟儈乕椞堟偑昁梫偱偡丅
                僷儔儊乕僞偺僒僀僘偑 2,4僶僀僩偺応崌偼丄1屄(1幉)偁偨傝偺僒僀僘
                偑偦傟偧傟 2,4僶僀僩偵側傝傑偡偺偱僟儈乕椞堟偼晄梫偱偡丅

                           幉側偟/堦幉巜掕                    慡幉巜掕
                IODBPSD  0劇劅劅劅劉  劅                0劇劅劅劅劉        劅
                          劆datano劆  仾                 劆datano劆        仾
                         2劌劅劅劅劎  劆                2劌劅劅劅劎        劆
                          劆type  劆length/屄            劆type  劆   length/屄
                         4劌劅劍劅劊  劆                4劌劅劍劅劊        劆
                          劆cdata     劆                 劆cdatas[0]  :1幉 劆
                         5劌劅劎      劆                5劌劅劎            劆
                          劆dummy     伀                 乣  乣            劆
                         6劋劅劊      劅        4+1x(n-1)劌劅劎            劆
                                                         劆cdatas[n-1]:n幉 劆
                                                    4+1xn劌劅劎            劆
                                                         劆dummy(n偑婏悢   伀
                                                         劋劅劊  偺応崌)   劅

                n 偼丄嵟戝惂屼幉悢偱偡丅

        param   僷儔儊乕僞傪曉偡椞堟傊偺億僀儞僞偱偡丅
                屄乆偺僷儔儊乕僞偺嶲徠偼丄IODBPSD峔憿懱傪巊梡偟傑偡丅
                typedef struct  iodbpsd {
                    short datano;              /* 僷儔儊乕僞斣崋 */
                    short type;                /* 忋埵僶僀僩:宆懏惈 */
                                               /* 壓埵僶僀僩:幉斣崋 */

                    union {
                        char cdata;            /* 價僢僩/僶僀僩宍僷儔儊乕僞 */
                        short idata;           /* 儚乕僪宍僷儔儊乕僞 */
                        long ldata;            /* 俀儚乕僪宍僷儔儊乕僞 */
                        char cdatas[MAX_AXIS]; /* 價僢僩/僶僀僩幉宍僷儔儊乕僞 */
                        short idatas[MAX_AXIS];/* 儚乕僪幉宍僷儔儊乕僞 */
                        long ldatas[MAX_AXIS]; /* 俀儚乕僪幉宍僷儔儊乕僞 */
                    } u ;
                } IODBPSD ;             /* MAX_AXIS : 嵟戝惂屼幉悢 */

                datano  儕乕僪偟偨僷儔儊乕僞斣崋偑奿擺偝傟傑偡丅

                type    儕乕僪偟偨僷儔儊乕僞偺懏惈偑奿擺偝傟傑偡丅
                        忋埵僶僀僩丗宆懏惈
                            0 : 價僢僩宆
                            1 : 僶僀僩宆
                            2 : 儚乕僪宆
                            3 : 俀儚乕僪宆

                        壓埵僶僀僩丗幉斣崋
                            0      : 幉宍偱側偄僷儔儊乕僞
                            1乣m   : 幉宍僷儔儊乕僞偺侾幉巜掕(m : 嵟戝惂屼幉悢)
                          ALL_AXES : 幉宍僷儔儊乕僞偺慡幉巜掕(ALL_AXES : -1)

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                僷儔儊乕僞奿擺椞堟偺僒僀僘(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                僷儔儊乕僞斣崋(s_number,e_number)偺巜掕偑晄揔
                                愗偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(axis)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼巜掕偝傟偨斖埻偍傛傃幉偺僷儔儊乕僞傪撉傒偩偟夋柺偵
        昞帵偟傑偡丅

#include <stdio.h>
#include <stdlib.h>
#include "apilib.h"
/* start/end are start/end number to be read, axis is axis number. */
short example( short start, short end, short axis )

{
        ODBSYS info ;
        IODBPSD *param, *ptr ;
        short ret, idx1, idx2, axno, inc ;
        cnc_sysinfo( 0, &info ) ;
        axno = atoi( info.axes ) ;
        param = (IODBPSD *)calloc( 1, 1000 ) ;
        ret = cnc_rdparar( FlibHndl, start, axis, end, 1000, param ) ;
        ptr = param ;
        if ( !ret ) {
            for ( idx1 = start ; idx1 <= end ; idx1++ ) {
                if ( ( idx1 != 0 ) && ( ptr->datano == 0 ) ) break ;
                printf( "No.%05d ", ptr->datano ) ;
                switch ( ptr->type >> 8 ) {
                        case 0: printf( "BIT " ) ; break ;
                        case 1: printf( "BYTE" ) ; break ;
                        case 2: printf( "WORD" ) ; break ;
                        case 3: printf( "2WRD" ) ; break ;
                }
                switch ( ptr->type & 0xff ) {
                    case 0xff :
                        for ( idx2 = 0 ; idx2 < axno ; idx2++ ) {
                            printf( "  #%d:", idx2+1 ) ;
                            switch ( ptr->type >> 8 ) {
                                case 0:
                                    printf( "0x%02X",
                                      (unsigned char)(ptr->u.cdatas[idx2]) ) ;
                                    inc = 1 ; break ;
                                case 1:
                                    printf( "%d", ptr->u.cdatas[idx2] ) ;
                                    inc = 1 ; break ;
                                case 2:
                                    printf( "%d", ptr->u.idatas[idx2] ) ;
                                    inc = 2 ; break ;
                                case 3:
                                    printf( "%ld", ptr->u.ldatas[idx2] ) ;
                                    inc = 4 ; break ;
                            }
                        }
                        putchar( '\n' ) ;
                        ptr = (IODBPSD *)(((char *)ptr)+4+8*inc) ;
                        break ;
                    default :
                        printf( "  #%d:", ptr->type & 0xff ) ;
                    case 0 :
                        switch ( ptr->type >> 8 ) {
                            case 0:
                                printf( "  0x%02X\n",
                                        (unsigned char)(ptr->u.cdata) ) ;
                                inc = 1+1 ; break ;
                            case 1:
                                printf( "  %d\n", ptr->u.cdata ) ;
                                inc = 1+1 ; break ;
                            case 2:
                                printf( "  %d\n", ptr->u.idata ) ;

                                inc = 2 ; break ;
                            case 3:
                                printf( "  %ld\n", ptr->u.ldata ) ;
                                inc = 4 ; break ;
                        }
                        ptr = (IODBPSD *)(((char *)ptr)+4+inc) ;
                        break ;
                }
            }
        }
        else
                printf( "ERROR!(%d)\n", ret ) ;
        free( param ) ;
        return ( ret ) ;
}

  ( 9) 僷儔儊乕僞偺儔僀僩乮暋悢屄巜掕乯

娭悢柤  cnc_wrparas

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_wrparas(unsigned short FlibHndl,
                                                short length, (void *)param);

夝愢    param偵奿擺偝傟偨暋悢屄偺僷儔儊乕僞傪彂偒姺偊傑偡丅
        僨乕僞宍幃偼奺僷儔儊乕僞偵傛傝傑偡偑丄僶僀僩/儚乕僪/俀儚乕僪宍偺僷儔儊
        乕僞偼堦斒偵晞崋晅偺僶僀僫儕宍幃偱偡丅

        type偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝慡幉偺彂偒姺偊傪堦搙偵峴偆偙偲偑偱
        偒傑偡丅偦偺嵺丄奺幉偺僷儔儊乕僞偼IODBPSD撪偺奺攝楍偵奿擺偟傑偡丅

        僷儔儊乕僞偵偼宆偲幉偺懏惈偵傛傝埲壓偺傛偆側庬椶偑偁傝丄僷儔儊乕僞斣崋
        偛偲偵堎側傝傑偡丅cnc_rdparainfo()娭悢偵傛傝丄偙傟傜偺懏惈忣曬傪儕乕僪
        偱偒傑偡丅

        僷儔儊乕僞偺庬椶        栚揑                            僶僀僩僒僀僘
        -----------------------+-------------------------------+------------
        價僢僩宍僷儔儊乕僞      1價僢僩偛偲偵堄枴傪帩偮         1
        價僢僩幉宍僷儔儊乕僞    1價僢僩偛偲偵堄枴傪帩偮(幉枅)   1
        僶僀僩宍僷儔儊乕僞      1僶僀僩挿偺僨乕僞傪婰壇         1
        僶僀僩幉宍僷儔儊乕僞    1僶僀僩挿偺僨乕僞傪婰壇(幉枅)   1
        儚乕僪宍僷儔儊乕僞      2僶僀僩挿偺僨乕僞傪婰壇         2
        儚乕僪幉宍僷儔儊乕僞    2僶僀僩挿偺僨乕僞傪婰壇(幉枅)   2
        俀儚乕僪宍僷儔儊乕僞    4僶僀僩挿偺僨乕僞傪婰壇         4
        俀儚乕僪幉宍僷儔儊乕僞  4僶僀僩挿偺僨乕僞傪婰壇(幉枅)   4

        偨偩偟丄價僢僩宍僷儔儊乕僞傪1價僢僩扨埵偱彂偒姺偊傞偙偲偼偱偒傑偣傫丅
        摨堦偺僷儔儊乕僞斣崋偵懏偡傞8價僢僩(偮傑傝1僶僀僩)傪傑偲傔偰撉傒偩偟丄
        栚揑偺價僢僩傪曄峏偟偰偐傜8價僢僩扨埵偱彂偒姺偊傞偙偲偵側傝傑偡丅

        僷儔儊乕僞偵傛偭偰偼僨乕僞傪彂偒姺偊偨帪偵 PS 000傾儔乕儉丗揹尮傪侾搙棊
        偲偝側偗傟偽側傝傑偣傫丄偵側傞応崌偑偁傝傑偡丅

        奺僷儔儊乕僞偺徻嵶偵偮偄偰偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        length  彂偒姺偊傞僷儔儊乕僞傪奿擺偟偨椞堟偺僨乕僞僽儘僢僋挿傪巜掕偟傑
                偡丅
                僷儔儊乕僞侾屄偁偨傝偼壓恾偺偲偍傝偱丄偦傟偑僷儔儊乕僞斣崋弴
                (徃弴)偵暲傫偩峔憿偱偡偺偱丄巜掕偡傞length偼偦傟傜偺崌寁偵側傝
                傑偡丅
                  丒[4+(奺僷儔儊乕僞偺僶僀僩僒僀僘)*(彂偒姺偊傞幉悢)]偺崌寁

                壓恾偼僷儔儊乕僞偺僒僀僘偑 1僶僀僩偺応崌偱偡丅
                僷儔儊乕僞偺僒僀僘偑 1僶僀僩偱 1屄偁偨傝偺length偑婏悢僶僀僩偵
                側傞応崌偼丄嵟屻偵僟儈乕椞堟偑昁梫偱偡丅
                僷儔儊乕僞偺僒僀僘偑 2,4僶僀僩偺応崌偼丄1屄(1幉)偁偨傝偺僒僀僘

                偑偦傟偧傟 2,4僶僀僩偵側傝傑偡偺偱僟儈乕椞堟偼晄梫偱偡丅

                           幉側偟/堦幉巜掕                    慡幉巜掕
                IODBPSD  0劇劅劅劅劉  劅                0劇劅劅劅劉        劅
                          劆datano劆  仾                 劆datano劆        仾
                         2劌劅劅劅劎  劆                2劌劅劅劅劎        劆
                          劆type  劆length/屄            劆type  劆   length/屄
                         4劌劅劍劅劊  劆                4劌劅劍劅劊        劆
                          劆cdata     劆                 劆cdatas[0]  :1幉 劆
                         5劌劅劎      劆                5劌劅劎            劆
                          劆dummy     伀                 乣  乣            劆
                         6劋劅劊      劅        4+1x(n-1)劌劅劎            劆
                                                         劆cdatas[n-1]:n幉 劆
                                                    4+1xn劌劅劎            劆
                                                         劆dummy(n偑婏悢   伀
                                                         劋劅劊  偺応崌)   劅

                n 偼丄嵟戝惂屼幉悢偱偡丅

        param   彂偒姺偊傞僷儔儊乕僞傪奿擺偡傞椞堟傊偺億僀儞僞偱偡丅
                屄乆偺僷儔儊乕僞偺嶲徠偼丄IODBPSD峔憿懱傪巊梡偟傑偡丅
                typedef struct  iodbpsd {
                    short datano;              /* 僷儔儊乕僞斣崋 */
                    short type;                /* 忋埵僶僀僩:宆懏惈 */
                                               /* 壓埵僶僀僩:幉斣崋 */
                    union {
                        char cdata;            /* 價僢僩/僶僀僩宍僷儔儊乕僞 */
                        short idata;           /* 儚乕僪宍僷儔儊乕僞 */
                        long ldata;            /* 俀儚乕僪宍僷儔儊乕僞 */
                        char cdatas[MAX_AXIS]; /* 價僢僩/僶僀僩幉宍僷儔儊乕僞 */
                        short idatas[MAX_AXIS];/* 儚乕僪幉宍僷儔儊乕僞 */
                        long ldatas[MAX_AXIS]; /* 俀儚乕僪幉宍僷儔儊乕僞 */
                    } u ;
                } IODBPSD ;             /* MAX_AXIS : 嵟戝惂屼幉悢 */

                datano  儔僀僩偡傞僷儔儊乕僞斣崋傪巜掕偟傑偡丅
                        巜掕壜擻側僷儔儊乕僞斣崋偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠
                        偟偰偔偩偝偄丅
                        傑偨丄cnc_rdparainfo()娭悢偱傕庢摼偱偒傑偡丅

                type    儔僀僩偡傞僷儔儊乕僞偺懏惈傪巜掕偟傑偡丅
                        忋埵僶僀僩丗宆懏惈
                            0 : 價僢僩宆
                            1 : 僶僀僩宆
                            2 : 儚乕僪宆
                            3 : 俀儚乕僪宆

                        壓埵僶僀僩丗幉斣崋
                            0      : 幉宍偱側偄僷儔儊乕僞
                            1乣m   : 幉宍僷儔儊乕僞偺侾幉巜掕(m : 嵟戝惂屼幉悢)
                          ALL_AXES : 幉宍僷儔儊乕僞偺慡幉巜掕(ALL_AXES : -1)

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                僷儔儊乕僞奿擺椞堟偺僒僀僘(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                僷儔儊乕僞斣崋(datano)偺巜掕偑晄揔愗偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(type)偺巜掕偑晄揔愗偱偡丅

                EW_NOOPT        僆僾僔儑儞側偟
                                巜掕偝傟偨僷儔儊乕僞傪巊梡偡傞偨傔偵昁梫側僆僾
                                僔儑儞偑晅壛偝傟偰偄傑偣傫丅

                EW_PROT         彂偒崬傒嬛巭偱偡丅

CNC僆僾僔儑儞   Power Mate偱偼丄摿掕偺僆僾僔儑儞偱巊梡偡傞僷儔儊乕僞偼
                偦偺僆僾僔儑儞偑昁梫側応崌偑偁傝傑偡丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼儅僋儘屇傃弌偟傪峴側偆M僐乕僪傪 No.6080乣No.6089
        偵愝掕偟傑偡丅

#include <stdlib.h>
#include "apilib.h"

/* mcode is 10 M-code values to be set. */
short example( short *mcode )
{
        IODBPSD *param, *ptr ;
        short ret, idx ;
        param = (IODBPSD *)calloc( 1, 100 ) ;
        ptr = param ;
        for ( idx = 0 ; idx < 10 ; idx++ ) {
                ptr->datano = 6080 + idx ;
                ptr->type = 0 ;
                ptr->cdata = mcode[idx] ;
                ptr = (IODBPSD *)(((char *)ptr)+6) ;
        }
        ret = cnc_wrparas( FlibHndl, 6*10, param ) ;
        free( param ) ;
        return ( ret ) ;
}

  (10) 僷儔儊乕僞忣曬偺儕乕僪

娭悢柤  cnc_rdparainfo

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdparainfo(unsigned short FlibHndl,
                short s_number, unsigned short read_no, ODBPARAIF *paraif);

夝愢    s_number, read_no 偱巜掕偝傟偨CNC僷儔儊乕僞忣曬傪撉傒弌偟傑偡丅

        CNC僷儔儊乕僞偺暘晍偼婎杮揑偵旕楢懕偱丄屄暿偺斣崋枅偵宆丄僒僀僘摍懏惈偑
        堎側傝傑偡丅僷儔儊乕僞偺昞帵摍傪峴偆応崌偵巊梡偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        s_number
                奐巒僷儔儊乕僞斣崋傪巜掕偟傑偡丅

        read_no 儕乕僪偡傞僷儔儊乕僞忣曬偺屄悢傪巜掕偟傑偡丅

        paraif  僷儔儊乕僞忣曬傪曉偡ODBPARAIF峔憿懱傊偺億僀儞僞偱偡丅
                ODBPARAIF峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbparaif {
                        unsigned short  info_no ;    /* 僷儔儊乕僞忣曬偺屄悢 */
                        short           prev_no ;    /* 慜偺僷儔儊乕僞斣崋 */
                        short           next_no ;    /* 師偺僷儔儊乕僞斣崋 */
                        struct {
                                short   prm_no ;     /* 僷儔儊乕僞斣崋 */
                                short   prm_type ;   /* 僷儔儊乕僞偺懏惈 */
                        } info[N] ;     /* N : 撉傒弌偡僷儔儊乕僞忣曬偺屄悢 */
                } ODBPARAIF ;

                info_no         僷儔儊乕僞忣曬偺屄悢
                                幚嵺偵撉傒庢偭偨僷儔儊乕僞忣曬偺屄悢

                prev_no         慜偺僷儔儊乕僞斣崋
                                嵟弶偵儕乕僪偟偨僷儔儊乕僞忣曬偺慜偺桳岠斣崋

                next_no         師偺僷儔儊乕僞斣崋
                                嵟屻偵儕乕僪偟偨僷儔儊乕僞忣曬偺屻偺桳岠斣崋

                info[N].prm_no  僷儔儊乕僞斣崋
                                幚嵺偵懚嵼偡傞僷儔儊乕僞斣崋

                info[N].prm_type        僷儔儊乕僞偺懏惈
                                埲壓偺懏惈偑愝掕偝傟傑偡丅
                                bit 0,1 : 宆懏惈
                                                0 : 價僢僩宆    2丗儚乕僪宆
                                                1 : 僶僀僩宆    3丗俀儚乕僪宆
                                bit   2 : 幉懏惈
                                                0 : 幉側偟      1 : 幉偁傝

                                bit   3 : 晞崋
                                                0 : 晞崋偁傝    1 : 晞崋側偟
                                bit   4 : 僙僢僥傿儞僌擖椡壜
                                                0 : 晄壜        1 : 壜
                                bit   5 : 彂偒崬傒嬛巭
                                                0 : 壜          1 : 晄壜
                                bit   6 : 彂偒崬傒屻揹尮抐乛嵞搳擖偑昁梫
                                                0 : 晄梫        1 : 昁梫
                                bit   7 : 儕乕僪晄壜
                                                0 : 壜          1 : 晄壜
                                bit   8 : 僗僺儞僪儖僷儔儊乕僞
                                                0:僗僺儞僪儖埲奜  1:僗僺儞僪儖
                                bit 9 - 15丗乮儕僓乕僽乯

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰壓偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_NUMBER       僨乕僞斣崋偺岆傝
                                奐巒僷儔儊乕僞斣崋(s_number)偺巜掕偑晄揔愗偱偡

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (11) 僙僢僥傿儞僌僨乕僞偺儕乕僪乮斖埻巜掕乯

娭悢柤  cnc_rdsetr

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdsetr(unsigned short FlibHndl,
                                  short *s_number, short axis, short *e_number,
                                                     short *length, void *set);

夝愢    s_number,e_number偱巜掕偝傟偨斖埻偺 axis偱巜掕偝傟偨幉乮幉宆偺僙僢僥傿
        儞僌僨乕僞偺傒乯偺僙僢僥傿儞僌僨乕僞傪撉傒弌偟傑偡丅
        僨乕僞宍幃偼奺僙僢僥傿儞僌僨乕僞偵傛傝傑偡偑丄僶僀僩/儚乕僪/俀儚乕僪宍
        偺僙僢僥傿儞僌僨乕僞偼堦斒偵晞崋晅偺僶僀僫儕宍幃偱偡丅

        axis偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝丄巜掕偝傟偨斖埻偺幉宍僙僢僥傿儞僌
        僨乕僞偼慡幉偺撉傒庢傝偑峴傢傟傑偡丅

        僙僢僥傿儞僌僨乕僞偵偼宆偲幉偺懏惈偵傛傝埲壓偺傛偆側庬椶偑偁傝丄僙僢僥
        傿儞僌僨乕僞斣崋偛偲偵堎側傝傑偡丅

        僙僢僥傿儞僌僨乕僞偺庬椶 栚揑                            僶僀僩僒僀僘
        ------------------------+-------------------------------+------------
        價僢僩宍僨乕僞           1價僢僩偛偲偵堄枴傪帩偮         1
        價僢僩幉宍僨乕僞         1價僢僩偛偲偵堄枴傪帩偮(幉枅)   1
        僶僀僩宍僨乕僞           1僶僀僩挿偺僨乕僞傪婰壇         1
        僶僀僩幉宍僨乕僞         1僶僀僩挿偺僨乕僞傪婰壇(幉枅)   1
        儚乕僪宍僨乕僞           2僶僀僩挿偺僨乕僞傪婰壇         2
        儚乕僪幉宍僨乕僞         2僶僀僩挿偺僨乕僞傪婰壇(幉枅)   2
        俀儚乕僪宍僨乕僞         4僶僀僩挿偺僨乕僞傪婰壇         4
        俀儚乕僪幉宍僨乕僞       4僶僀僩挿偺僨乕僞傪婰壇(幉枅)   4

        偨偩偟丄價僢僩宍僙僢僥傿儞僌僨乕僞傪 1價僢僩扨埵偱撉傒弌偡偙偲偼偱偒傑
        偣傫丅摨堦偺僙僢僥傿儞僌僨乕僞斣崋偵懏偡傞8價僢僩(偮傑傝1僶僀僩)扨埵偱
        堦搙偵撉傒弌偡偙偲偵側傝傑偡丅

        僙僢僥傿儞僌擖椡偑晄壜偺僷儔儊乕僞傪撉傒弌偡偙偲偑偱偒側偄揰傪彍偄偰偼
        亀僷儔儊乕僞偺儕乕僪(斖埻巜掕)(cnc_rdparar)亁偲摨偠偱偡丅

        奺僙僢僥傿儞僌僨乕僞偺徻嵶偵偮偄偰偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔
        偩偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        s_number
                儕乕僪傪奐巒偡傞僙僢僥傿儞僌僨乕僞斣崋傪巜掕偟傑偡丅
                娭悢偐傜偼丄幚嵺偵儕乕僪偝傟偨嵟弶偺僙僢僥傿儞僌僨乕僞斣崋偑曉
                傝傑偡丅

                巜掕壜擻側僙僢僥傿儞僌僨乕僞斣崋偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠
                偟偰偔偩偝偄丅

        e_number

                儕乕僪傪廔椆偡傞僙僢僥傿儞僌僨乕僞斣崋傪巜掕偟傑偡丅
                娭悢偐傜偼丄幚嵺偵儕乕僪偝傟偨嵟屻偺僙僢僥傿儞僌僨乕僞斣崋偑曉
                傝傑偡丅

                側偍丄CNC 懁僜僼僩偺婡擻捛壛側偳偵敽偄丄僙僢僥傿儞僌僨乕僞傕捛
                壛偝傟傞偙偲偑偁傝傑偡丅撉傒弌偡斖埻撪偵僙僢僥傿儞僌僨乕僞偑捛
                壛偝傟偨応崌丄僄儔乕偵側偭偨傝(栠傝抣:EW_LENGTH)丄傾僾儕働乕僔
                儑儞僾儘僌儔儉偺張棟偑惓偟偔幚峴偱偒側偔側傞壜擻惈偑偁傝傑偡丅
                偙偺傛偆側偙偲傪旔偗傞偨傔偵丄僙僢僥傿儞僌僨乕僞斣崋偑楢懕偟偰
                偄傞晹暘偺傒傪傑偲傔偰撉傒弌偟斖埻偵巜掕偡傞傛偆偵偟偰偔偩偝偄丅

        axis    儕乕僪偡傞幉斣崋傪巜掕偟傑偡丅
                    0      : 幉宍偱側偄僙僢僥傿儞僌僨乕僞
                    1乣m   : 幉宍僙僢僥傿儞僌僨乕僞偺侾幉巜掕(m : 嵟戝惂屼幉悢)
                  ALL_AXES : 幉宍僙僢僥傿儞僌僨乕僞偺慡幉巜掕(ALL_AXES : -1)

                側偍丄axis偵壗傪巜掕偟偰傕幉宍偱側偄僙僢僥傿儞僌僨乕僞偼撉傒弌
                偝傟傑偡偑丄巜掕斖埻撪偵幉宍偺僙僢僥傿儞僌僨乕僞偑懚嵼偡傞帪丄
                axis=0傪巜掕偡傞偲僄儔乕偲側傝傑偡(栠傝抣:EW_ATTRIB)丅

        length  巜掕偟偨斖埻偺僙僢僥傿儞僌僨乕僞傪奿擺偡傞偺偵昁梫側僨乕僞僽儘
                僢僋挿傪巜掕偟傑偡丅
                僙僢僥傿儞僌僨乕僞侾屄偁偨傝偼壓恾偺傛偆偵側傝丄偦傟偑僙僢僥傿
                儞僌僨乕僞斣崋弴(徃弴)偵巜掕偝傟偨屄悢暘暲傃傑偡偺偱丄巜掕偡傞
                length偼偦傟傜偺崌寁偵側傝傑偡丅
                  丒[4+(奺僙僢僥傿儞僌僨乕僞偺僶僀僩僒僀僘)*(撉傒偩偡幉悢)]
                        偺崌寁

                娭悢偐傜偼丄幚嵺偵儕乕僪偟偨僒僀僘偑曉傝傑偡偺偱挿傔偵巜掕偡傞
                偙偲偑偱偒傑偡丅

                壓恾偼僙僢僥傿儞僌僨乕僞偺僒僀僘偑 1僶僀僩偺応崌偱偡丅
                僙僢僥傿儞僌僨乕僞偺僒僀僘偑 1僶僀僩偱 1屄偁偨傝偺length偑婏悢
                僶僀僩偵側傞応崌偼丄嵟屻偵僟儈乕椞堟偑昁梫偱偡丅
                僙僢僥傿儞僌僨乕僞偺僒僀僘偑 2,4僶僀僩偺応崌偼丄1屄(1幉)偁偨傝
                偺僒僀僘偑偦傟偧傟 2,4僶僀僩偵側傝傑偡偺偱僟儈乕椞堟偼晄梫偱偡丅

                           幉側偟/堦幉巜掕                    慡幉巜掕
                IODBPSD  0劇劅劅劅劉  劅                0劇劅劅劅劉        劅
                          劆datano劆  仾                 劆datano劆        仾
                         2劌劅劅劅劎  劆                2劌劅劅劅劎        劆
                          劆type  劆length/屄            劆type  劆   length/屄
                         4劌劅劍劅劊  劆                4劌劅劍劅劊        劆
                          劆cdata     劆                 劆cdatas[0]  :1幉 劆
                         5劌劅劎      劆                5劌劅劎            劆
                          劆dummy     伀                 乣  乣            劆
                         6劋劅劊      劅        4+1x(n-1)劌劅劎            劆
                                                         劆cdatas[n-1]:n幉 劆
                                                    4+1xn劌劅劎            劆
                                                         劆dummy(n偑婏悢   伀
                                                         劋劅劊  偺応崌)   劅

                n 偼丄嵟戝惂屼幉悢偱偡丅

        set     僙僢僥傿儞僌僨乕僞傪曉偡椞堟傊偺億僀儞僞偱偡丅

                屄乆偺僙僢僥傿儞僌僨乕僞偺嶲徠偼丄IODBPSD峔憿懱傪巊梡偟傑偡丅
                typedef struct  iodbpsd {
                    short datano;              /* 僙僢僥傿儞僌僨乕僞斣崋 */
                    short type;                /* 忋埵僶僀僩:宆懏惈 */
                                               /* 壓埵僶僀僩:幉斣崋 */
                    union {
                        char cdata;            /* 價僢僩/僶僀僩宍僨乕僞 */
                        short idata;           /* 儚乕僪宍僨乕僞 */
                        long ldata;            /* 俀儚乕僪宍僨乕僞 */
                        char cdatas[MAX_AXIS]; /* 價僢僩/僶僀僩幉宍僨乕僞 */
                        short idatas[MAX_AXIS];/* 儚乕僪幉宍僨乕僞 */
                        long ldatas[MAX_AXIS]; /* 俀儚乕僪幉宍僨乕僞 */
                    } u ;
                } IODBPSD ;             /* MAX_AXIS : 嵟戝惂屼幉悢 */


                datano  儕乕僪偟偨僙僢僥傿儞僌僨乕僞斣崋偑奿擺偝傟傑偡丅

                type    儕乕僪偟偨僙僢僥傿儞僌僨乕僞偺懏惈偑奿擺偝傟傑偡丅
                        忋埵僶僀僩丗宆懏惈
                            0 : 價僢僩宆
                            1 : 僶僀僩宆
                            2 : 儚乕僪宆
                            3 : 俀儚乕僪宆

                        壓埵僶僀僩丗幉斣崋
                            0      : 幉宍偱側偄僙僢僥傿儞僌僨乕僞
                            1乣m   : 幉宍僙僢僥傿儞僌僨乕僞偺侾幉巜掕
                                     (m : 嵟戝惂屼幉悢)
                          ALL_AXES : 幉宍僙僢僥傿儞僌僨乕僞偺慡幉巜掕
                                     (ALL_AXES : -1)

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                僙僢僥傿儞僌僨乕僞奿擺椞堟偺僒僀僘(length)偑晄
                                惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                僙僢僥傿儞僌僨乕僞斣崋(s_number,e_number)偺巜
                                掕偑晄揔愗偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(axis)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (12) 僙僢僥傿儞僌僨乕僞偺儔僀僩乮暋悢屄巜掕乯

娭悢柤  cnc_wrsets

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_wrsets(unsigned short FlibHndl, short length,
                                                                (void *)set);

夝愢    set偵奿擺偝傟偨暋悢屄偺僙僢僥傿儞僌僨乕僞傪彂偒姺偊傑偡丅
        僨乕僞宍幃偼奺僙僢僥傿儞僌僨乕僞偵傛傝傑偡偑丄僶僀僩/儚乕僪/俀儚乕僪宍
        偺僙僢僥傿儞僌僨乕僞偼堦斒偵晞崋晅偺僶僀僫儕宍幃偱偡丅

        type偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝慡幉偺彂偒姺偊傪堦搙偵峴偆偙偲偑偱
        偒傑偡丅偦偺嵺丄奺幉偺僙僢僥傿儞僌僨乕僞偼 IODBPSD撪偺奺攝楍偵奿擺偟傑
        偡丅

        僙僢僥傿儞僌僨乕僞偵偼宆偲幉偺懏惈偵傛傝埲壓偺傛偆側庬椶偑偁傝丄僙僢僥
        傿儞僌僨乕僞斣崋偛偲偵堎側傝傑偡丅

        僙僢僥傿儞僌僨乕僞偺庬椶 栚揑                            僶僀僩僒僀僘
        ------------------------+-------------------------------+------------
        價僢僩宍僨乕僞           1價僢僩偛偲偵堄枴傪帩偮         1
        價僢僩幉宍僨乕僞         1價僢僩偛偲偵堄枴傪帩偮(幉枅)   1
        僶僀僩宍僨乕僞           1僶僀僩挿偺僨乕僞傪婰壇         1
        僶僀僩幉宍僨乕僞         1僶僀僩挿偺僨乕僞傪婰壇(幉枅)   1
        儚乕僪宍僨乕僞           2僶僀僩挿偺僨乕僞傪婰壇         2
        儚乕僪幉宍僨乕僞         2僶僀僩挿偺僨乕僞傪婰壇(幉枅)   2
        俀儚乕僪宍僨乕僞         4僶僀僩挿偺僨乕僞傪婰壇         4
        俀儚乕僪幉宍僨乕僞       4僶僀僩挿偺僨乕僞傪婰壇(幉枅)   4

        偨偩偟丄價僢僩宍僙僢僥傿儞僌僨乕僞傪 1價僢僩扨埵偱彂偒姺偊傞偙偲偼偱偒
        傑偣傫丅摨堦偺僙僢僥傿儞僌僨乕僞斣崋偵懏偡傞8價僢僩(偮傑傝1僶僀僩)傪傑
        偲傔偰撉傒偩偟丄栚揑偺價僢僩傪曄峏偟偰偐傜 8價僢僩扨埵偱彂偒姺偊傞偙偲
        偵側傝傑偡丅

        僙僢僥傿儞僌擖椡偑晄壜偺僷儔儊乕僞傪彂偒姺偊傞偙偲偑偱偒側偄揰傪彍偄偰
        偼亀僷儔儊乕僞偺儔僀僩(暋悢屄巜掕)(cnc_wrparas)亁偲摨偠偱偡丅

        奺僙僢僥傿儞僌僨乕僞偺徻嵶偵偮偄偰偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔
        偩偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        length  彂偒姺偊傞僙僢僥傿儞僌僨乕僞傪奿擺偟偨椞堟偺僨乕僞僽儘僢僋挿傪
                巜掕偟傑偡丅
                僙僢僥傿儞僌僨乕僞侾屄偁偨傝偼壓恾偺偲偍傝偱丄偦傟偑僙僢僥傿儞
                僌僨乕僞斣崋弴(徃弴)偵暲傫偩峔憿偱偡偺偱丄巜掕偡傞length偼偦傟
                傜偺崌寁偵側傝傑偡丅
                  丒[4+(奺僙僢僥傿儞僌僨乕僞偺僶僀僩僒僀僘)*(彂偒姺偊傞幉悢)]
                        偺崌寁


                壓恾偼僙僢僥傿儞僌僨乕僞偺僒僀僘偑 1僶僀僩偺応崌偱偡丅
                僙僢僥傿儞僌僨乕僞偺僒僀僘偑 1僶僀僩偱 1屄偁偨傝偺length偑婏悢
                僶僀僩偵側傞応崌偼丄嵟屻偵僟儈乕椞堟偑昁梫偱偡丅
                僙僢僥傿儞僌僨乕僞偺僒僀僘偑 2,4僶僀僩偺応崌偼丄1屄(1幉)偁偨傝
                偺僒僀僘偑偦傟偧傟 2,4僶僀僩偵側傝傑偡偺偱僟儈乕椞堟偼晄梫偱偡丅

                           幉側偟/堦幉巜掕                    慡幉巜掕
                IODBPSD  0劇劅劅劅劉  劅                0劇劅劅劅劉        劅
                          劆datano劆  仾                 劆datano劆        仾
                         2劌劅劅劅劎  劆                2劌劅劅劅劎        劆
                          劆type  劆length/屄            劆type  劆   length/屄
                         4劌劅劍劅劊  劆                4劌劅劍劅劊        劆
                          劆cdata     劆                 劆cdatas[0]  :1幉 劆
                         5劌劅劎      劆                5劌劅劎            劆
                          劆dummy     伀                 乣  乣            劆
                         6劋劅劊      劅        4+1x(n-1)劌劅劎            劆
                                                         劆cdatas[n-1]:n幉 劆
                                                    4+1xn劌劅劎            劆
                                                         劆dummy(n偑婏悢   伀
                                                         劋劅劊  偺応崌)   劅

                n 偼丄嵟戝惂屼幉悢偱偡丅

        set     彂偒姺偊傞僙僢僥傿儞僌僨乕僞傪奿擺偡傞椞堟傊偺億僀儞僞偱偡丅
                屄乆偺僙僢僥傿儞僌僨乕僞偺嶲徠偼丄IODBPSD峔憿懱傪巊梡偟傑偡丅
                typedef struct  iodbpsd {
                    short datano;              /* 僙僢僥傿儞僌僨乕僞斣崋 */
                    short type;                /* 忋埵僶僀僩:宆懏惈 */
                                               /* 壓埵僶僀僩:幉斣崋 */
                    union {
                        char cdata;            /* 價僢僩/僶僀僩宍僨乕僞 */
                        short idata;           /* 儚乕僪宍僨乕僞 */
                        long ldata;            /* 俀儚乕僪宍僨乕僞 */
                        char cdatas[MAX_AXIS]; /* 價僢僩/僶僀僩幉宍僨乕僞 */
                        short idatas[MAX_AXIS];/* 儚乕僪幉宍僨乕僞 */
                        long ldatas[MAX_AXIS]; /* 俀儚乕僪幉宍僨乕僞 */
                    } u ;
                } IODBPSD ;             /* MAX_AXIS : 嵟戝惂屼幉悢 */

                datano  儔僀僩偡傞僙僢僥傿儞僌僨乕僞斣崋傪巜掕偟傑偡丅
                        巜掕壜擻側僙僢僥傿儞僌僨乕僞斣崋偼 CNC偺僷儔儊乕僞愢柧
                        彂傪嶲徠偟偰偔偩偝偄丅

                type    儔僀僩偡傞僙僢僥傿儞僌僨乕僞偺懏惈傪巜掕偟傑偡丅
                        忋埵僶僀僩丗宆懏惈
                            0 : 價僢僩宆
                            1 : 僶僀僩宆
                            2 : 儚乕僪宆
                            3 : 俀儚乕僪宆

                        壓埵僶僀僩丗幉斣崋
                            0      : 幉宍偱側偄僙僢僥傿儞僌僨乕僞
                            1乣m   : 幉宍僙僢僥傿儞僌僨乕僞偺侾幉巜掕
                                     (m : 嵟戝惂屼幉悢)
                          ALL_AXES : 幉宍僙僢僥傿儞僌僨乕僞偺慡幉巜掕

                                     (ALL_AXES : -1)

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                僙僢僥傿儞僌僨乕僞奿擺椞堟偺僒僀僘(length)偑晄
                                惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                僙僢僥傿儞僌僨乕僞斣崋(datano)偺巜掕偑晄揔愗偱
                                偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(type)偺巜掕偑晄揔愗偱偡丅

                EW_NOOPT        僆僾僔儑儞側偟
                                巜掕偝傟偨僙僢僥傿儞僌僨乕僞傪巊梡偡傞偨傔偵昁
                                梫側僆僾僔儑儞偑晅壛偝傟偰偄傑偣傫丅

CNC僆僾僔儑儞   摿掕偺僆僾僔儑儞偱巊梡偡傞僙僢僥傿儞僌僨乕僞偼偦偺僆僾僔儑儞偑
                昁梫側応崌偑偁傝傑偡丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (13) 僇僗僞儉儅僋儘曄悢偺儕乕僪

娭悢柤  cnc_rdmacro

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdmacro(unsigned short FlibHndl,
                                short number, short length, ODBM *macro);

夝愢    number偱巜掕偝傟偨斣崋偺僇僗僞儉儅僋儘曄悢傪撉傒弌偟傑偡丅
        僨乕僞偼晞崋晅偺僶僀僫儕宍幃偱ODBM撪偵奿擺偝傟傑偡丅

        撉傒弌偟壜擻側僇僗僞儉儅僋儘曄悢偺庬椶偼埲壓偺偲偍傝偱偡丅

        (1) 儘乕僇儖曄悢 ( #1乣#33 )
            撉傒弌偡帪揰偱幚峴偝傟偰偄傞僇僗僞儉儅僋儘偺儘乕僇儖曄悢偑撉傒弌偝
            傟傑偡丅

        (2) 僐儌儞曄悢 ( #100乣 )
            撉傒弌偟斖埻偼 cnc_rdmacroinfo()娭悢偺愢柧傪嶲徠偟偰偔偩偝偄丅

        cnc_setmactype() 娭悢傛傝丄撉傒弌偡僇僗僞儉儅僋儘曄悢偺宆傪愗傝姺偊傞
        偙偲偑偱偒傑偡丅

                丒10恑宍幃晜摦彫悢揰宆乮僨乕僞宍幃=M*10**(-E)乯
                        mcr_val : 曄悢抣(=M)
                                  晞崋晅偺4僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:    -99999999 乣 99999999)
                        dec_val : 彫悢揰埲壓寘悢(=E)
                                  晞崋晅偺2僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:    -1, 0 乣 8)

                        仸Power Mate偱偼丄忋婰惂尷傪墇偊傞僨乕僞偼埖偊傑偣傫
                         (mcr_val, dec_val偲傕 -1 偵側傝傑偡)偺偱2恑宍幃晜摦
                        彫悢揰宆傪巊梡偟偰偔偩偝偄丅

                丒2恑宍幃晜摦彫悢揰宆乮僨乕僞宍幃=M*2**(-E)乯
                        mcr_val : 曄悢偺壖悢晹(=M)
                                  晞崋晅偺4僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:惂尷側偟)
                        dec_val : 曄悢偺巜悢晹(=E)
                                  晞崋晅偺2僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:-128 乣 127)

        側偍丄僇僗僞儉儅僋儘曄悢偵偼亀嬻亁偲偄偆摿庩側抣偑偁傝傑偡偑丄10恑宍幃
        乛2恑宍幃晜摦彫悢揰宆偲傕偵埲壓偱昞偟傑偡丅
                        mcr_val = 0
                        dec_val = -1

        僇僗僞儉儅僋儘曄悢偺徻嵶偵偮偄偰偼丄CNC偺庢埖愢柧彂傪嶲徠偟偰偔偩偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅


        number  儕乕僪偡傞僇僗僞儉儅僋儘曄悢斣崋傪巜掕偟傑偡丅

        length  僨乕僞僽儘僢僋挿乮ODBM峔憿懱偺僒僀僘=10乯傪巜掕偟傑偡丅

                ODBM     0劇劅劅劅劅劅劉              劅
                          劆datano    劆              仾
                         2劌劅劅劅劅劅劎              劆
                          劆dummy     劆              劆
                         4劌劅劅劅劅劅劏劅劅劅劅劅劉length
                          劆mcr_val               劆  劆
                         8劌劅劅劅劅劅劍劅劅劅劅劅劊  劆
                          劆dec_val   劆              伀
                        10劋劅劅劅劅劅劊              劅

        macro   僇僗僞儉儅僋儘曄悢傪曉偡ODBM峔憿懱傊偺億僀儞僞偱偡丅
                ODBM峔憿懱偼師偺捠傝偱偡丅
                typedef struct  odbm {
                        short   datano ;        /* 僇僗僞儉儅僋儘曄悢斣崋 */
                        short   dummy ;         /* 枹巊梡 */
                        long    mcr_val ;       /* 僇僗僞儉儅僋儘曄悢抣 */
                        short   dec_val ;       /* 彫悢揰埲壓寘悢 */
                } ODBM ;

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBM峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                僇僗僞儉儅僋儘曄悢斣崋(number)偺巜掕偑晄揔愗偱
                                偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼巜掕偝傟偨斣崋偺僇僗僞儉儅僋儘曄悢傪撉傒弌偟偰昞帵偟
        傑偡丅

#include <stdio.h>
#include <string.h>
#include "apilib.h"

/* number is variable number to be read. */
short example( short number )
{
        ODBM macro ;
        char strbuf[11] ;

        short ret ;
        ret = cnc_rdmacro( FlibHndl, number, 10, &macro ) ;
        if ( !ret ) {
                sprintf( &strbuf[1], "%09ld", macro.mcr_val ) ;
                if ( strbuf[1] == '0' ) strbuf[1] = ' ' ;
                strncpy( &strbuf[0], &strbuf[1], 9 - macro.dec_val ) ;
                strbuf[9-macro.dec_val] = '.' ;
                printf( "%s\n", strbuf ) ;
        }
        else
                printf( "**********\n" ) ;
        return ( ret ) ;
}

  (14) 僇僗僞儉儅僋儘曄悢偺儔僀僩

娭悢柤  cnc_wrmacro

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_wrmacro(unsigned short FlibHndl,
                short number, short length, long mcr_val, short dec_val);

夝愢    number偱巜掕偝傟偨斣崋偺僇僗僞儉儅僋儘曄悢傪彂偒姺偊傑偡丅
        僨乕僞偼晞崋晅偺僶僀僫儕宍幃偱mcr_val,dec_val偵奿擺偟傑偡丅

        彂偒姺偊壜擻側僇僗僞儉儅僋儘曄悢偺庬椶偼埲壓偺偲偍傝偱偡丅
        儘乕僇儖曄悢偼彂偒姺偊偱偒傑偣傫丅

        (1) 僐儌儞曄悢 ( #100乣 )
            彂偒姺偊斖埻偼 cnc_rdmacroinfo()娭悢偺愢柧傪嶲徠偟偰偔偩偝偄丅

        cnc_setmactype() 娭悢傛傝丄彂偒姺偊傞僇僗僞儉儅僋儘曄悢偺宆傪愗傝姺偊傞
        傞偙偲偑偱偒傑偡丅

                丒10恑宍幃晜摦彫悢揰宆乮僨乕僞宍幃=M*10**(-E)乯
                        mcr_val : 曄悢抣(=M)
                                  晞崋晅偺4僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:    -99999999 乣 99999999)

                        dec_val : 彫悢揰埲壓寘悢(=E)
                                  晞崋晅偺2僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:    -1, 0 乣 8)

                        仸Power Mate偱偼丄忋婰惂尷傪墇偊傞僨乕僞偼埖偊傑偣傫
                        乮栠傝抣:EW_DATA偵側傝傑偡乯偺偱2恑宍幃晜摦彫悢揰宆傪
                        巊梡偟偰偔偩偝偄丅

                丒2恑宍幃晜摦彫悢揰宆乮僨乕僞宍幃=M*2**(-E)乯
                        mcr_val : 曄悢偺壖悢晹(=M)
                                  晞崋晅偺4僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:惂尷側偟)

                        dec_val : 曄悢偺巜悢晹(=E)
                                  晞崋晅偺2僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:-128 乣 127)

        側偍丄僇僗僞儉儅僋儘曄悢偵偼亀嬻亁偲偄偆摿庩側抣偑偁傝傑偡偑丄10恑宍幃
        乛2恑宍幃晜摦彫悢揰宆偲傕偵埲壓偱昞偟傑偡丅

                        mcr_val = 0
                        dec_val = -1

        僇僗僞儉儅僋儘曄悢偺徻嵶偵偮偄偰偼丄CNC偺庢埖愢柧彂傪嶲徠偟偰偔偩偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅


        number  儔僀僩偡傞僇僗僞儉儅僋儘曄悢斣崋傪巜掕偟傑偡丅

        length  僨乕僞僽儘僢僋挿乮=10乯傪巜掕偟傑偡丅

        mcr_val 僇僗僞儉儅僋儘曄悢偺曄悢抣乛壖悢晹傪巜掕偟傑偡丅

        dec_val 僇僗僞儉儅僋儘曄悢偺彫悢揰埲壓寘悢乛巜悢晹傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                僒僀僘(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                僇僗僞儉儅僋儘曄悢斣崋(number)偺巜掕偑晄揔愗偱
                                偡丅

                EW_DATA         僨乕僞偺岆傝
                                僇僗僞儉儅僋儘曄悢抣偑桳岠斖埻傪墇偊偰偄傑偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼巜掕偝傟偨斣崋偺僇僗僞儉儅僋儘曄悢偵巜掕抣傪彂偒崬傒
        傑偡丅

#include "apilib.h"

/* number is variable number to be written. */
/* value is value to be written. */
/* dec is decimal digit number. */
short example( short number, long value, short dec )
{
        short ret ;
        ret = cnc_wrmacro( FlibHndl, number, 10, value, dec ) ;
        return ( ret ) ;
}

  (15) 僇僗僞儉儅僋儘曄悢偺儕乕僪乮斖埻巜掕乯

娭悢柤  cnc_rdmacror

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdmacror(unsigned short FlibHndl,
                short s_number, short e_number, short length, IODBMR *macror);

夝愢    s_number,e_number偱巜掕偝傟偨斖埻偺僇僗僞儉儅僋儘曄悢傪撉傒弌偟傑偡丅
        僨乕僞偼晞崋晅偺僶僀僫儕宍幃偱IODBMR撪偵奿擺偝傟傑偡丅

        撉傒弌偟壜擻側僇僗僞儉儅僋儘曄悢偺庬椶偼埲壓偺偲偍傝偱偡丅
        (1) 儘乕僇儖曄悢 ( #1乣#33 )
            撉傒弌偡帪揰偱幚峴偝傟偰偄傞僇僗僞儉儅僋儘偺儘乕僇儖曄悢偑撉傒弌偝
            傟傑偡丅

        (2) 僐儌儞曄悢 ( #100乣 )
            撉傒弌偟斖埻偼 cnc_rdmacroinfo()娭悢偺愢柧傪嶲徠偟偰偔偩偝偄丅

        cnc_setmactype() 娭悢傛傝丄撉傒弌偡僇僗僞儉儅僋儘曄悢偺宆傪愗傝姺偊傞
        偙偲偑偱偒傑偡丅

                丒10恑宍幃晜摦彫悢揰宆乮僨乕僞宍幃=M*10**(-E)乯
                        mcr_val : 曄悢抣(=M)
                                  晞崋晅偺4僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:    -99999999 乣 99999999)

                        dec_val : 彫悢揰埲壓寘悢(=E)
                                  晞崋晅偺2僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:    -1, 0 乣 8)

                        仸Power Mate偱偼丄忋婰惂尷傪墇偊傞僨乕僞偼埖偊傑偣傫
                        (mcr_val, dec_val偲傕 -1 偵側傝傑偡)偺偱2恑宍幃晜摦彫
                        悢揰宆傪巊梡偟偰偔偩偝偄丅

                丒2恑宍幃晜摦彫悢揰宆乮僨乕僞宍幃=M*2**(-E)乯
                        mcr_val : 曄悢偺壖悢晹(=M)
                                  晞崋晅偺4僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:惂尷側偟)
                        dec_val : 曄悢偺巜悢晹(=E)
                                  晞崋晅偺2僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:-128 乣 127)

        側偍丄僇僗僞儉儅僋儘曄悢偵偼亀嬻亁偲偄偆摿庩側抣偑偁傝傑偡偑丄10恑宍幃
        乛2恑宍幃晜摦彫悢揰宆偲傕偵埲壓偱昞偟傑偡丅
                        mcr_val = 0
                        dec_val = -1

        僇僗僞儉儅僋儘曄悢偺徻嵶偵偮偄偰偼丄CNC偺庢埖愢柧彂傪嶲徠偟偰偔偩偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅


        s_number
                儕乕僪傪奐巒偡傞僇僗僞儉儅僋儘曄悢斣崋傪巜掕偟傑偡丅

        e_number
                儕乕僪傪廔椆偡傞僇僗僞儉儅僋儘曄悢斣崋傪巜掕偟傑偡丅

        length  僨乕僞僽儘僢僋挿乮IODBMR峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅
                  丒6+6*(撉傒弌偡僇僗僞儉儅僋儘曄悢偺屄悢)

                IODBMR   0劇劅劅劅劅劅劉              劅
                          劆datano_s  劆              仾
                         2劌劅劅劅劅劅劎              劆
                          劆dummy     劆              劆
                         4劌劅劅劅劅劅劎              劆
                          劆datano_e  劆              劆
                         6劌劅劅劅劅劅劏劅劅劅劅劅劉  劆
                          劆data[0].mcr_val       劆length
                        10劌劅劅劅劅劅劍劅劅劅劅劅劊  劆
                          劆data[0].dec_val           劆
                        12劌劅劅劅劅劅劏劅劅劅劅劅劉  劆
                          乣          乣              劆
                 6+6*(N-1)劌劅劅劅劅劅劏劅劅劅劅劅劉  劆
                          劆data[N-1].mcr_val     劆  劆
                          劌劅劅劅劅劅劍劅劅劅劅劅劊  劆
                          劆data[N-1].dec_val         伀
                     6+6*N劋劅劅劅劅劅劊              劅

                N 偼撉傒弌偡僇僗僞儉儅僋儘曄悢偺屄悢偱偡丅

        macror  僇僗僞儉儅僋儘曄悢傪曉偡IODBMR峔憿懱傊偺億僀儞僞偱偡丅
                IODBMR峔憿懱偼師偺捠傝偱偡丅
                typedef struct  iodbmr {
                        short datano_s ; /* 儕乕僪奐巒僇僗僞儉儅僋儘曄悢斣崋 */
                        short dummy ;    /* 枹巊梡 */
                        short datano_e ; /* 儕乕僪廔椆僇僗僞儉儅僋儘曄悢斣崋 */
                        struct {
                                long  mcr_val ; /* 僇僗僞儉儅僋儘曄悢抣 */
                                short dec_val ; /* 彫悢揰埲壓寘悢 */
                        } data[N] ;             /* N 偼撉傒偩偡曄悢偺屄悢 */
                } IODBMR ;

                datano_s
                        幚嵺偵儕乕僪偝傟偨嵟弶偺僇僗僞儉儅僋儘曄悢斣崋偑奿擺偝
                        傟傑偡丅

                datano_e
                        幚嵺偵儕乕僪偝傟偨嵟屻偺僇僗僞儉儅僋儘曄悢斣崋偑奿擺偝
                        傟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅

                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                IODBMR峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                僇僗僞儉儅僋儘曄悢斣崋(s_number,e_number)偺巜
                                掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼巜掕偝傟偨斖埻偺僇僗僞儉儅僋儘曄悢傪撉傒弌偟偰昞帵偟
        傑偡丅

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "apilib.h"

/* start/end are start/end variable number to be read. */
short example( short start, short end )
{
        IODBMR *macror ;
        char strbuf[11] ;
        short ret, idx ;
        macror = (IODBMR *)malloc( 1000 ) ;
        ret = cnc_rdmacror( FlibHndl, start, end, 1000, macror ) ;
        if ( !ret )
                for ( idx = 0 ; idx <= end-start ; idx++ ) {
                        sprintf( &strbuf[1], "%09ld",
                                        macror->data[idx].mcr_val ) ;
                        if ( strbuf[1] == '0' ) strbuf[1] = ' ' ;
                        strncpy( &strbuf[0], &strbuf[1],
                                        9 - macror->data[idx].dec_val ) ;
                        strbuf[9-macror->data[idx].dec_val] = '.' ;
                        printf( "#%04d  %s\n", start+idx, strbuf ) ;
                }
        else
                printf( "ERROR!(%d)\n", ret ) ;
        free( macror ) ;
        return ( ret ) ;
}

  (16) 僇僗僞儉儅僋儘曄悢偺儔僀僩乮斖埻巜掕乯

娭悢柤  cnc_wrmacror

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_wrmacror(unsigned short FlibHndl,
                                                short length, IODBMR *macror);

夝愢    datano_s,datano_e偱巜掕偝傟偨斖埻偺僇僗僞儉儅僋儘曄悢傪彂偒姺偊傑偡丅
        僨乕僞偼晞崋晅偺僶僀僫儕宍幃偱IODBMR撪偵奿擺偟傑偡丅

        彂偒姺偊壜擻側僇僗僞儉儅僋儘曄悢偺庬椶偼埲壓偺偲偍傝偱偡丅
        儘乕僇儖曄悢偼彂偒姺偊偱偒傑偣傫丅

        (1) 僐儌儞曄悢 ( #100乣 )
            彂偒姺偊斖埻偼 cnc_rdmacroinfo()娭悢偺愢柧傪嶲徠偟偰偔偩偝偄丅

        cnc_setmactype() 娭悢傛傝丄彂偒姺偊傞僇僗僞儉儅僋儘曄悢偺宆傪愗傝姺偊傞
        傞偙偲偑偱偒傑偡丅

                丒10恑宍幃晜摦彫悢揰宆乮僨乕僞宍幃=M*10**(-E)乯
                        mcr_val : 曄悢抣(=M)
                                  晞崋晅偺4僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:    -99999999 乣 99999999)

                        dec_val : 彫悢揰埲壓寘悢(=E)
                                  晞崋晅偺2僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:    -1, 0 乣 8)

                        仸Power Mate偱偼丄忋婰惂尷傪墇偊傞僨乕僞偼埖偊傑偣傫
                        乮栠傝抣:EW_DATA偵側傝傑偡乯偺偱2恑宍幃晜摦彫悢揰宆傪
                        巊梡偟偰偔偩偝偄丅

                丒2恑宍幃晜摦彫悢揰宆乮僨乕僞宍幃=M*2**(-E)乯
                        mcr_val : 曄悢偺壖悢晹(=M)
                                  晞崋晅偺4僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:惂尷側偟)

                        dec_val : 曄悢偺巜悢晹(=E)
                                  晞崋晅偺2僶僀僩僶僀僫儕宍幃
                                  (桳岠斖埻:-128 乣 127)

        側偍丄僇僗僞儉儅僋儘曄悢偵偼亀嬻亁偲偄偆摿庩側抣偑偁傝傑偡偑丄10恑宍幃
        乛2恑宍幃晜摦彫悢揰宆偲傕偵埲壓偱昞偟傑偡丅

                        mcr_val = 0
                        dec_val = -1

        僇僗僞儉儅僋儘曄悢偺徻嵶偵偮偄偰偼丄CNC偺庢埖愢柧彂傪嶲徠偟偰偔偩偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅


        length  僨乕僞僽儘僢僋挿乮IODBMR峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅
                  丒6+6*(彂偒姺偊傞僇僗僞儉儅僋儘曄悢偺屄悢)

                IODBMR   0劇劅劅劅劅劅劉              劅
                          劆datano_s  劆              仾
                         2劌劅劅劅劅劅劎              劆
                          劆dummy     劆              劆
                         4劌劅劅劅劅劅劎              劆
                          劆datano_e  劆              劆
                         6劌劅劅劅劅劅劏劅劅劅劅劅劉  劆
                          劆data[0].mcr_val       劆length
                        10劌劅劅劅劅劅劍劅劅劅劅劅劊  劆
                          劆data[0].dec_val           劆
                        12劌劅劅劅劅劅劏劅劅劅劅劅劉  劆
                          乣          乣              劆
                 6+6*(N-1)劌劅劅劅劅劅劏劅劅劅劅劅劉  劆
                          劆data[N-1].mcr_val     劆  劆
                          劌劅劅劅劅劅劍劅劅劅劅劅劊  劆
                          劆data[N-1].dec_val         伀
                     6+6*N劋劅劅劅劅劅劊              劅

                N 偼彂偒姺偊傞僇僗僞儉儅僋儘曄悢偺屄悢偱偡丅

        macror  僇僗僞儉儅僋儘曄悢傪奿擺偡傞IODBMR峔憿懱傊偺億僀儞僞偱偡丅
                IODBMR峔憿懱偼師偺捠傝偱偡丅
                typedef struct  iodbmr {
                        short datano_s ; /* 儔僀僩奐巒僇僗僞儉儅僋儘曄悢斣崋 */
                        short dummy ;    /* 枹巊梡 */
                        short datano_e ; /* 儔僀僩廔椆僇僗僞儉儅僋儘曄悢斣崋 */
                        struct {
                                long  mcr_val ; /* 僇僗僞儉儅僋儘曄悢抣 */
                                short dec_val ; /* 彫悢揰埲壓寘悢 */
                        } data[N] ;             /* N 偼彂偒姺偊傞曄悢偺屄悢 */
                } IODBMR ;

                datano_s
                        儔僀僩傪奐巒偡傞僇僗僞儉儅僋儘曄悢斣崋傪巜掕偟傑偡丅

                datano_e
                        儔僀僩傪廔椆偡傞僇僗僞儉儅僋儘曄悢斣崋傪巜掕偟傑偡丅

                mcr_val 僇僗僞儉儅僋儘曄悢偺曄悢抣乛壖悢晹傪巜掕偟傑偡丅

                dec_val 僇僗僞儉儅僋儘曄悢偺彫悢揰埲壓寘悢乛巜悢晹傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                IODBMR峔憿懱偺僒僀僘(length)偑晄惓偱偡丅


                EW_NUMBER       僨乕僞斣崋偺岆傝
                                僇僗僞儉儅僋儘曄悢斣崋(datano_s,datano_e)偺巜
                                掕偑晄揔愗偱偡丅

                EW_DATA         僨乕僞偺岆傝
                                僇僗僞儉儅僋儘曄悢抣偑桳岠斖埻傪墇偊偰偄傑偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼巜掕偝傟偨斖埻偺僇僗僞儉儅僋儘曄悢傪彂偒姺偊傑偡丅

#include <stdlib.h>
#include "apilib.h"

/* start is start variable number to be written. */
/* value is array of value to be written. */
/* number is number of variable. */
short example( short start, long *value, short number )
{
        IODBMR *macror ;
        short ret, idx ;
        macror = (IODBMR *)malloc( 6+6*number ) ;
        macror->datano_s = start ;
        macror->datano_e = start + number - 1 ;
        for ( idx = 0 ; idx < number ; idx++ ) {
                macror->data[idx].mcr_val = value[idx] ;
                macror->data[idx].dec_val = 0 ;
        }
        ret = cnc_wrmacror( FlibHndl, 6+6*number, macror ) ;
        free( macror ) ;
        return ( ret ) ;
}

  (17) 僇僗僞儉儅僋儘曄悢忣曬偺儕乕僪

娭悢柤  cnc_rdmacroinfo

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdmacroinfo(unsigned short FlibHndl,
                                                        ODBMVINF *mvinf);

夝愢    僇僗僞儉儅僋儘偺儘乕僇儖曄悢丄偍傛傃僐儌儞曄悢偺巊梡壜擻側屄悢傪撉傒弌
        偟傑偡丅ODBMVINF撪偺use_no1, use_no2偵僶僀僫儕宍幃偱奿擺偝傟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        mvinf   僇僗僞儉儅僋儘曄悢忣曬傪曉偡ODBMVINF峔憿懱傊偺億僀儞僞偱偡丅
                ODBMVINF峔憿懱偼師偺捠傝偱偡丅
                typedef struct  odbmvinf {
                        short   use_no1 ;       /* 儘乕僇儖曄悢偺屄悢 */
                        short   use_no2 ;       /* 僐儌儞曄悢偺斖埻 */
                } ODBMVINF ;

                use_no1 巊梡壜擻側儘乕僇儖曄悢偺屄悢偑奿擺偝傟傑偡丅
                        33屄屌掕偱偡丅

                use_no2 巊梡壜擻側僐儌儞曄悢偺斖埻傪帵偡抣偑奿擺偝傟傑偡丅

                                        0 : 100乣149, 500乣531
                                        1 : 100乣199, 500乣999
                                        2 : 100乣199, 500乣699


栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (18) 僇僗僞儉儅僋儘曄悢僞僀僾偺庢摼

娭悢柤  cnc_getmactype

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_getmactype(unsigned short FlibHndl,
                                                            short *macro_type);

夝愢    cnc_rdmacro, cnc_wrmacro, cnc_rdmacror, cnc_wrmacror娭悢偱巊梡偡傞僇僗
        僞儉儅僋儘曄悢偺僞僀僾傪庢摼偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        macro_type
                僇僗僞儉儅僋儘曄悢偺僞僀僾
                        侽    丗10恑宍幃晜摦彫悢揰宆乮弶婜忬懺乯
                        侽埲奜丗2恑宍幃晜摦彫悢揰宆

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮僄儔乕偺徻嵶偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (19) 僇僗僞儉儅僋儘曄悢僞僀僾偺愝掕

娭悢柤  cnc_setmactype

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_setmactype(unsigned short FlibHndl,
                                                        short macro_type);

夝愢    cnc_rdmacro, cnc_wrmacro, cnc_rdmacror, cnc_wrmacror娭悢偱巊梡偡傞僇僗
        僞儉儅僋儘曄悢偺僞僀僾傪愗傝姺偊傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        macro_type
                僇僗僞儉儅僋儘曄悢偺僞僀僾
                        侽    丗10恑宍幃晜摦彫悢揰宆乮弶婜忬懺乯
                        侽埲奜丗2恑宍幃晜摦彫悢揰宆

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮僄儔乕偺徻嵶偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

憖嶌棜楌僨乕僞娭學
-------------------------------------------------------------------------------
  娭悢柤                婡  擻  撪  梕
-------------------------------------------------------------------------------
  ( 1) cnc_stopophis    棜楌僨乕僞偺僒儞僾儕儞僌偺掆巭
  ( 2) cnc_startophis   棜楌僨乕僞偺僒儞僾儕儞僌偺嵞奐
  ( 3) cnc_rdophisno    憖嶌棜楌僨乕僞悢偺儕乕僪
  ( 4) cnc_rdophistry   憖嶌棜楌僨乕僞偺儕乕僪
  ( 5) cnc_rdalmhisno   傾儔乕儉棜楌僨乕僞悢偺儕乕僪
  ( 6) cnc_rdalmhistry  傾儔乕儉棜楌僨乕僞偺儕乕僪
  ( 7) cnc_clearophis   憖嶌棜楌僨乕僞偺僋儕傾
  ( 8) cnc_rdhissgnl    憖嶌棜楌懳徾怣崋偺儕乕僪
  ( 9) cnc_wrhissgnl    憖嶌棜楌懳徾怣崋偺愝掕
-------------------------------------------------------------------------------

  ( 1) 棜楌僨乕僞偺僒儞僾儕儞僌偺掆巭

娭悢柤  cnc_stopophis

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_stopophis(unsigned short FlibHndl);

夝愢    憖嶌棜楌僨乕僞偲傾儔乕儉棜楌僨乕僞偺僒儞僾儕儞僌偺掆巭傪俶俠偵巜帵偟傑
        偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 2) 棜楌僨乕僞偺僒儞僾儕儞僌偺嵞奐

娭悢柤  cnc_startophis

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_startophis(unsigned short FlibHndl);

夝愢    憖嶌棜楌僨乕僞偲傾儔乕儉棜楌僨乕僞偺僒儞僾儕儞僌偺嵞奐傪CNC偵巜帵偟傑偡

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 3) 憖嶌棜楌僨乕僞悢偺儕乕僪

娭悢柤  cnc_rdophisno

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdophisno(unsigned short FlibHndl,
                                                        unsigned short *hisno);

夝愢    憖嶌棜楌僨乕僞悢偺儕乕僪傪峴偄傑偡丅

        偙偺娭悢傪巊梡偡傞慜偵丄棜楌僨乕僞偺僒儞僾儕儞僌偺掆巭(cnc_stopophis)
        傪峴偆昁梫偑偁傝傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        hisno   憖嶌棜楌僨乕僞悢傪奿擺偡傞曄悢偺傾僪儗僗傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_FUNC         娭悢枹幚峴
                                棜楌僨乕僞偺僒儞僾儕儞僌偺掆巭(cnc_stopophis)
                                偑峴傢傟偰偄傑偣傫丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 4) 憖嶌棜楌僨乕僞偺儕乕僪

娭悢柤  cnc_rdophistry

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdophistry(unsigned short FlibHndl,
                                unsigned short s_no, unsigned short e_no,
                                        unsigned short length, ODBHIS *his);

夝愢    憖嶌棜楌僨乕僞偺儕乕僪傪峴偄傑偡丅

        儗僐乕僪偺庬椶(rec_type)偵傛傝丄憖嶌棜楌僨乕僞偺峔憿偑堘偄傑偡偺偱丄僨
        乕僞偵傾僋僙僗偡傞応崌偼庬椶偵墳偠偨峔憿懱傪巊梡偟偰壓偝偄丅

        憖嶌棜楌僨乕僞暲傃偵傾儔乕儉棜楌僨乕僞偼CNC懁偱帺摦揑偵婰榐偝傟偰偄傑偡
        偙傟傜偺僨乕僞偵傾僋僙僗偡傞偨傔偵偼CNC懁偺僒儞僾儕儞僌傪堦帪揑偵掆巭偝
        偣傞昁梫偑偁傝傑偡丅偙偺偨傔丄杮娭悢傪巊梡偡傞慜偵丄亀棜楌僨乕僞偺僒儞
        僾儕儞僌偺掆巭亁(cnc_stopophis)傪幚峴偡傞昁梫偑偁傝傑偡丅

        傑偨丄儕乕僪偑嵪傒師戞丄棜楌僨乕僞偺僒儞僾儕儞僌掆巭帪娫傪嵟彫尷偵偡傞
        偨傔偵亀棜楌僨乕僞偺僒儞僾儕儞僌偺嵞奐亁(cnc_startophis)傪幚峴偟偰偔偩
        偝偄丅

        奐巒乛廔椆偺儗僐乕僪斣崋偲偼丄儕乕僪偡傞憖嶌棜楌僨乕僞偺儗僐乕僪枅偵偮
        偗偨斣崋偺偙偲偱偡丅偙偺儗僐乕僪斣崋偼亀棜楌僨乕僞偺僒儞僾儕儞僌偺掆巭
        亁傪幚峴偟偰偐傜亀棜楌僨乕僞偺僒儞僾儕儞僌偺嵞奐亁偑幚峴偝傟傞傑偱桳岠
        偱偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        s_no    奐巒儗僐乕僪斣崋傪巜掕偟傑偡丅
                (1 埲忋傪巜掕偟偰壓偝偄)

        e_no    廔椆儗僐乕僪斣崋傪巜掕偟傑偡丅
                (1 埲忋傪巜掕偟偰壓偝偄)

        length  僨乕僞僽儘僢僋挿乮ODBHIS峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅

                ODBHIS   0劇劅劅劅劅劉           劅
                          劆  s_no  劆           仾
                         2劌劅劅劅劅劎           劆
                          劆  type  劆           劆
                         4劌劅劅劅劅劎           劆
                          劆  e_no  劆           劆
                         6劌劅劅劅劅劏劅劅劅劅劉length
                          劆      data[0]     劆 劆
                        14劌劅劅劅劅劅劅劅劅劅劎 劆
                          乣                  乣 劆
                 6+8*(n-1)劌劅劅劅劅劅劅劅劅劅劎 劆
                          劆      data[n]     劆 伀
                     6+8*n劋劅劅劅劅劅劅劅劅劅劊 劅


                data.rec_alm    0劇劅劅劅劅劅劅劅劅劅劅劅劉
                                 劆       rec_type       劆
                                2劌劅劅劅劅劅劅劅劅劅劅劅劎
                                 劆       alm_grp        劆
                                4劌劅劅劅劅劅劅劅劅劅劅劅劎
                                 劆       alm_no         劆
                                6劌劅劅劅劅劅劍劅劅劅劅劅劊
                                 劆 axis_no  劆
                                7劌劅劅劅劅劅劎
                                 劆  dummy   劆
                                8劋劅劅劅劅劅劊

                data.rec_mdi    0劇劅劅劅劅劅劅劅劅劅劅劅劉
                                 劆       rec_type       劆
                                2劌劅劅劅劅劅劍劅劅劅劅劅劊
                                 劆 key_code 劆
                                3劌劅劅劅劅劅劎
                                 劆 pw_flag  劆
                                4劌劅劅劅劅劅劎
                                 劆 dummy[0] 劆
                                5劌劅劅劅劅劅劎
                                 劆 dummy[1] 劆
                                6劌劅劅劅劅劅劎
                                 劆 dummy[2] 劆
                                7劌劅劅劅劅劅劎
                                 劆 dummy[3] 劆
                                8劋劅劅劅劅劅劊
                data.rec_sgn    0劇劅劅劅劅劅劅劅劅劅劅劅劉
                                 劆       rec_type       劆
                                2劌劅劅劅劅劅劍劅劅劅劅劅劊
                                 劆 sig_name 劆
                                3劌劅劅劅劅劅劎
                                 劆 sig_old  劆
                                4劌劅劅劅劅劅劎
                                 劆 sig_new  劆
                                5劌劅劅劅劅劅劎
                                 劆  dummy   劆
                                6劌劅劅劅劅劅劏劅劅劅劅劅劉
                                 劆       sig_no         劆
                                8劋劅劅劅劅劅劅劅劅劅劅劅劊

                data.rec_date   0劇劅劅劅劅劅劅劅劅劅劅劅劉
                                 劆       rec_type       劆
                                2劌劅劅劅劅劅劍劅劅劅劅劅劊
                                 劆  year    劆
                                3劌劅劅劅劅劅劎
                                 劆  month 丂劆
                                4劌劅劅劅劅劅劎
                                 劆   day    劆
                                5劌劅劅劅劅劅劎
                                 劆  pw_flg  劆
                                6劌劅劅劅劅劅劎
                                 劆 dummy[0] 劆
                                7劌劅劅劅劅劅劎

                                 劆 dummy[1] 劆
                                8劋劅劅劅劅劅劊

                data.rec_time   0劇劅劅劅劅劅劅劅劅劅劅劅劉
                                 劆       rec_type       劆
                                2劌劅劅劅劅劅劍劅劅劅劅劅劊
                                 劆  hour    劆
                                3劌劅劅劅劅劅劎
                                 劆  minute丂劆
                                4劌劅劅劅劅劅劎
                                 劆  second  劆
                                5劌劅劅劅劅劅劎
                                 劆  pw_flg  劆
                                6劌劅劅劅劅劅劎
                                 劆 dummy[0] 劆
                                7劌劅劅劅劅劅劎
                                 劆 dummy[1] 劆
                                8劋劅劅劅劅劅劊

        his     憖嶌棜楌僨乕僞傪曉偡ODBHIS峔憿懱傊偺億僀儞僞偱偡丅
                ODBHIS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbhis {
                    unsigned    s_no;           /* 奐巒儗僐乕僪斣崋 */
                    short       type;           /* 枹巊梡 */
                    unsigned    e_no;           /* 擖椡偟偨嵟屻偺儗僐乕僪斣崋 */
                    union {
                        struct {
                                short   rec_type; /* 儗僐乕僪偺庬椶 */
                                short   alm_grp;  /* 傾儔乕儉偺庬椶 */
                                short   alm_no;   /* 傾儔乕儉斣崋 */
                                char    axis_no;  /* 幉斣崋 */
                                char    dummy;    /* 枹巊梡 */
                        } rec_alm;                /* 傾儔乕儉 */
                        struct {
                                short   rec_type; /* 儗僐乕僪偺庬椶 */
                                char    key_code; /* 僉乕僐乕僪 */
                                char    pw_flag;  /* 枹巊梡 */
                                char    dummy[4]; /* 枹巊梡 */
                        } rec_mdi;                /* 俵俢俬 */
                        struct {
                                short   rec_type; /* 儗僐乕僪偺庬椶 */
                                char    sig_name; /* 怣崋偺柤徧 */
                                char    sig_old;  /* 曄壔慜偺價僢僩僷僞乕儞 */
                                char    sig_new;  /* 曄壔屻偺價僢僩僷僞乕儞 */
                                char    dummy;    /* 枹巊梡 */
                                short   sig_no;   /* 怣崋偺斣崋 */
                        } rec_sgn;                /* 怣崋 */
                        struct {
                                short   rec_type; /* 儗僐乕僪偺庬椶 */
                                char    year;     /* 擭 */
                                char    month;    /* 寧 */
                                char    day;      /* 擔 */
                                char    pw_flag;  /* 揹尮搳擖僼儔僌 */
                                char    dummy[2]; /* 枹巊梡 */
                        } rec_date;               /* 擔晅 */

                        struct {
                                short   rec_type; /* 儗僐乕僪偺庬椶 */
                                char    hour;     /* 帪 */
                                char    minute;   /* 暘 */
                                char    second;   /* 昩 */
                                char    pw_flag;  /* 揹尮搳擖僼儔僌 */
                                char    dummy[2]; /* 枹巊梡 */
                        } rec_time;               /* 帪娫 */
                    } data[N];          /* N : 撉傒弌偡憖嶌棜楌僨乕僞偺屄悢 */
                } ODBHIS ;

                rec_type        儗僐乕僪偺庬椶偑僙僢僩偝傟傑偡丅
                        0 : MDI 僉乕
                        1 : 怣崋
                        2 : 傾儔乕儉

                alm_grp         傾儔乕儉偺庬椶偑僙僢僩偝傟傑偡丅
                        bit  0 : P/S 100
                        bit  1 : P/S 000
                        bit  2 : P/S 101
                        bit  3 : P/S 偦偺懠
                        bit  4 : 僆乕僶僩儔儀儖
                        bit  5 : 僆乕僶僸乕僩
                        bit  6 : 僒乕儃傾儔乕儉
                        bit  7 : 僔僗僥儉傾儔乕儉
                        bit  8 : 俙俹俠傾儔乕儉
                        bit  9 : (枹巊梡)
                        bit 10 : P/S5000 斣戜
                        bit 11 : (枹巊梡)
                        bit 12 : (枹巊梡)
                        bit 13 : (枹巊梡)
                        bit 14 : (枹巊梡)
                        bit 15 : 奜晹傾儔乕儉儊僢僙乕僕

                alm_no          傾儔乕儉斣崋偑僙僢僩偝傟傑偡丅
                axis_no         (枹巊梡)
                key_code        僉乕僐乕僪偑僙僢僩偝傟傑偡丅
                sig_name        怣崋偺柤徧
                                        1 : X
                                        2 : G
                                        3 : Y
                                        4 : F
                sig_old         曄壔慜偺價僢僩僷僞乕儞
                sig_new         曄壔屻偺價僢僩僷僞乕儞
                sig_no          怣崋偺斣崋
                                        X : 0 乣 127, 1000 乣 1063
                                        G : 0 乣 255, 1000 乣 1255
                                        Y : 0 乣 127, 1000 乣 1063
                                        F : 0 乣 255, 1000 乣 1255
                year            擭 (0 乣 99)
                month           寧 (1 乣 12)
                data            擔 (1 乣 31)
                hour            帪 (0 乣 23)
                minute          暘 (0 乣 59)
                second          昩 (0 乣 59)


栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_FUNC         娭悢枹幚峴
                                棜楌僨乕僞偺僒儞僾儕儞僌偺掆巭(cnc_stopophis)
                                偑峴傢傟偰偄傑偣傫丅

                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBHIS峔憿懱偺僒僀僘(length)偑晄惓偱偡丅
                                埲壓偺応崌偑奩摉偟傑偡丅
                                 (e_no-s_no+1) * sizeof(data[0]) + 6 < length

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 5) 傾儔乕儉棜楌僨乕僞悢偺儕乕僪

娭悢柤  cnc_rdalmhisno

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdalmhisno(unsigned short FlibHndl,
                                                        unsigned short *hisno);

夝愢    傾儔乕儉棜楌僨乕僞悢偺儕乕僪傪峴偄傑偡丅
        偙偺娭悢傪巊梡偡傞慜偵丄棜楌僨乕僞偺僒儞僾儕儞僌偺掆巭(cnc_stopophis)
        傪峴偆昁梫偑偁傝傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        hisno   傾儔乕儉棜楌僨乕僞悢傪奿擺偡傞曄悢偺傾僪儗僗傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_FUNC         娭悢枹幚峴
                                棜楌僨乕僞偺僒儞僾儕儞僌偺掆巭(cnc_stopophis)
                                偑峴傢傟偰偄傑偣傫丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 6) 傾儔乕儉棜楌僨乕僞偺儕乕僪

娭悢柤  cnc_rdalmhistry

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdalmhistry(unsigned short FlibHndl,
                                unsigned short s_no, unsigned short e_no,
                                        unsigned short length, ODBAHIS *his);

夝愢    傾儔乕儉棜楌僨乕僞偺儕乕僪傪峴偄傑偡丅
        侾屄偺傾儔乕儉棜楌僨乕僞偺扨埵傪儗僐乕僪偲屇傃傑偡丅

        憖嶌棜楌僨乕僞暲傃偵傾儔乕儉棜楌僨乕僞偼CNC懁偱帺摦揑偵婰榐偝傟偰偄傑偡
        偙傟傜偺僨乕僞偵傾僋僙僗偡傞偨傔偵偼CNC懁偺僒儞僾儕儞僌傪堦帪揑偵掆巭偝
        偣傞昁梫偑偁傝傑偡丅偙偺偨傔丄杮娭悢傪巊梡偡傞慜偵丄亀棜楌僨乕僞偺僒儞
        僾儕儞僌偺掆巭亁(cnc_stopophis)傪幚峴偡傞昁梫偑偁傝傑偡丅

        傑偨丄儕乕僪偑嵪傒師戞丄棜楌僨乕僞偺僒儞僾儕儞僌掆巭帪娫傪嵟彫尷偵偡傞
        偨傔偵亀棜楌僨乕僞偺僒儞僾儕儞僌偺嵞奐亁(cnc_startophis)傪幚峴偟偰偔偩
        偝偄丅

        奐巒乛廔椆偺儗僐乕僪斣崋偲偼丄儕乕僪偡傞傾儔乕儉棜楌僨乕僞偺儗僐乕僪枅
        偵偮偗偨斣崋偺偙偲偱偡丅偙偺儗僐乕僪斣崋偼亀棜楌僨乕僞偺僒儞僾儕儞僌偺
        掆巭亁傪幚峴偟偰偐傜亀棜楌僨乕僞偺僒儞僾儕儞僌偺嵞奐亁偑幚峴偝傟傞傑偱
        桳岠偱偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        s_no    奐巒儗僐乕僪斣崋傪巜掕偟傑偡丅
                (1 埲忋傪巜掕偟偰壓偝偄)

        e_no    廔椆儗僐乕僪斣崋傪巜掕偟傑偡丅
                (1 埲忋傪巜掕偟偰壓偝偄)

        length  僨乕僞僽儘僢僋挿乮ODBAHIS峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅

                ODBAHIS  0劇劅劅劅劅劉           劅
                          劆  s_no  劆           仾
                         2劌劅劅劅劅劎           劆
                          劆  type  劆           劆
                         4劌劅劅劅劅劎           劆
                          劆  e_no  劆           劆
                         6劌劅劅劅劅劏劅劅劅劅劉length
                          劆    alm_his[0]    劆 劆
                        54劌劅劅劅劅劅劅劅劅劅劎 劆
                          乣                  乣 劆
                6+48*(n-1)劌劅劅劅劅劅劅劅劅劅劎 劆
                          劆    alm_his[n]    劆 伀
                    6+48*n劋劅劅劅劅劅劅劅劅劅劊 劅

                alm_his  0劇劅劅劅劅劅劅劅劅劅劅劅劅劅劉

                          劆          dummy           劆
                         2劌劅劅劅劅劅劅劅劅劅劅劅劅劅劎
                          劆         alm_grp          劆
                         4劌劅劅劅劅劅劅劅劅劅劅劅劅劅劎
                          劆         alm_no           劆
                         6劌劅劅劅劅劅劅劍劅劅劅劅劅劅劊
                          劆  axis_no   劆
                         7劌劅劅劅劅劅劅劎
                          劆    year    劆
                         8劌劅劅劅劅劅劅劎
                          劆   month    劆
                         9劌劅劅劅劅劅劅劎
                          劆    day     劆
                        10劌劅劅劅劅劅劅劎
                          劆    hour    劆
                        11劌劅劅劅劅劅劅劎
                          劆   minute   劆
                        12劌劅劅劅劅劅劅劎
                          劆   second   劆
                        13劌劅劅劅劅劅劅劎
                          劆   dummy2   劆
                        14劌劅劅劅劅劅劅劏劅劅劅劅劅劅劉
                          劆         len_meg          劆
                        16劌劅劅劅劅劅劅劍劅劅劅劅劅劅劊
                          劆 alm_msg[0] 劆
                        17劌劅劅劅劅劅劅劎
                          乣            乣
                        47劌劅劅劅劅劅劅劎
                          劆 alm_msg[31]劆
                        48劋劅劅劅劅劅劅劊

        his     傾儔乕儉棜楌僨乕僞傪曉偡ODBAHIS峔憿懱傊偺億僀儞僞偱偡丅
                ODBAHIS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbahis {
                    unsigned    s_no;           /* 奐巒儗僐乕僪斣崋 */
                    short       type;           /* (枹巊梡) */
                    unsigned    e_no;           /* 廔椆儗僐乕僪斣崋 */
                        struct {
                                short   dummy;
                                short   alm_grp; /* 傾儔乕儉偺庬椶(枹巊梡)*/
                                short   alm_no;  /* 傾儔乕儉斣崋 */
                                char    axis_no; /* 幉忣曬                */
                                                 /* 乮侾乣嵟戝惂屼幉斣崋乯*/
                                char    year;    /* 擭 */
                                char    month;   /* 寧 */
                                char    day;     /* 擔 */
                                char    hour;    /* 帪 */
                                char    minute;  /* 暘 */
                                char    second;  /* 昩 */
                                char    dummy2;
                                short   len_msg; /* 傾儔乕儉儊僢僙乕僕 */
                                                 /* 偺暥帤悢(0-32)     */
                                char    alm_msg[32]; /* 傾儔乕儉儊僢僙乕僕 */
                        } alm_his[N]; /* N : 撉傒弌偡傾儔乕儉棜楌僨乕僞偺屄悢 */
                } ODBAHIS ;


                alm_no          傾儔乕儉斣崋
                axis_no         幉斣崋 (1 乣 嵟戝惂屼幉斣崋)
                                (幉偵娭學側偄傾儔乕儉偺応崌偼 -1 偱偡)
                year            擭 (0 乣 99)
                month           寧 (1 乣 12)
                data            擔 (1 乣 31)
                hour            帪 (0 乣 23)
                minute          暘 (0 乣 59)
                second          昩 (0 乣 59)
                len_msg         傾儔乕儉儊僢僙乕僕偺暥帤悢 (0 乣 32)
                alm_msg         傾儔乕儉儊僢僙乕僕

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_FUNC         娭悢枹幚峴
                                棜楌僨乕僞偺僒儞僾儕儞僌偺掆巭(cnc_stopophis)
                                偑峴傢傟偰偄傑偣傫丅

                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBAHIS峔憿懱偺僒僀僘(length)偑晄惓偱偡丅
                                埲壓偺応崌偑奩摉偟傑偡丅
                                 (e_no-s_no+1) * sizeof(data[0]) + 6 < length

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                儗僐乕僪斣崋(s_no,e_no)偑晄惓偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 7) 憖嶌棜楌僨乕僞偺僋儕傾

娭悢柤  cnc_clearophis

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_clearophis(unsigned short FlibHndl,
                                                                short slct);

夝愢    憖嶌棜楌僨乕僞偲傾儔乕儉棜楌僨乕僞偺僋儕傾傪峴偄傑偡丅

        Power Mate偱偼 slct 偺愝掕偵傛傝憖嶌棜楌偲傾儔乕儉棜楌偳偪傜傪
        僋儕傾偡傞偐慖戰偱偒傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        slct    僋儕傾偡傞棜楌僨乕僞偺庬椶傪巜掕偟傑偡丅
                        0 : 憖嶌棜楌
                        1 : 傾儔乕儉棜楌

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                棜楌僨乕僞偺庬椶(slct)偺巜掕偑晄惓偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 8) 憖嶌棜楌懳徾怣崋偺儕乕僪

娭悢柤  cnc_rdhissgnl

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdhissgnl(unsigned short FlibHndl,
                                                                IODBSIG *sig);

夝愢    憖嶌棜楌偺懳徾偲側傞怣崋偺儕乕僪傪峴偄傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        sig     憖嶌棜楌懳徾怣崋傪曉偡IODBSIG峔憿懱傊偺億僀儞僞偱偡丅
                IODBSIG峔憿懱偼師偺捠傝偱偡丅

                typedef struct iodbsig {
                     short      datano;           /* 枹巊梡 */
                     short      type;             /* 枹巊梡 */
                     struct {
                                short   ent_no;   /* 搊榐弴斣崋*/
                                short   sig_no;   /* 怣崋偺斣崋 */
                                char    sig_name; /* 怣崋偺柤徧 */
                                char    mask_pat; /* 怣崋偺儅僗僋僷僞乕儞 */
                     } data[20];
                } IODBSIG ;

                ent_no          搊榐弴斣崋 (1 乣 20)

                sig_no          搊榐偝傟偰偄傞怣崋偺斣崋
                                        X : 0 乣 127, 1000 乣 1063
                                        G : 0 乣 255, 1000 乣 1255
                                        Y : 0 乣 127, 1000 乣 1063
                                        F : 0 乣 255, 1000 乣 1255

                sig_name        搊榐偝傟偰偄傞怣崋偺柤徧
                                        0 : 枹搊榐
                                        1 : X
                                        2 : G
                                        3 : Y
                                        4 : F

                mask_pat        怣崋偺儅僗僋僷僞乕儞

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 9) 憖嶌棜楌懳徾怣崋偺愝掕

娭悢柤  cnc_wrhissgnl

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_wrhissgnl(unsigned short FlibHndl,
                                                                IODBSIG *sig);

夝愢    憖嶌棜楌懳徾怣崋偺愝掕傪峴偄傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        sig     憖嶌棜楌懳徾怣崋偺愝掕傪峴偆IODBSIG峔憿懱傊偺億僀儞僞偱偡丅
                IODBSIG峔憿懱偼師偺捠傝偱偡丅

                typedef struct iodbsig {
                     short      datano;           /* 枹巊梡 */
                     short      type;             /* 怣崋偺屄悢 */
                     struct {
                                short   ent_no;   /* 搊榐弴斣崋*/
                                short   sig_no;   /* 怣崋偺斣崋 */
                                char    sig_name; /* 怣崋偺柤徧 */
                                char    mask_pat; /* 怣崋偺儅僗僋僷僞乕儞 */
                     } data[20];
                } IODBSIG ;

                ent_no          搊榐弴斣崋 (1 乣 20)

                sig_no          搊榐偡傞怣崋偺斣崋
                                        X : 0 乣 127, 1000 乣 1063
                                        G : 0 乣 255, 1000 乣 1255
                                        Y : 0 乣 127, 1000 乣 1063
                                        F : 0 乣 255, 1000 乣 1255

                sig_name        搊榐偡傞怣崋偺柤徧
                                        0 : 枹搊榐
                                        1 : X
                                        2 : G
                                        3 : Y
                                        4 : F

                mask_pat        怣崋偺儅僗僋僷僞乕儞

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                搊榐偡傞怣崋偺屄悢(type)偺巜掕偑晄惓偱偡丅


                EW_DATA         僨乕僞偺岆傝

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

幉堏摦惂屼娭學
-------------------------------------------------------------------------------
  娭悢柤                婡  擻  撪  梕
-------------------------------------------------------------------------------
 *( 1) cnc_opdi         怣崋憖嶌巜椷
 *( 2) cnc_refpoint     儕僼傽儗儞僗揰暅婣
 *( 3) cnc_abspoint     傾僽僜儕儏乕僩堏摦巜椷
 *( 4) cnc_incpoint     僀儞僋儗儊儞僞儖堏摦巜椷
 *( 5) cnc_dwell        僪僁僄儖
 *( 6) cnc_coordre      嵗昗宯愝掕
 *( 7) cnc_exebufstat   幚峴僶僢僼傽忬懺偺撉庢
 *( 8) cnc_finstate     幚峴姰椆忬懺偺撉庢
 *( 9) cnc_setfin       幚峴姰椆忬懺偺夝彍
-------------------------------------------------------------------------------
 * 偙偺娭悢偼丄Power Mate-D 偱偼巊梡偱偒傑偣傫丅

  ( 1) 怣崋憖嶌巜椷

娭悢柤  cnc_opdi

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_opdi(unsigned short FlibHndl, short number,
                                                                ODBOPDI *idb );

夝愢    怣崋偺憖嶌斣崋傪巜掕偟偰丄摿掕偺俧僐乕僪怣崋偺愗傝姺偊傪峴偄傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        number  憖嶌怣崋斣崋傪巜掕偟傑偡丅

        idb     怣崋偺忬懺傪帵偡ODBOPDI峔憿懱傊偺億僀儞僞偱偡丅
                ODBOPDI峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbopdi {
                        short   axis;           /* 幉斣崋 */
                        union {
                                char    cdata;
                                short   idata;
                                long    ldata;
                        } u;                    /* 怣崋僨乕僞 */
                } ODBOPDI;

+---------+-------------------------+---------------------------------------+
| 憖嶌怣崋|      憖嶌怣崋柤         |       愝掕抣                          |
|   斣崋  |                         |                                       |
+---------+-------------------------+---------------------------------------+
|    侾   | 旕忢掆巭怣崋            | cdata   0:旕忢掆巭 1:夝彍             |
+---------+-------------------------+---------------------------------------+
|    俀   | 僼傿乕僪儂乕儖僪怣崋    | cdata   0:僼傿乕僪儂乕儖僪            |
|         |                         |         1:夝彍                        |
+---------+-------------------------+---------------------------------------+
|    俁   | 儕僙僢僩怣崋            | cdata   1:儕僙僢僩 0:夝彍             |
+---------+-------------------------+---------------------------------------+
|    係   | 僒乕儃僆僼怣崋          | cdata #7  #6  #5  #4  #3  #2  #1  #0  |
|         |                         |     +---+---+---+---+---+---+---+---+ |
|         |                         |     | 侽| 侽|   |   |   |   |   |   | |
|         |                         |     +---+---+---+---+---+---+---+---+ |
|         |                         |    #0   1:戞侾幉僒乕儃僆僼            |
|         |                         |         0:戞侾幉僒乕儃僆儞            |
|         |                         |    乣                                 |
|         |                         |    #5   1:戞俇幉僒乕儃僆僼            |
|         |                         |         0:戞俇幉僒乕儃僆儞            |
+---------+-------------------------+---------------------------------------+
|    俈   | 憗憲傝怣崋              | cdata   1:憗憲傝怣崋僆儞              |
|         |                         |         0:憗憲傝怣崋僆僼              |
+---------+-------------------------+---------------------------------------+
|    俉   | 僗僞乕僩怣崋            | cdata   1:僗僞乕僩怣崋僆儞            |
|         |                         |         0:僗僞乕僩怣崋僆僼            |

+---------+-------------------------+---------------------------------------+
|    俋   | 儌乕僪愗姺偊怣崋        | cdata #7  #6  #5  #4  #3  #2  #1  #0  |
|         |                         |     +---+---+---+---+---+---+---+---+ |
|         |                         |     | 侽| 侽| 侽| 侽|   |   |   |   | |
|         |                         |     +---+---+---+---+---+---+---+---+ |
|         |                         |       #3,#2,#1,#0                     |
|         |                         |       0  0  0  0  :MDI                |
|         |                         |       0  0  0  1  :MEM                |
|         |                         |       0  0  1  0  :EDIT               |
|         |                         |       0  0  1  1  :REF                |
|         |                         |       0  1  0  0  :JOG                |
|         |                         |       0  1  0  1  :INC                |
|         |                         |       0  1  1  1  :HNDL               |
+---------+-------------------------+---------------------------------------+
|   侾侽  | 憲傝懍搙僆乕僶儔僀僪怣崋| cdata  00000000  :  0%                |
|         |                         |        00000001  :  1%                |
|         |                         |        00000010  :  2%                |
|         |                         |        丒丒丒丒                       |
|         |                         |        01100100  :100%                |
|         |                         |        丒丒丒丒                       |
|         |                         |        11111110  :254%                |
|         |                         |        11111111  :  0%                |
+---------+-------------------------+---------------------------------------+
|   侾俀  | 僩儖僋儌乕僪怣崋        | cdata #7  #6  #5  #4  #3  #2  #1  #0  |
|         |                         |     +---+---+---+---+---+---+---+---+ |
|         |                         |     | 侽| 侽|   |   |   |   |   |   | |
|         |                         |     +---+---+---+---+---+---+---+---+ |
|         |                         |    #0   1:戞侾幉僩儖僋儌乕僪桳岠      |
|         |                         |         0:戞侾幉僩儖僋儌乕僪柍岠      |
|         |                         |    乣                                 |
|         |                         |    #5   1:戞俇幉僩儖僋儌乕僪桳岠      |
|         |                         |         0:戞俇幉僩儖僋儌乕僪柍岠      |
+---------+-------------------------+---------------------------------------+
|   侾俁  | 僩儖僋僆乕僶儔僀僪怣崋  | axis     :愝掕幉斣崋侾乣俇幉傑偱      |
|         |                         |           0:慡幉愝掕                  |
|         |                         | cdata    :侽乣俀俆俆                  |
|         |                         |   僆乕僶儔僀僪抣                      |
|         |                         |        = ( cdata / 255 ) * 100%       |
+---------+-------------------------+---------------------------------------+
|   侾係  | 僕儑僌憲傝怣崋          | axis     :愝掕幉斣崋侾乣俇幉傑偱      |
|         |                         |           0:慡幉愝掕                  |
|         |                         | cdata #7  #6  #5  #4  #3  #2  #1  #0  |
|         |                         |     +---+---+---+---+---+---+---+---+ |
|         |                         |     | 侽| 侽| 侽| 侽|   | 侽| 侽|   | |
|         |                         |     +---+---+---+---+---+---+---+---+ |
|         |                         |    #3    :堏摦曽岦 1:-J  0:+J         |
|         |                         |    #0   1:堏摦奐巒                    |
|         |                         |         0:堏摦掆巭                    |
+---------+-------------------------+---------------------------------------+
|   侾俆  | 僔儞僌儖僽儘僢僋怣崋    | cdata   1:僔儞僌儖僽儘僢僋僆儞        |
|         |                         |         0:僔儞僌儖僽儘僢僋僆僼        |
+---------+-------------------------+---------------------------------------+

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅

        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                --------------------------------------------------------------
                栠傝抣          堄枴乛懳張曽朄
                --------------------------------------------------------------
                EW_BUSY         價僕傿
                                俠俶俠偺張棟偑廔椆偡傞傑偱懸偮偐丄儕僩儔僀
                                偟偰偔偩偝偄丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 2) 儕僼傽儗儞僗揰暅婣

娭悢柤  cnc_refpoint

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_refpoint(unsigned short FlibHndl,
                        short path_no, short nmod, short axis, ODBEXEC *odb);

夝愢    path_no, axis 偱巜掕偝傟偨幉傪丄儕僼傽儗儞僗揰暅婣偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        path_no 宯摑斣崋傪巜掕偟傑偡丅乮侾乣俇乯

        nmod    姰椆捠抦僼儔僌偺桳柍傪巜掕偟傑偡丅
                        侾丗姰椆捠抦桳傝
                        侽丗姰椆捠抦柍偟

        axis    幉斣崋傪巜掕偟傑偡丅乮侾乣俇乯

        odb     奺宯摑暿幚峴忬懺忣曬傪曉偡ODBEXEC峔憿懱傊偺億僀儞僞偱偡丅
                ODBEXEC峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbexec {
                        short   dummy;          /* 枹巊梡 */
                        char    cdata[2][8];    /* 奺宯摑暿幚峴忬懺忣曬 */
                } ODBEXEC;

                cdata   尰嵼偺巜椷僶僢僼傽偺忬懺傪帵偟傑偡丅

                        7      6      5      4      3      2      1      0 bit
                    +------+------+------+------+------+------+------+------+
      cdata[0][x-1] |      |      |EMNT16|EMNT15|EMNT14|EMNT13|EMNT12|EMNT11|
                    +------+------+------+------+------+------+------+------+
      cdata[1][x-1] |      |      |EMNT26|EMNT25|EMNT24|EMNT23|EMNT22|EMNT21|
                    +------+------+------+------+------+------+------+------+
                    +------+------+---------------------------------------+
                    |EMNT2x|EMNT1x|       幚峴僶僢僼傽忬懺                |
                    +------+------+---------------------------------------+
                    |  0   |  0   |  幚峴僶僢僼傽偼嬻偱偡                 |
                    |  0   |  1   |  幚峴僶僢僼傽侾偵僨乕僞偑偁傝傑偡     |
                    |  1   |  0   |  幚峴僶僢僼傽俀偵僨乕僞偑偁傝傑偡     |
                    |  1   |  1   |  幚峴僶僢僼傽侾丄俀偵僨乕僞偑偁傝傑偡 |
                    +------+------+---------------------------------------+
                        x : 宯摑斣崋

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                --------------------------------------------------------------
                栠傝抣          堄枴乛懳張曽朄
                --------------------------------------------------------------

                EW_BUSY         價僕傿
                                俠俶俠偺張棟偑廔椆偡傞傑偱懸偮偐丄儕僩儔僀
                                偟偰偔偩偝偄丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻嵶偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅

                8003#7  僟僀儗僋僩僐儅儞僪偵傛傞儌乕僔儑儞巜椷偺桳柍
                8010    PMC偵傛傞幉惂屼偵偍偗傞奺幉偺DI/DO孮偺慖戰

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼丄侾宯摑偺侾幉栚偵儕僼傽儗儞僗揰暅婣巜椷傪偟丄
        巜椷僶僢僼傽忬懺傪昞帵偝偣傑偡丅

#include <stdio.h>
#include "apilib.h"

void example( void )
{
        ODBEXEC odb ;
        short   ret ;
        short   i, j ;

        ret = cnc_refpoint( FlibHndl, 1, 0, 1, &odb ) ;

        printf( "Return value : %d\n", ret ) ;
        if( ret == 0 ){
                for( i = 0 ; i < 2 ; i++ ){
                        for( j = 0 ; j < 8 ; j++ ){
                                printf( "%x ", odb.cdata[i][j] ) ;
                        }
                        printf( "\n" ) ;
                }
        }
}

  ( 3) 傾僽僜儕儏乕僩堏摦巜椷

娭悢柤  cnc_abspoint

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_abspoint(unsigned short FlibHndl,
                        short path_no, short nmod, short axis, long feed,
                                                ODBPOS *idb, ODBEXEC *odb);

夝愢    path_no, idb.idata 偱巜掕偝傟偨幉傪丄idb.ldata偵傾僽僜儕儏乕僩巜椷
        偱巜掕偟偨億僕僔儑儞傊丄feed 懍搙偱堏摦偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        path_no 宯摑斣崋傪巜掕偟傑偡丅乮侾乣俇乯

        nmod    姰椆捠抦僼儔僌偺桳柍傪巜掕偟傑偡丅
                        侾丗姰椆捠抦桳傝
                        侽丗姰椆捠抦柍偟

        axis    堏摦幉悢傪巜掕偟傑偡丅乮侾乣俇乯

        feed    堏摦懍搙傪巜掕偟傑偡丅

        idb     奺幉枅偺堏摦忣曬傪帵偡ODBPOS峔憿懱傊偺億僀儞僞偱偡丅
                ODBPOS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbpos {
                        short   idata;          /* 幉斣崋 */
                        long    ldata;          /* 嵗昗抣 */
                } ODBPOS;

                idata   堏摦偡傞幉斣崋傪巜掕偟傑偡丅

                ldata   堏摦偡傞嵗昗抣傪巜掕偟傑偡丅
                        堏摦扨埵偼埲壓偺偲偍傝偱偡丅

                        +---------------------+---------------+
                        |                     |     IS-B      |
                        +---------------------+---------------+
                        | 捈慄幉乮儈儕弌椡乯  | 0.001  [mm]   |
                        +---------------------+---------------+
                        | 捈慄幉乮僀儞僠弌椡乯| 0.0001 [inch] |
                        +---------------------+---------------+
                        | 夞揮幉              | 0.001  [deg]  |
                        +---------------------+---------------+

        odb     奺宯摑暿幚峴忬懺忣曬傪曉偡ODBEXEC峔憿懱傊偺億僀儞僞偱偡丅
                ODBEXEC峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbexec {
                        short   dummy;          /* 枹巊梡 */
                        char    cdata[2][8];    /* 奺宯摑暿幚峴忬懺忣曬 */
                } ODBEXEC;


                cdata   尰嵼偺巜椷僶僢僼傽偺忬懺傪帵偟傑偡丅

                        7      6      5      4      3      2      1      0 bit
                    +------+------+------+------+------+------+------+------+
      cdata[0][x-1] |      |      |EMNT16|EMNT15|EMNT14|EMNT13|EMNT12|EMNT11|
                    +------+------+------+------+------+------+------+------+
      cdata[1][x-1] |      |      |EMNT26|EMNT25|EMNT24|EMNT23|EMNT22|EMNT21|
                    +------+------+------+------+------+------+------+------+
                    +------+------+---------------------------------------+
                    |EMNT2x|EMNT1x|       幚峴僶僢僼傽忬懺                |
                    +------+------+---------------------------------------+
                    |  0   |  0   |  幚峴僶僢僼傽偼嬻偱偡                 |
                    |  0   |  1   |  幚峴僶僢僼傽侾偵僨乕僞偑偁傝傑偡     |
                    |  1   |  0   |  幚峴僶僢僼傽俀偵僨乕僞偑偁傝傑偡     |
                    |  1   |  1   |  幚峴僶僢僼傽侾丄俀偵僨乕僞偑偁傝傑偡 |
                    +------+------+---------------------------------------+
                        x : 宯摑斣崋

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                --------------------------------------------------------------
                栠傝抣          堄枴乛懳張曽朄
                --------------------------------------------------------------
                EW_BUSY         價僕傿
                                俠俶俠偺張棟偑廔椆偡傞傑偱懸偮偐丄儕僩儔僀
                                偟偰偔偩偝偄丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻嵶偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅

                8003#7  僟僀儗僋僩僐儅儞僪偵傛傞儌乕僔儑儞巜椷偺桳柍
                8010    PMC偵傛傞幉惂屼偵偍偗傞奺幉偺DI/DO孲偺慖戰

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼丄侾宯摑偺侾幉栚傪侾侽侽偺埵抲丄俀幉栚傪亅侾侽侽偺
        埵抲偵懍搙俆侽侽偱堏摦偝偣傞巜椷傪偟丄巜椷僶僢僼傽偺忬懺傪曉偝偣傞傕
        偺偱偡丅
        乮儈儕弌椡丄愝掕扨埵偼 IS-B偱偁傞偲偟傑偡丅乯

#include <stdio.h>
#include "apilib.h"

void example( void )
{
        ODBPOS  idb[2] ;
        ODBEXEC odb ;
        short   ret ;
        short   i, j ;


        idb[0].idata = 1 ;
        idb[0].ldata = 100000 ;
        idb[1].idata = 2 ;
        idb[1].ldata = -100000 ;

        ret = cnc_abspoint( FlibHndl, 1, 0, 2, 500, idb, &odb ) ;

        printf( "Return value : %d\n", ret ) ;
        if( ret == 0 ){
                for( i = 0 ; i < 2 ; i++ ){
                        for( j = 0 ; j < 8 ; j++ ){
                                printf( "%x ", odb.cdata[i][j] ) ;
                        }
                        printf( "\n" ) ;
                }
        }
}

  ( 4) 僀儞僋儗儊儞僞儖堏摦巜椷

娭悢柤  cnc_incpoint

愰尵    #include        "Fwlib32.h"                             (Windows'95斉)
        FWLIBAPI short WINAPI cnc_incpoint(unsigned short FlibHndl,
                        short path_no, short nmod, short axis, long feed,
                                                ODBPOS *idb, ODBEXEC *odb);

夝愢    path_no, idb.idata 偱巜掕偝傟偨幉傪丄idb.ldata偵僀儞僋儗儊儞僞儖巜椷
        偱巜掕偟偨堏摦嫍棧暘丄feed 懍搙偱堏摦偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        path_no 宯摑斣崋傪巜掕偟傑偡丅乮侾乣俇乯

        nmod    姰椆捠抦僼儔僌偺桳柍傪巜掕偟傑偡丅
                        侾丗姰椆捠抦桳傝
                        侽丗姰椆捠抦柍偟

        axis    堏摦幉悢傪巜掕偟傑偡丅乮侾乣俇乯

        feed    堏摦懍搙傪巜掕偟傑偡丅

        idb     奺幉枅偺堏摦忣曬傪帵偡ODBPOS峔憿懱傊偺億僀儞僞偱偡丅
                ODBPOS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbpos {
                        short   idata;          /* 幉斣崋 */
                        long    ldata;          /* 嵗昗抣 */
                } ODBPOS;

                idata   堏摦偡傞幉斣崋傪巜掕偟傑偡丅

                ldata   堏摦偡傞嫍棧傪巜掕偟傑偡丅
                        堏摦扨埵偼埲壓偺偲偍傝偱偡丅

                        +---------------------+---------------+
                        |                     |     IS-B      |
                        +---------------------+---------------+
                        | 捈慄幉乮儈儕弌椡乯  | 0.001  [mm]   |
                        +---------------------+---------------+
                        | 捈慄幉乮僀儞僠弌椡乯| 0.0001 [inch] |
                        +---------------------+---------------+
                        | 夞揮幉              | 0.001  [deg]  |
                        +---------------------+---------------+

        odb     奺宯摑暿幚峴忬懺忣曬傪曉偡ODBEXEC峔憿懱傊偺億僀儞僞偱偡丅
                ODBEXEC峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbexec {
                        short   dummy;          /* 枹巊梡 */
                        char    cdata[2][8];    /* 奺宯摑暿幚峴忬懺忣曬 */

                } ODBEXEC;

                cdata   尰嵼偺巜椷僶僢僼傽偺忬懺傪帵偟傑偡丅

                        7      6      5      4      3      2      1      0 bit
                    +------+------+------+------+------+------+------+------+
      cdata[0][x-1] |      |      |EMNT16|EMNT15|EMNT14|EMNT13|EMNT12|EMNT11|
                    +------+------+------+------+------+------+------+------+
      cdata[1][x-1] |      |      |EMNT26|EMNT25|EMNT24|EMNT23|EMNT22|EMNT21|
                    +------+------+------+------+------+------+------+------+
                    +------+------+---------------------------------------+
                    |EMNT2x|EMNT1x|       幚峴僶僢僼傽忬懺                |
                    +------+------+---------------------------------------+
                    |  0   |  0   |  幚峴僶僢僼傽偼嬻偱偡                 |
                    |  0   |  1   |  幚峴僶僢僼傽侾偵僨乕僞偑偁傝傑偡     |
                    |  1   |  0   |  幚峴僶僢僼傽俀偵僨乕僞偑偁傝傑偡     |
                    |  1   |  1   |  幚峴僶僢僼傽侾丄俀偵僨乕僞偑偁傝傑偡 |
                    +------+------+---------------------------------------+
                        x : 宯摑斣崋

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                --------------------------------------------------------------
                栠傝抣          堄枴乛懳張曽朄
                --------------------------------------------------------------
                EW_BUSY         價僕傿
                                俠俶俠偺張棟偑廔椆偡傞傑偱懸偮偐丄儕僩儔僀
                                偟偰偔偩偝偄丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻嵶偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅

                8003#7  僟僀儗僋僩僐儅儞僪偵傛傞儌乕僔儑儞巜椷偺桳柍
                8010    PMC偵傛傞幉惂屼偵偍偗傞奺幉偺DI/DO孲偺慖戰

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼丄侾宯摑偺侾幉栚偺埵抲傪亄侾侽侽丄俀幉栚偺埵抲傪
        亅侾侽侽偵懍搙俆侽侽偱堏摦偝偣傞巜椷傪偟丄巜椷僶僢僼傽忬懺傪昞帵偟
        傑偡丅乮儈儕弌椡丄愝掕扨埵偼 IS-B 偱偁傞偲偟傑偡丅乯

#include <stdio.h>
#include "apilib.h"

void example( void )
{
        ODBPOS  idb[2] ;
        ODBEXEC odb ;
        short   ret ;
        short   i, j ;


        idb[0].idata = 1 ;
        idb[0].ldata = 100000 ;
        idb[1].idata = 2 ;
        idb[1].ldata = -100000 ;

        ret = cnc_incpoint( FlibHndl, 1, 0, 2, 500, idb, &odb ) ;

        printf( "Return value : %d\n", ret ) ;
        if( ret == 0 ){
                for( i = 0 ; i < 2 ; i++ ){
                        for( j = 0 ; j < 8 ; j++ ){
                                printf( "%x ", odb.cdata[i][j] ) ;
                        }
                        printf( "\n" ) ;
                }
        }
}

  ( 5) 僪僁僄儖

娭悢柤  cnc_dwell

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_dwell(unsigned short FlibHndl, short path_no,
                        short nmod, short axis, ODBPOS *idb, ODBEXEC *odb);

夝愢    path_no 偱巜掕偝傟偨宯摑傪丄idb.ldata 偱巜掕偟偨帪娫(sec)掆巭偝偣傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        path_no 宯摑斣崋傪巜掕偟傑偡丅乮侾乣俇乯

        nmod    姰椆捠抦僼儔僌偺桳柍傪巜掕偟傑偡丅
                        侾丗姰椆捠抦桳傝
                        侽丗姰椆捠抦柍偟

        axis    掆巭幉悢傪巜掕偟傑偡丅乮侾乣俇乯

        idb     奺幉枅偺帪娫忣曬傪帵偡ODBPOS峔憿懱傊偺億僀儞僞偱偡丅
                ODBPOS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbpos {
                        short   idata;          /* 幉斣崋 */
                        long    ldata;          /* 掆巭帪娫(sec) */
                } ODBPOS;

                idata   幉斣崋傪巜掕偟傑偡丅

                ldata   帪娫(sec)傪巜掕偟傑偡丅(0.001 - 99999.999)

        odb     奺宯摑暿幚峴忬懺忣曬傪曉偡ODBEXEC峔憿懱傊偺億僀儞僞偱偡丅
                ODBEXEC峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbexec {
                        short   dummy;          /* 枹巊梡 */
                        char    cdata[2][8];    /* 奺宯摑暿幚峴忬懺忣曬 */
                } ODBEXEC;

                cdata   尰嵼偺巜椷僶僢僼傽偺忬懺傪帵偟傑偡丅

                        7      6      5      4      3      2      1      0 bit
                    +------+------+------+------+------+------+------+------+
      cdata[0][x-1] |      |      |EMNT16|EMNT15|EMNT14|EMNT13|EMNT12|EMNT11|
                    +------+------+------+------+------+------+------+------+
      cdata[1][x-1] |      |      |EMNT26|EMNT25|EMNT24|EMNT23|EMNT22|EMNT21|
                    +------+------+------+------+------+------+------+------+
                    +------+------+---------------------------------------+
                    |EMNT2x|EMNT1x|       幚峴僶僢僼傽忬懺                |
                    +------+------+---------------------------------------+
                    |  0   |  0   |  幚峴僶僢僼傽偼嬻偱偡                 |
                    |  0   |  1   |  幚峴僶僢僼傽侾偵僨乕僞偑偁傝傑偡     |
                    |  1   |  0   |  幚峴僶僢僼傽俀偵僨乕僞偑偁傝傑偡     |

                    |  1   |  1   |  幚峴僶僢僼傽侾丄俀偵僨乕僞偑偁傝傑偡 |
                    +------+------+---------------------------------------+
                        x : 宯摑斣崋

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                --------------------------------------------------------------
                栠傝抣          堄枴乛懳張曽朄
                --------------------------------------------------------------
                EW_BUSY         價僕傿
                                俠俶俠偺張棟偑廔椆偡傞傑偱懸偮偐丄儕僩儔僀
                                偟偰偔偩偝偄丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻嵶偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅

                8003#7  僟僀儗僋僩僐儅儞僪偵傛傞儌乕僔儑儞巜椷偺桳柍
                8010    PMC偵傛傞幉惂屼偵偍偗傞奺幉偺DI/DO孲偺慖戰

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 6) 嵗昗宯愝掕

娭悢柤  cnc_coordre

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_coordre(unsigned short FlibHndl,
                                        short path_no, short nmod, short axis,
                                                ODBPOS *idb, ODBEXEC *odb);

夝愢    path_no, idb.idata 偱巜掕偝傟偨幉傪丄idb.ldata 偱巜掕偟偨嵗昗偵愝掕
        偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        path_no 宯摑斣崋傪巜掕偟傑偡丅乮侾乣俇乯

        nmod    姰椆捠抦僼儔僌偺桳柍傪巜掕偟傑偡丅
                        侾丗姰椆捠抦桳傝
                        侽丗姰椆捠抦柍偟

        axis    愝掕幉悢傪巜掕偟傑偡丅乮侾乣俇乯

        idb     奺幉枅偺嵗昗忣曬傪曉偡ODBPOS峔憿懱傊偺億僀儞僞偱偡丅
                ODBPOS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbpos {
                        short   idata;          /* 幉斣崋 */
                        long    ldata;          /* 嵗昗抣 */
                } ODBPOS;

                idata   幉斣崋傪巜掕偟傑偡丅

                ldata   嵗昗抣傪巜掕偟傑偡丅
                        愝掕扨埵偼埲壓偺偲偍傝偱偡丅

                        +---------------------+---------------+
                        |                     |     IS-B      |
                        +---------------------+---------------+
                        | 捈慄幉乮儈儕弌椡乯  | 0.001  [mm]   |
                        +---------------------+---------------+
                        | 捈慄幉乮僀儞僠弌椡乯| 0.0001 [inch] |
                        +---------------------+---------------+
                        | 夞揮幉              | 0.001  [deg]  |
                        +---------------------+---------------+

        odb     奺宯摑暿幚峴忬懺忣曬傪曉偡ODBEXEC峔憿懱傊偺億僀儞僞偱偡丅
                ODBEXEC峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbexec {
                        short   dummy;          /* 枹巊梡 */
                        char    cdata[2][8];    /* 奺宯摑暿幚峴忬懺忣曬 */
                } ODBEXEC;


                cdata   尰嵼偺巜椷僶僢僼傽偺忬懺傪帵偟傑偡丅

                        7      6      5      4      3      2      1      0 bit
                    +------+------+------+------+------+------+------+------+
      cdata[0][x-1] |      |      |EMNT16|EMNT15|EMNT14|EMNT13|EMNT12|EMNT11|
                    +------+------+------+------+------+------+------+------+
      cdata[1][x-1] |      |      |EMNT26|EMNT25|EMNT24|EMNT23|EMNT22|EMNT21|
                    +------+------+------+------+------+------+------+------+
                    +------+------+---------------------------------------+
                    |EMNT2x|EMNT1x|       幚峴僶僢僼傽忬懺                |
                    +------+------+---------------------------------------+
                    |  0   |  0   |  幚峴僶僢僼傽偼嬻偱偡                 |
                    |  0   |  1   |  幚峴僶僢僼傽侾偵僨乕僞偑偁傝傑偡     |
                    |  1   |  0   |  幚峴僶僢僼傽俀偵僨乕僞偑偁傝傑偡     |
                    |  1   |  1   |  幚峴僶僢僼傽侾丄俀偵僨乕僞偑偁傝傑偡 |
                    +------+------+---------------------------------------+
                        x : 宯摑斣崋

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                --------------------------------------------------------------
                栠傝抣          堄枴乛懳張曽朄
                --------------------------------------------------------------
                EW_BUSY         價僕傿
                                俠俶俠偺張棟偑廔椆偡傞傑偱懸偮偐丄儕僩儔僀
                                偟偰偔偩偝偄丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻嵶偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅

                8003#7  僟僀儗僋僩僐儅儞僪偵傛傞儌乕僔儑儞巜椷偺桳柍
                8010    PMC偵傛傞幉惂屼偵偍偗傞奺幉偺DI/DO孲偺慖戰

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 7) 幚峴僶僢僼傽忬懺偺撉庢傝

娭悢柤  cnc_exebufstat

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_exebufstat(unsigned short FlibHndl,
                                                                ODBEXEC *odb);

夝愢    cnc_refpoint, cnc_abspoint, cnc_incpoint, cnc_dwell, cnc_coordre 摍
        偺柦椷偱巜椷偝傟偨僽儘僢僋偺僶僢僼傽偺忬懺傪捠抦偝偣傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        odb     奺宯摑暿幚峴忬懺忣曬傪曉偡ODBEXEC峔憿懱傊偺億僀儞僞偱偡丅
                ODBEXEC峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbexec {
                        short   dummy;          /* 枹巊梡 */
                        char    cdata[2][8];    /* 奺宯摑暿幚峴忬懺忣曬 */
                } ODBEXEC;

                cdata   尰嵼偺巜椷僶僢僼傽偺忬懺傪帵偟傑偡丅

                        7      6      5      4      3      2      1      0 bit
                    +------+------+------+------+------+------+------+------+
      cdata[0][x-1] |      |      |EMNT16|EMNT15|EMNT14|EMNT13|EMNT12|EMNT11|
                    +------+------+------+------+------+------+------+------+
      cdata[1][x-1] |      |      |EMNT26|EMNT25|EMNT24|EMNT23|EMNT22|EMNT21|
                    +------+------+------+------+------+------+------+------+
                    +------+------+---------------------------------------+
                    |EMNT2x|EMNT1x|       幚峴僶僢僼傽忬懺                |
                    +------+------+---------------------------------------+
                    |  0   |  0   |  幚峴僶僢僼傽偼嬻偱偡                 |
                    |  0   |  1   |  幚峴僶僢僼傽侾偵僨乕僞偑偁傝傑偡     |
                    |  1   |  0   |  幚峴僶僢僼傽俀偵僨乕僞偑偁傝傑偡     |
                    |  1   |  1   |  幚峴僶僢僼傽侾丄俀偵僨乕僞偑偁傝傑偡 |
                    +------+------+---------------------------------------+
                        x : 宯摑斣崋

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                --------------------------------------------------------------
                栠傝抣          堄枴乛懳張曽朄
                --------------------------------------------------------------
                EW_BUSY         價僕傿
                                俠俶俠偺張棟偑廔椆偡傞傑偱懸偮偐丄儕僩儔僀
                                偟偰偔偩偝偄丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻嵶偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅


                8003#7  僟僀儗僋僩僐儅儞僪偵傛傞儌乕僔儑儞巜椷偺桳柍
                8010    PMC偵傛傞幉惂屼偵偍偗傞奺幉偺DI/DO孲偺慖戰

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 8) 幚峴姰椆忬懺偺撉庢傝

娭悢柤  cnc_finstate

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_finstate(unsigned short FlibHndl,
                                                                ODBFIN *odb);

夝愢    cnc_refpoint, cnc_abspoint, cnc_incpoint, cnc_dwell, cnc_coordre 摍偺
        柦椷偱巜椷偝傟偨僽儘僢僋偺姰椆捠抦僼儔僌偺忬懺傪奺宯摑枅偵捠抦偝偣傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        odb     奺宯摑暿姰椆捠抦僼儔僌偺忬懺傪曉偡ODBFIN峔憿懱傊偺億僀儞僞偱偡丅
                ODBFIN峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbfin {
                        short   dummy;          /* 枹巊梡 */
                        char    cdata[8];       /* 奺宯摑暿姰椆捠抦僼儔僌 */
                } ODBFIN;

                cdata   尰嵼偺姰椆捠抦僼儔僌偺忬懺傪帵偟傑偡丅

                       7      6      5      4      3      2      1      0 bit
                   +------+------+------+------+------+------+------+------+
        cdata[x-1] |      |      |EMNT63|EMNT15|EMNT14|EMNT13|EMNT12|EMNT11|
                   +------+------+------+------+------+------+------+------+
                    EMNT1x : 0 : 枹姰椆
                             1 : 姰椆
                         x : 宯摑斣崋

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                --------------------------------------------------------------
                栠傝抣          堄枴乛懳張曽朄
                --------------------------------------------------------------
                EW_BUSY         價僕傿
                                俠俶俠偺張棟偑廔椆偡傞傑偱懸偮偐丄儕僩儔僀
                                偟偰偔偩偝偄丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻嵶偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅

                8003#7  僟僀儗僋僩僐儅儞僪偵傛傞儌乕僔儑儞巜椷偺桳柍
                8010    PMC偵傛傞幉惂屼偵偍偗傞奺幉偺DI/DO孲偺慖戰

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 9) 幚峴姰椆撉庢忬懺偺夝彍

娭悢柤  cnc_setfin

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_setfin(unsigned short FlibHndl, ODBFIN *idb);

夝愢    姰椆捠抦僼儔僌傪儕僙僢僩偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        odb     奺宯摑暿姰椆捠抦僼儔僌偺忬懺傪曉偡ODBFIN峔憿懱傊偺億僀儞僞偱偡丅
                ODBFIN峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbfin {
                        short   dummy;          /* 枹巊梡 */
                        char    cdata[8];       /* 奺宯摑暿姰椆捠抦僼儔僌 */
                } ODBFIN;

                cdata   儕僙僢僩偡傞姰椆捠抦僼儔僌傪巜掕偟傑偡丅

                       7      6      5      4      3      2      1      0 bit
                   +------+------+------+------+------+------+------+------+
        cdata[x-1] |      |      |EMNT63|EMNT15|EMNT14|EMNT13|EMNT12|EMNT11|
                   +------+------+------+------+------+------+------+------+
                    EMNT1x : 儕僙僢僩偡傞價僢僩傪侾偵偡傞丅
                         x : 宯摑斣崋

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                --------------------------------------------------------------
                栠傝抣          堄枴乛懳張曽朄
                --------------------------------------------------------------
                EW_BUSY         價僕傿
                                俠俶俠偺張棟偑廔椆偡傞傑偱懸偮偐丄儕僩儔僀
                                偟偰偔偩偝偄丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻嵶偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅

                8003#7  僟僀儗僋僩僐儅儞僪偵傛傞儌乕僔儑儞巜椷偺桳柍
                8010    PMC偵傛傞幉惂屼偵偍偗傞奺幉偺DI/DO孲偺慖戰

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

偦偺懠
-------------------------------------------------------------------------------
  娭悢柤                婡  擻  撪  梕
-------------------------------------------------------------------------------
  ( 1) cnc_sysinfo      俠俶俠僔僗僥儉忣曬偺儕乕僪
  ( 2) cnc_sysconfig    俠俶俠僔僗僥儉峔惉忣曬偺儕乕僪
  ( 3) cnc_statinfo     俠俶俠僗僥乕僞僗忣曬偺儕乕僪
  ( 4) cnc_alarm        傾儔乕儉僗僥乕僞僗偺儕乕僪
  ( 5) cnc_rdalminfo    傾儔乕儉忣曬偺儕乕僪
  ( 6) cnc_modal        儌乕僟儖僨乕僞偺儕乕僪
  ( 7) cnc_diagnoss     僟僀傾僌僲乕僘僨乕僞偺儕乕僪
  ( 8) cnc_diagnosr     僟僀傾僌僲乕僘僨乕僞偺儕乕僪乮斖埻巜掕乯
  ( 9) cnc_getfigure    嵟戝桳岠寘悢丄彫悢揰埲壓寘悢偺儕乕僪
  (10) cnc_rdcurrent    僒乕儃挷惍梡幚揹棳偺儕乕僪
  (11) cnc_rdsrvspeed   僒乕儃挷惍梡幚懍搙偺儕乕僪
  (12) cnc_rdloopgain   僒乕儃挷惍梡儖乕僾僎僀儞偺儕乕僪
  (13) cnc_rdopmsg      僆儁儗乕僞儊僢僙乕僕偺儕乕僪
  (14) cnc_rdopnlsgnl   僜僼僩僆儁僷僱偺弌椡怣崋僀儊乕僕偺儕乕僪
  (15) cnc_wropnlsgnl   僜僼僩僆儁僷僱偺弌椡怣崋偺儔僀僩
  (16) cnc_rdopnlgnrl   僜僼僩僆儁僷僱偺斈梡弌椡怣崋僀儊乕僕偺儕乕僪
  (17) cnc_wropnlgnrl   僜僼僩僆儁僷僱偺斈梡弌椡怣崋偺儔僀僩
  (18) cnc_rdopnlgsname 僜僼僩僆儁僷僱偺斈梡怣崋柤徧偺儕乕僪
  (19) cnc_wropnlgsname 僜僼僩僆儁僷僱偺斈梡怣崋柤徧偺愝掕
-------------------------------------------------------------------------------

  ( 1) 俠俶俠僔僗僥儉忣曬偺儕乕僪

娭悢柤  cnc_sysinfo

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_sysinfo(unsigned short FlibHndl,
                                                        ODBSYS *sysinfo);

夝愢    CNC偺僔僗僥儉僜僼僩僂僃傾偺ROM宯楍偍傛傃斉悢丄惂屼幉悢側偳偺CNC屌桳偺
        僔僗僥儉忣曬傪撉傒偩偟傑偡丅

        CNC懁偺僔僗僥儉僜僼僩僂僃傾偲PMC懁偲偺揔崌惈偺妋擣丄CNC懁偺愨懳埵抲嵗昗
        抣丄婡夿埵抲嵗昗抣側偳偺嵗昗抣僨乕僞傪撉傒弌偡帪偺幉悢偺庢摼側偳偵巊梡
        偟傑偡丅

        奺暥帤楍偺廔抂偵偼 NULL暥帤('\0')偼晅壛偝傟傑偣傫丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        sysinfo 俠俶俠僔僗僥儉忣曬傪曉偡ODBSYS峔憿懱傊偺億僀儞僞偱偡丅

                ODBSYS峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbsys {
                        short   dummy ;         /* 枹巊梡 */
                        short   max_axis ;      /* 嵟戝惂屼幉悢 */
                        char    cnc_type[2] ;   /* CNC偺庬椶 (ASCII) */
                        char    mt_type[2] ;    /* Power Mate 偺庬椶 (ASCII) */
                        char    series[4] ;     /* 宯楍斣崋 (ASCII) */
                        char    version[4] ;    /* 斉悢 (ASCII) */
                        char    axes[2] ;       /* 惂屼幉悢 (ASCII) */
                } ODBSYS ;

                max_axis        嵟戝惂屼幉悢
                                俠俶俠僔僗僥儉偵偰惂屼壜擻側嵟戝幉悢偱偡丅

                cnc_type        俠俶俠偺庬椶(ASCII)
                                'PM' : Power Mate

                mt_type         Power Mate 偺庬椶(ASCII)
                                ' D' : Power Mate-D
                                ' H' : Power Mate-H

                series          CNC僜僼僩偺宯楍斣崋(ASCII)
                                係寘偺暥帤楍傪搉偟傑偡丅

                version         CNC僜僼僩偺斉悢(ASCII)
                                係寘偺暥帤楍傪搉偟傑偡丅

                axes            惂屼幉悢(ASCII)
                                俀寘偺暥帤楍傪搉偟傑偡丅
                                係幉偺応崌丄' 4'偲側傝傑偡丅


                ODBSYS   0劇劅劅劅劅劉
                          劆dummy   劆
                         2劌劅劅劅劅劎
                          劆max_axis劆
                         4劌劅劅劅劅劎
                          劆cnc_type劆
                         6劌劅劅劅劅劎
                          劆mt_type 劆
                         8劌劅劅劅劅劏劅劅劅劉
                          劆     series     劆
                        12劌劅劅劅劅劅劅劅劅劎
                          劆    version     劆
                        16劌劅劅劅劅劍劅劅劅劊
                          劆  axes  劆
                        18劋劅劅劅劅劊

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅

        乮僄儔乕偺徻嵶偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        "PM-H (8880-14) 4幉僔僗僥儉"偵偍偄偰杮娭悢傪幚峴偡傞偲埲壓偺忣曬偑
        摼傜傟傑偡丅
                sysinfo.max_axis = 6
                sysinfo.cnc_type = "PM"
                sysinfo.mt_type  = " H"
                sysinfo.series   = "8880"
                sysinfo.version  = "0014"
                sysinfo.axes     = " 4"

  ( 2) 俠俶俠僔僗僥儉峔惉忣曬偺儕乕僪

娭悢柤  cnc_sysconfig

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_sysconfig(unsigned short FlibHndl,
                                                        ODBSYSC *sysinfo);

夝愢    俠俶俠偺僔僗僥儉峔惉忣曬傪撉傒弌偟傑偡丅
        奺庬忣曬偼ODBSYSC撪偺奺儊儞僶偵奿擺偝傟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        sysinfo 俠俶俠僔僗僥儉忣曬傪曉偡ODBSYSC峔憿懱傊偺億僀儞僞偱偡丅

                typedef struct odbsysc {
                     char    slot_no_p[16];     /* 暔棟僗儘僢僩斣崋 */
                     char    slot_no_l[16];     /* 榑棟僗儘僢僩斣崋 */
                     short   mod_id[16];        /* 儌僕儏乕儖俬俢 */
                     short   soft_id[16];       /* 僜僼僩俬俢 */
                     char    s_series[16][5];   /* 僜僼僩偺宯楍 */
                     char    s_version[16][5];  /* 僜僼僩偺斉悢 */
                     char    dummy[16];         /* 枹巊梡 */

                     short   m_rom;             /* CNC 僜僼僩偺慻傒晅偗忬懺 */
                     short   s_rom;  /* SUB CPU 偺 CNC 僜僼僩偺慻傒晅偗忬懺 */
                     char    svo_soft[8];     /* 僒乕儃偺僜僼僩偺宯楍丄斉悢 */
                     char    pmc_soft[6];      /* PMC 娗棟僜僼僩偺宯楍丄斉悢 */
                     char    lad_soft[6];       /* 儔僟乕偺宯楍丄斉悢 */
                     char    mcr_soft[8];       /* 儅僋儘僄僌僛僉儏乕僞丄
                                        僆乕僟儊乕僪儅僋儘偺宯楍丄斉悢 */
                     char    spl1_soft[6];
                                /* 僗僺儞僪儖偺僜僼僩偺宯楍丄斉悢(1戜栚) */
                     char    spl2_soft[6];
                                /* 僗僺儞僪儖偺僜僼僩偺宯楍丄斉悢(2戜栚) */
                     short   frmmin;    /* FROM儌僕儏乕儖偺梕検(MAIN) */
                     short   drmmin;    /* DRAM儌僕儏乕儖偺梕検(MAIN) */
                     short   srmmin;    /* 捛壛SRAM儌僕儏乕儖偺梕検(MAIN) */
                     short   pmcmin;    /* PMC儌僕儏乕儖偺庬椶(MAIN) */
                     short   sv1min;  /* 僒乕儃儌僕儏乕儖(1,2幉)偺桳柍(MAIN) */
                     short   sv3min;  /* 僒乕儃儌僕儏乕儖(3,4幉)偺桳柍(MAIN) */
                     short   sv5min;  /* 僒乕儃儌僕儏乕儖(5,6幉)偺桳柍(MAIN) */
                     short   sicmin;    /* SIC偺桳柍(MAIN) */
                     short   posmin;    /* POSITION LSI偺桳柍(MAIN) */
                     short   submin;    /* 僒僽儃乕僪偺忣曬 */
                     short   hdiio;   /* 崅懍僗僉僢僾梡LSI偺桳柍(I/O僇乕僪) */
                     short   dummy[32];
                } ODBSYSC ;

                slot_no_p       枹巊梡
                slot_no_l       枹巊梡

                mod_id          枹巊梡
                soft_id         僜僼僩俬俢
                                幚憰偝傟偰偄傞儌僕儏乕儖偺僜僼僩ID偑幚憰弴偵僶
                                僀僫儕偱奿擺偝傟傑偡丅偙偺攝楍偼丄FFH偵傛傝廔
                                抂偝傟偰偄傑偡丅FFH埲崀偺僨乕僞偼柍岠偱偡丅
                                        40H : CNC

                s_series        僜僼僩偺宯楍
                                幚憰偝傟偰偄傞儃乕僪偺僜僼僩偺宯楍偑幚憰弴偵
                                ASCII 僐乕僪(係僶僀僩亄NULL)偱奿擺偝傟傑偡丅
                s_version       僜僼僩偺斉悢
                                幚憰偝傟偰偄傞儃乕僪偺僜僼僩偺宯楍偑幚憰弴偵
                                ASCII 僐乕僪(係僶僀僩亄NULL)偱奿擺偝傟傑偡丅
                m_rom           枹巊梡
                s_rom           枹巊梡
                svo_soft        僒乕儃偺僜僼僩偺宯楍丄斉悢
                                ASCII僐乕僪偱奿擺偝傟傑偡丅愭摢偐傜4僶僀僩偑宯
                                楍丄巆傝偺4僶僀僩偑斉悢偱偡丅杮僜僼僩偑側偄偙偲
                                偼偁傝傑偣傫丅
                pmc_soft        PMC娗棟僜僼僩偺宯楍丄斉悢
                                ASCII僐乕僪偱奿擺偝傟傑偡丅愭摢偐傜4僶僀僩偑宯
                                楍丄巆傝偺2僶僀僩偑斉悢偱偡丅杮僜僼僩偑側偄偙偲
                                偼偁傝傑偣傫丅
                lad_soft        儔僟乕偺宯楍丄斉悢
                                ASCII僐乕僪偱奿擺偝傟傑偡丅愭摢偐傜4僶僀僩偑宯
                                楍丄巆傝偺2僶僀僩偑斉悢偱偡丅杮僜僼僩偑側偄応崌
                                6僶僀僩偲傕嬻敀(20H)偱偡丅
                mcr_soft        儅僋儘僄僌僛僉儏乕僞丄僆乕僟儊乕僪儅僋儘偺宯楍
                                斉悢
                                ASCII僐乕僪偱奿擺偝傟傑偡丅2僶僀僩栚偐傜偺4僶僀
                                僩偑宯楍丄懕偔2僶僀僩偑斉悢偱偡丅杮僜僼僩偑側偄
                                応崌丄愭摢偺僶僀僩偼0FFH(偁傞応崌偼0FFH埲奜)偱
                                偡丅嵟屻偺僶僀僩偼枹巊梡偱偡丅
                spl1_soft       枹巊梡
                spl2_soft       枹巊梡
                frmmin          FROM儌僕儏乕儖偺梕検(MAIN)
                                        -1 :  枹幚憰
                                         0 :  2 (MB)
                                         1 :  儕僓乕僽
                                         2 :  4 (MB)
                drmmin
                                DRAM儌僕儏乕儖偺梕検(MAIN)
                                        -1 : 枹幚憰
                                         0 :  2   (MB)
                                         1 :  2.5 (MB)
                                         2 :  儕僓乕僽
                                         3 :  3   (MB)
                srmmin
                                捛壛SRAM儌僕儏乕儖偺梕検(MAIN)
                                        -1 : 枹幚憰
                                         0 : 256 (KB)
                                         1 : 1   (MB)
                                         2 : 1   (MB)
                                         3 : 512 (KB)
                                         4 : 256 (KB)

                                         5 : 128 (KB)
                                         6 : 768 (KB)
                                         7 : 枹幚憰
                pmcmin          PMC儌僕儏乕儖偺庬椶(MAIN)
                                        -1 : 枹幚憰
                                         0 : PMP2+SLC
                                         1 : Bit operation module
                                         2 : PMP 儌僕儏乕儖
                                         3 : 枹幚憰
                                         4 : 儕僓乕僽
                sv1min          僒乕儃儌僕儏乕儖(1,2幉)偺桳柍(MAIN)
                                        -1 : 柍          0 : 桳
                sv3min          僒乕儃儌僕儏乕儖(3,4幉)偺桳柍(MAIN)
                                        -1 : 柍          0 : 桳
                sv5min          僒乕儃儌僕儏乕儖(5,6幉)偺桳柍(MAIN)
                                        -1 : 柍          0 : 桳
                sicmin
                                SIC偺桳柍(MAIN)
                                        -1 : 柍          0 : 桳
                posmin
                                POSITION LSI偺桳柍(MAIN)
                                        -1 : 柍          0 : 桳
                submin          僒僽儃乕僪偺忣曬
                                        -1 : 枹幚憰
                                         0 : 儕僓乕僽
                                         1 : RS485
                                         2 : 撪憼I/O儃乕僪
                                         3 : M-NET儃乕僪
                                         4 : 儕僓乕僽
                                         5 : 儕僓乕僽
                                         6 : 儕僓乕僽
                                         7 : I/O儕儞僋俀儃乕僪
                hdiio           崅懍僗僉僢僾梡LSI偺桳柍(I/O僇乕僪)
                                        -1 : 柍          0 : 桳

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 3) 俠俶俠僗僥乕僞僗忣曬偺儕乕僪

娭悢柤  cnc_statinfo

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_statinfo(unsigned short FlibHndl,
                                                        ODBST *statinfo);

夝愢    CNC偺僗僥乕僞僗忣曬傪撉傒弌偟傑偡丅奺庬忣曬偼ODBST撪偺奺儊儞僶偵奿擺偝
        傟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        statinfo
                CNC僗僥乕僞僗忣曬傪曉偡ODBST峔憿懱傊偺億僀儞僞偱偡丅

                typedef struct odbst {
                     short  dummy[2] ;    /* 枹巊梡                   */
                     short  aut ;         /* 帺摦丒庤摦塣揮儌乕僪慖戰 */
                     short  run ;         /* 帺摦塣揮忬懺             */
                     short  motion ;      /* 幉堏摦丒僪僂僃儖偺忬懺   */
                     short  mstb ;        /* M, S, T, B婡擻偺忬懺     */
                     short  emergency ;   /* 旕忢掆巭偺忬懺           */
                     short  alarm ;       /* 傾儔乕儉忬懺             */
                     short  edit ;        /* 僾儘僌儔儉曇廤忬懺       */
                } ODBST ;

                aut     帺摦丒庤摦塣揮儌乕僪慖戰
                                0 : MDI               1 : MEMory
                                2 : ****              3 : EDIT
                                4 : HaNDle            5 : JOG
                                6 : Theach in JOG     7 : Theach in HND
                                8 : INC丒feed         9 : REFerence
                               10 : ReMoTe
                run     帺摦塣揮忬懺
                                0 : **** (reset)      1 : STOP
                                2 : HOLD              4 : STaRT
                motion  幉堏摦丒僪僂僃儖偺忬懺
                                0 : ***               1 : MoTioN
                                3 : DWeLl
                mstb            M,S,T,B婡擻偺忬懺
                                0 : *** 乮偦偺懠乯    1 : FIN
                emergency
                        旕忢掆巭偺忬懺
                                0 : (旕忢掆巭夝彍)    1 : EMerGency
                                2 : ReSET
                alarm   傾儔乕儉忬懺
                                0 : *** (偦偺懠)      1 : ALarM
                                2 : BATtery low
                edit    僾儘僌儔儉曇廤忬懺
                                0 : **** (柍曇廤)     1 : EDIT
                                2 : SeaRCH            3 : OUTPUT

                                4 : INPUT             5 : COMPARE
                                6 : Label SKip        7 : OFfSeT
                                8 : Work ShiFT        9 : ReSTaRt

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅

        乮僄儔乕偺徻嵶偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 4) 傾儔乕儉僗僥乕僞僗偺儕乕僪

娭悢柤  cnc_alarm

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_alarm(unsigned short FlibHndl,
                                                                ODBALM *alarm);

夝愢    CNC懁偑傾儔乕儉忬懺偵側偭偰偄傞帪丄偦偺撪梕傪撉傒偩偟傑偡丅奺庬忣曬偼
        ODBALM撪偺data偵奿擺偝傟傑偡丅

        傾僾儕働乕僔儑儞僾儘僌儔儉偱CNC懁偺傾儔乕儉忬懺傪娔帇偟丄曐庣忣曬偺
        昞帵傗夝彍偺庤弴偺僈僀僟儞僗偺昞帵側偳偵巊梡偟傑偡丅

        CNC 偑僔僗僥儉傾儔乕儉偺応崌偼丄PC - CNC 娫偺僨乕僞偺傗傝庢傝偼堦愗晄
        壜擻側偨傔丄傾儔乕儉僗僥乕僞僗偺妉摼偼峴偊傑偣傫丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        alarm   傾儔乕儉僗僥乕僞僗忣曬傪曉偡ODBALM峔憿懱傊偺億僀儞僞偱偡丅
                ODBALM峔憿懱偼師偺捠傝偱偡丅

                typedef struct odbalm {
                     short  dummy[2] ;          /* 枹巊梡 */
                     short  data ;              /* 傾儔乕儉僗僥乕僞僗 */
                } ODBALM ;

                dummy           枹巊梡

                data            傾儔乕儉僗僥乕僞僗
                                奺價僢僩偺堄枴偼師偺捠傝偱偡丅
                                #00 : P/S100
                                #01 : P/S000
                                #02 : P/S101
                                #03 : P/S偦偺懠
                                #04 : 僆乕僶僩儔儀儖傾儔乕儉
                                #05 : 僆乕僶僸乕僩傾儔乕儉
                                #06 : 僒乕儃傾儔乕儉
                                #07 : (枹巊梡)
                                #08 : APC傾儔乕儉
                                #09 : (枹巊梡)
                                #10 : P/S5000斣戜
                                #11 : (枹巊梡)
                                #12 : (枹巊梡)
                                #13 : (枹巊梡)
                                #14 : (枹巊梡)
                                #15 : 奜晹傾儔乕儉儊僢僙乕僕

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯


CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼敪惗拞偺傾儔乕儉偺庬椶傪昞帵偟傑偡丅

#include <stdio.h>
#include "apilib.h"
void example( void )
{
        char *almmsg[] = {
                "P/S 100 ALARM","P/S 000 ALARM",
                "P/S 101 ALARM","P/S ALARM (1-255)",
                "OT ALARM",     "OH ALARM",
                "SERVO ALARM",  "unknown ALARM",
                "APC ALARM",    "SPINDLE ALARM",
                "P/S ALARM (5000-)"
        } ;
        ODBALM buf ;
        unsigned short idx ;
        cnc_alarm( FlibHndl, &buf ) ;
        if ( buf.data == 0 )
                printf( "NO ALARM\n" ) ;
        else
                for ( idx = 0 ; idx < 11 ; idx++ ) {
                        if ( buf.data & 0x0001 )
                                printf( "%s\n", almmsg[idx] ) ;
                        buf.data >>= 1 ;
                }
}

  ( 5) 傾儔乕儉忣曬偺儕乕僪

娭悢柤  cnc_rdalminfo


愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdalminfo(unsigned short FlibHndl,
                short type, short alm_type, short length, ALMINFO *alarminfo);

夝愢    CNC懁偱敪惗偟偰偄傞傾儔乕儉偺徻嵶側忣曬傪撉傒偩偟傑偡丅奺庬忣曬偼
        ALMINFO撪偺data偵奿擺偝傟傑偡丅

        傾僾儕働乕僔儑儞僾儘僌儔儉偱敪惗拞偺傾儔乕儉斣崋傗傾儔乕儉儊僢僙乕僕
        傪昞帵偡傞応崌側偳偵巊梡偟傑偡丅

        CNC 偑僔僗僥儉傾儔乕儉偺応崌偼丄PC - CNC 娫偺僨乕僞偺傗傝庢傝偼堦愗晄
        壜擻側偨傔丄傾儔乕儉忣曬偺妉摼偼峴偊傑偣傫丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        type    弌椡僼僅乕儅僢僩偺僞僀僾傪巜掕偟傑偡丅
                        0 : 傾儔乕儉忣曬 1 (儊僢僙乕僕側偟)
                        1 : 傾儔乕儉忣曬 2 (儊僢僙乕僕偁傝)

        alm_type
                傾儔乕儉偺庬椶傪巜掕偟傑偡丅
                奺價僢僩偺堄枴偼師偺捠傝偱偡丅
                                #00 : P/S100
                                #01 : P/S000
                                #02 : P/S101
                                #03 : P/S偦偺懠
                                #04 : 僆乕僶僩儔儀儖
                                #05 : 僆乕僶僸乕僩
                                #06 : 僒乕儃傾儔乕儉
                                #07 : (枹巊梡)
                                #08 : APC傾儔乕儉
                                #09 : (枹巊梡)
                                #10 : P/S5000斣戜
                                #11 : (枹巊梡)
                                #12 : (枹巊梡)
                                #13 : (枹巊梡)
                                #14 : (枹巊梡)
                                #15 : 奜晹傾儔乕儉儊僢僙乕僕

        length  僨乕僞僽儘僢僋挿乮ALMINFO峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅

                u.alm1           0劇劅劅劅劅劅劅劅劅劅劅劅劉 劅
                                  劆       alm[0]         劆 仾
                                 4劌劅劅劅劅劅劅劅劅劅劅劅劎 劆
                                  乣                      乣 劆
                           4*(N-1)劌劅劅劅劅劅劅劅劅劅劅劅劎length
                                  劆       alm[N-1]       劆 劆

                               4*N劌劅劅劅劅劅劅劅劅劅劅劅劎 劆
                                  劆       data_end       劆 伀
                             4*N+2劋劅劅劅劅劅劅劅劅劅劅劅劊 劅

                        u.alm1.alm       0劇劅劅劅劅劅劅劅劅劅劅劅劉
                                          劆         axis         劆
                                         2劌劅劅劅劅劅劅劅劅劅劅劅劎
                                          劆        alm_no        劆
                                         4劋劅劅劅劅劅劅劅劅劅劅劅劊

                u.alm2           0劇劅劅劅劅劅劅劅劅劅劅劅劉 劅
                                  劆       alm[0]         劆 仾
                                38劌劅劅劅劅劅劅劅劅劅劅劅劎 劆
                                  乣                      乣 劆
                          38*(N-1)劌劅劅劅劅劅劅劅劅劅劅劅劎length
                                  劆       alm[N-1]       劆 劆
                              38*N劌劅劅劅劅劅劅劅劅劅劅劅劎 劆
                                  劆       data_end       劆 伀
                            38*N+2劋劅劅劅劅劅劅劅劅劅劅劅劊 劅

                        u.alm2.alm       0劇劅劅劅劅劅劅劅劅劅劅劅劉
                                          劆         axis         劆
                                         2劌劅劅劅劅劅劅劅劅劅劅劅劎
                                          劆        alm_no        劆
                                         4劌劅劅劅劅劅劅劅劅劅劅劅劎
                                          劆        msg_len       劆
                                         6劌劅劅劅劅劅劍劅劅劅劅劅劊
                                          劆alm_msg[0]劆
                                         7劌劅劅劅劅劅劎
                                          乣          乣
                                        37劌劅劅劅劅劅劎
                                          劆alm_msg[31]
                                        38劋劅劅劅劅劅劊

                N 偼撉傒弌偡傾儔乕儉忣曬偺屄悢偱偡丅

        alarminfo
                傾儔乕儉忣曬傪曉偡ALMINFO峔憿懱傊偺億僀儞僞偱偡丅
                ALMINFO峔憿懱偼師偺捠傝偱偡丅

                typedef struct alminfo {
                     union {
                        struct {
                            struct {
                                short axis ;            ;/* 幉忣曬 */
                                short alm_no ;          ;/* 傾儔乕儉斣崋 */
                            } alm[N] ;
                            short data_end ;            ;/* 僨乕僞僄儞僪 */
                        } alm1 ;
                        struct {
                            struct {
                                short axis ;            ;/* 幉忣曬 */
                                short alm_no ;          ;/* 傾儔乕儉斣崋 */
                                short msg_len ;         ;/* 儊僢僙乕僕暥帤悢 */
                                char alm_msg[32] ;    ;/* 傾儔乕儉儊僢僙乕僕 */

                            } alm[N] ;
                            short data_end ;            ;/* 僨乕僞僄儞僪 */
                        }alm2 ;
                    } u ;
                } ALMINFO ;     /*  N : 撉傒弌偡傾儔乕儉忣曬偺屄悢 */

                axis            幉忣曬偑僙僢僩偝傟傑偡丅
                                0      : 幉宍偱側偄
                                1乣m   : 幉宍(m : 嵟戝惂屼幉悢)

                alarm_no        傾儔乕儉斣崋(僶僀僫儕)偑僙僢僩偝傟傑偡丅

                msg_len         儊僢僙乕僕暥帤悢(僶僀僫儕)偑僙僢僩偝傟傑偡丅
                                ( 1 乣 32 )

                alm_msg         傾儔乕儉儊僢僙乕僕暥帤楍(ASCII)偑僙僢僩偝傟傑偡

                data_end        僨乕僞僄儞僪偑僙僢僩偝傟傑偡丅
                                忢偵0FFFFH偑僙僢僩偝傟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ALMINFO峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                弌椡僼僅乕儅僢僩偺僞僀僾(type)偑晄揔愗偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                傾儔乕儉庬椶(alm_type)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 6) 儌乕僟儖僨乕僞偺儕乕僪

娭悢柤  cnc_modal

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_modal(unsigned short FlibHndl, short type,
                                                short block, ODBMDL *modal);

夝愢    CNC懁偺儌乕僟儖忣曬傪撉傒弌偟傑偡丅奺庬忣曬偼ODBMDL撪偺奺儊儞僶偵奿擺
        偝傟傑偡丅

        撉傒偩偡偙偲偺偱偒傞儌乕僟儖僨乕僞偼儌乕僟儖G僐乕僪偺抣傗 M 傑偨偼 F
        側偳偺巜椷抣偱偡丅

        儌乕僟儖僨乕僞偺庬暿(type)偵傛傝丄僨乕僞傪奿擺偡傞嫟梡懱偺僞僀僾偑曄壔
        偟傑偡偺偱丄儕乕僪寢壥偵傾僋僙僗偡傞応崌偼庬暿偵墳偠偨嫟梡懱傪巊梡偟偰
        壓偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        type    儌乕僟儖僨乕僞偺庬椶傪巜掕偟傑偡丅(徻偟偔偼屻弎)
                        -3 : G 僐乕僪埲奜偺幉僨乕僞堦妵撉傒弌偟
                        -2 : G 僐乕僪埲奜偺堦妵撉傒弌偟
                        -1 : G 僐乕僪偺堦妵撉傒弌偟
                          0 乣  20 : G 僐乕僪偺屄暿撉傒弌偟
                        100 乣 126 : G 僐乕僪埲奜偺屄暿撉傒弌偟
                        200 乣 205 : G 僐乕僪埲奜偺幉僨乕僞屄暿撉傒弌偟

        block   撉傒弌偡懳徾偲側傞僽儘僢僋傪巜掕偟傑偡丅
                        0 : 尰嵼幚峴拞偺僽儘僢僋
                        1 : 師偺僽儘僢僋
                        2 : 師偺師偺僽儘僢僋

        modal   儌乕僟儖僨乕僞傪曉偡ODBMDL峔憿懱傊偺億僀儞僞偱偡丅
                ODBMDL峔憿懱偼師偺捠傝偱偡丅

                typedef struct odbmdl {
                     short datano;              /* 僨乕僞偺庬椶 */
                     short type;                /* 巜椷偝傟偨僽儘僢僋 */
                     union {
                          char  g_data;         /* G 僐乕僪偺儌乕僟儖僨乕僞 */
                          char  g_rdata[21];    /* G 僐乕僪偺儌乕僟儖僨乕僞 */
                          struct {
                                long    aux_data;
                                        /* G 僐乕僪埲奜偺儌乕僟儖僨乕僞 */
                                char    flag1;  /* 僼儔僌 1 */
                                char    flag2;  /* 僼儔僌 2 */
                          }aux;
                          struct {
                                long    aux_data;
                                        /* G 僐乕僪埲奜偺儌乕僟儖僨乕僞 */

                                char    flag1;  /* 僼儔僌 1 */
                                char    flag2;  /* 僼儔僌 2 */
                          }raux1[27];
                          struct {
                                long    aux_data;
                                        /* G 僐乕僪埲奜偺儌乕僟儖僨乕僞 */
                                char    flag1;  /* 僼儔僌 1 */
                                char    flag2;  /* 僼儔僌 2 */
                          }raux2[MAX_AXIS];     /* MAX_AXIS : 嵟戝惂屼幉悢 */
                     }modal;
                } ODBMDL ;

                datano          儌乕僟儖僨乕僞偺庬椶偑僙僢僩偝傟傑偡丅

                type            撉傒弌偡懳徾偲側傞僽儘僢僋偑僙僢僩偝傟傑偡丅

                g_data          G 僐乕僪偺屄暿撉傒弌偟偺応崌偵巊梡偟傑偡丅
                                懳墳偡傞G僐乕僪僌儖乕僾撪偺儌乕僟儖G僐乕僪偑撉
                                傒偩偝傟傑偡丅

                g_rdata         G 僐乕僪偺堦妵撉傒弌偟偺応崌偵巊梡偟傑偡丅
                                偡傋偰偺G僐乕僪僌儖乕僾撪偺儌乕僟儖G僐乕僪偑撉
                                傒偩偝傟傑偡丅

                aux             G 僐乕僪埲奜(幉僨乕僞娷傓)偺屄暿撉傒弌偟偺応崌
                                偵巊梡偟傑偡丅

                raux1           G 僐乕僪埲奜偺堦妵撉傒弌偟偺応崌偵巊梡偟傑偡丅

                raux2           G 僐乕僪埲奜偺幉僨乕僞堦妵撉傒弌偟偺応崌偵巊梡
                                偟傑偡丅

                aux_data        G 僐乕僪埲奜偺儌乕僟儖僨乕僞偑僙僢僩偝傟傑偡丅

                flag1           曗彆忣曬偑僙僢僩偝傟傑偡丅

                flag2           曗彆忣曬偑僙僢僩偝傟傑偡丅

        (1) 儌乕僟儖G僐乕僪偺撉傒偩偟

                type 偵偼 0乣20 傑偱偺G僐乕僪僌儖乕僾傪巜掕偟傑偡丅

                -------+-------+---------------+
                type    g_data  G僐乕僪
                -------+-------+---------------+
                0       0       G00
                        1       G01
                        2       G02
                        3       G03
                -------+-------+---------------+
                1       0       G17
                        4       G19
                        8       G18
                -------+-------+---------------+
                2       0       G90

                        1       G91
                -------+-------+---------------+
                4       0       G94
                        1       G95
                -------+-------+---------------+
                5       0       G20
                        1       G21
                -------+-------+---------------+
                7       0       G49
                        1       G43
                        2       G44
                -------+-------+---------------+
                11      0       G67
                        1       G66
                -------+-------+---------------+
                20      0       G13.1
                        1       G12.1
                -------+-------+---------------+

        g_data 偺戞0乣6價僢僩偵偼忋偺昞偺 g_data 棑偺悢抣偑僶僀僫儕宍幃偱奿擺偝
        傟傑偡丅g_data 偺戞7價僢僩偵偼 block 偱巜掕偟偨撉傒偩偟懳徾僽儘僢僋撪偱
        偙偺G僐乕僪偑巜椷偝傟偰偄傞偐偳偆偐偑奿擺偝傟傑偡丅

                     7   6   5   4   3   2   1   0
                  劇劅劍劅劍劅劍劅劍劅劍劅劍劅劍劅劉
                劇劑丒劆   奺僌儖乕僾撪偺僐乕僪   劆 侾僶僀僩
                劆劋劅劏劅劏劅劏劅劏劅劏劅劏劅劏劅劊
                劋劅劍劅劅仺  0 : 尰嵼偺僽儘僢僋偱巜椷偝傟偰偄側偄
                    劋劅劅仺  1 : 尰嵼偺僽儘僢僋偱巜椷偝傟偰偄傞

        椺偊偽丄師偺壛岺僾儘僌儔儉偺 N100 偺僽儘僢僋幚峴拞偵杮娭悢傪幚峴偟偨
        寢壥偼埲壓偺傛偆偵側傝傑偡丅

                N090 G18 ;
                N100 G1 Z100. ;
                N110 G17 G2 X10. Y-20. R12. ;

                type    block   g_data          儌乕僟儖忬懺
                -------+-------+---------------+---------------------
                0       0       0x81            G1偑巜椷偝傟偰偄傞
                0       1       0x82            G2偑巜椷偝傟偰偄傞
                1       0       0x08            G18儌乕僪(巜椷側偟)
                1       1       0x80            G17偑巜椷偝傟偰偄傞

        G僐乕僪偵娭偡傞偡傋偰偺 type 傪堦搙偵撉傒弌偡偵偼丄-1 傪巜掕偟傑偡丅
        g_rdata 偵 g_data 偺攝楍偑僙僢僩偝傟傑偡丅

        (2) G僐乕僪埲奜偺儌乕僟儖僨乕僞偺撉傒偩偟

                type    巜椷傾僪儗僗
                -------+------------------------
                100     B
                101     D
                102     E
                103     F

                104     H
                105     L
                106     M
                107     S
                108     T
                109     R
                110     P
                111     Q
                112     A
                113     C
                114     I
                115     J
                116     K
                117     N
                118     O
                119     U
                120     V
                121     W
                122     X
                123     Y
                124     Z
                125     M2
                126     M3
                -------+------------------------
                200     戞 1 幉
                201     戞 2 幉
                202     戞 3 幉
                203     戞 4 幉
                204     戞 5 幉
                205     戞 6 幉
                -------+------------------------

        100斣戜偺 type 傪堦搙偵撉傒弌偡偵偼丄-2 傪巜掕偟傑偡丅
        raux1 偺攝楍偵僨乕僞偑僙僢僩偝傟傑偡丅
        200斣戜偺 type 傪堦搙偵撉傒弌偡偵偼丄-3 傪巜掕偟傑偡丅
        raux2 偺攝楍偵僨乕僞偑僙僢僩偝傟傑偡丅

              劇劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劉
              劆            僨乕僞            劆 : 4 僶僀僩
              劌劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劎
          劇劅劆            FLAG1             劆 : 1 僶僀僩
          劆  劌劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劎
        劇劑劅劆            FLAG2             劆 : 1 僶僀僩
        劆劆  劋劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劊
        劆劆     7   6   5   4   3   2   1   0
        劆劆  劇劅劍劅劍劅劍劅劍劅劍劅劍劅劍劅劉
        劆劋仺劆  劆  劆  劆亅劆   擖椡寘悢   劆
        劆    劋劅劏劅劏劅劏劅劏劅劏劅劏劅劏劅劊
        劆      劆  劆  劌劅仺 0 : 惓
        劆      劆  劆  劋劅仺 1 : 晧
        劆      劆  劌劅劅劅仺 0 : 彫悢揰巜椷側偟
        劆      劆  劋劅劅劅仺 1 :     乂    偁傝
        劆      劌劅劅劅劅劅仺 0 : 尰嵼偺僽儘僢僋偵巜椷側偟
        劆      劋劅劅劅劅劅仺 1 :         乂         偁傝
        劆    劇劅劍劅劍劅劍劅劍劅劍劅劍劅劍劅劉

        劋劅仺劆亅劆亅劆亅劆亅劆亅劆彫悢揰埲壓寘悢
              劋劅劏劅劏劅劏劅劏劅劏劅劏劅劏劅劊
        仸  FLAG1偺彫悢揰巜椷偁傝乛側偟丄偍傛傃FLAG2偺彫悢揰埲壓寘悢偼F僐乕僪
            偺偲偒偺傒桳岠偱偡丅側偍丄彫悢揰巜椷側偟偱傕彫悢揰埲壓寘悢偼亀侽亁
            偱側偄応崌偑偁傝傑偡丅
        仸  巜椷傾僪儗僗偺 M 偺擖椡寘悢偼丄僷儔儊乕僞偱愝掕偟偨嫋梕寘悢偑曉偝
            傟傑偡丅
                M 僷儔儊乕僞No.3030     M 僐乕僪偺嫋梕寘悢

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_NUMBER       僨乕僞斣崋偺岆傝
                                儌乕僟儖僨乕僞偺庬椶(type)偺巜掕偑晄揔愗偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                僽儘僢僋偺巜掕(block)偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 7) 僟僀傾僌僲乕僘僨乕僞偺儕乕僪

娭悢柤  cnc_diagnoss

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_diagnoss(unsigned short FlibHndl,
                        short number, short axis, short length, ODBDGN *diag);

夝愢    number偱巜掕偝傟偨斣崋丄axis偱巜掕偝傟偨幉乮幉宆偺僟僀傾僌僲乕僘僨乕僞
        偺傒乯偺僟僀傾僌僲乕僘僨乕僞傪撉傒弌偟傑偡丅
        僨乕僞宍幃偼奺僟僀傾僌僲乕僘僨乕僞偵傛傝傑偡偑丄僶僀僩/儚乕僪/俀儚乕僪
        宍偺僟僀傾僌僲乕僘僨乕僞偼堦斒偵晞崋晅偺僶僀僫儕宍幃偱偡丅

        axis偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝慡幉偺撉傒庢傝傪堦搙偵峴偆偙偲偑偱
        偒傑偡丅偦偺嵺丄奺幉偺僟僀傾僌僲乕僘僨乕僞偼 ODBDGN撪偺奺攝楍偵奿擺偝
        傟傑偡丅

        僟僀傾僌僲乕僘僨乕僞偵偼宆偲幉偺懏惈偵傛傝埲壓偺傛偆側庬椶偑偁傝丄僟僀
        傾僌僲乕僘僨乕僞斣崋偛偲偵堎側傝傑偡丅

        僟僀傾僌僲乕僘僨乕僞偺庬椶 栚揑                            僶僀僩僒僀僘
        --------------------------+-------------------------------+------------
        價僢僩宍僨乕僞             1價僢僩偛偲偵堄枴傪帩偮         1
        價僢僩幉宍僨乕僞           1價僢僩偛偲偵堄枴傪帩偮(幉枅)   1
        僶僀僩宍僨乕僞             1僶僀僩挿偺僨乕僞傪婰壇         1
        僶僀僩幉宍僨乕僞           1僶僀僩挿偺僨乕僞傪婰壇(幉枅)   1
        儚乕僪宍僨乕僞             2僶僀僩挿偺僨乕僞傪婰壇         2
        儚乕僪幉宍僨乕僞           2僶僀僩挿偺僨乕僞傪婰壇(幉枅)   2
        俀儚乕僪宍僨乕僞           4僶僀僩挿偺僨乕僞傪婰壇         4
        俀儚乕僪幉宍僨乕僞         4僶僀僩挿偺僨乕僞傪婰壇(幉枅)   4

        偨偩偟丄價僢僩宍僟僀傾僌僲乕僘僨乕僞傪 1價僢僩扨埵偱撉傒偩偡偙偲偼偱偒
        傑偣傫丅摨堦偺僟僀傾僌僲乕僘僨乕僞斣崋偵懏偡傞8價僢僩(偮傑傝1僶僀僩)扨
        埵偱堦搙偵撉傒偩偡偙偲偵側傝傑偡丅

        奺僟僀傾僌僲乕僘僨乕僞偺徻嵶偵偮偄偰偼 CNC偺曐庣愢柧彂傪嶲徠偟偰偔偩偝
        偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        number  儕乕僪偡傞僟僀傾僌僲乕僘僨乕僞斣崋傪巜掕偟傑偡丅
                巜掕壜擻側僟僀傾僌僲乕僘僨乕僞斣崋偼 CNC偺曐庣愢柧彂傪嶲徠偟偰
                偔偩偝偄丅

        axis    儕乕僪偡傞幉斣崋傪巜掕偟傑偡丅
                    0      : 幉宍偱側偄僟僀傾僌僲乕僘僨乕僞
                    1乣m   : 幉宍僟僀傾僌僲乕僘僨乕僞偺侾幉巜掕
                                                            (m : 嵟戝惂屼幉悢)
                  ALL_AXES : 幉宍僟僀傾僌僲乕僘僨乕僞偺慡幉巜掕(ALL_AXES : -1)

        length  僨乕僞僽儘僢僋挿乮ODBDGN峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅
                  丒4+(僟僀傾僌僲乕僘僨乕僞偺僶僀僩僒僀僘)*(撉傒偩偡幉悢)


                壓恾偼僟僀傾僌僲乕僘僨乕僞偺僒僀僘偑 4僶僀僩偺応崌偱偡丅
                僟僀傾僌僲乕僘僨乕僞偺僒僀僘偑 1,2僶僀僩偺応崌偼丄1屄(1幉)偁偨
                傝偺僨乕僞晹偺僒僀僘偑偦傟偧傟 1,2僶僀僩偵側傝傑偡丅

                           幉側偟/堦幉巜掕                    慡幉巜掕
                ODBDGN  0劇劅劅劅劉         劅          0劇劅劅劅劉        劅
                         劆datano劆         仾           劆datano劆        仾
                        2劌劅劅劅劎         劆          2劌劅劅劅劎        劆
                         劆type  劆       length         劆type  劆      length
                        4劌劅劅劅劏劅劅劅劉 劆          4劌劅劅劅劏劅劅劅劉劆
                         劆    ldata     劆 伀           劆ldatas[0]  :1幉 劆
                        8劋劅劅劅劅劅劅劅劊 劅          8劌劅劅劅劅劅劅劅劎劆
                                                         乣              乣劆
                                                4+2x(n-1)劌劅劅劅劅劅劅劅劎劆
                                                         劆ldatas[n-1]:n幉 伀
                                                    4+2xn劋劅劅劅劅劅劅劅劊劅

                n 偼丄惂屼幉悢偲側傝傑偡丅

        diag    僟僀傾僌僲乕僘僨乕僞傪曉偡ODBDGN峔憿懱傊偺億僀儞僞偱偡丅
                ODBDGN峔憿懱偼師偺捠傝偱偡丅
                typedef struct  iodbpsd {
                    short datano;              /* 僟僀傾僌僲乕僘僨乕僞斣崋 */
                    short type;                /* 幉斣崋 */
                    union {
                        char cdata;            /* 價僢僩/僶僀僩宍僨乕僞 */
                        short idata;           /* 儚乕僪宍僨乕僞 */
                        long ldata;            /* 俀儚乕僪宍僨乕僞 */
                        char cdatas[MAX_AXIS]; /* 價僢僩/僶僀僩幉宍僨乕僞 */
                        short idatas[MAX_AXIS];/* 儚乕僪幉宍僨乕僞 */
                        long ldatas[MAX_AXIS]; /* 俀儚乕僪幉宍僨乕僞 */
                    } u ;
                } ODBDGN ;              /* MAX_AXIS : 嵟戝惂屼幉悢 */

                datano  儕乕僪偟偨僟僀傾僌僲乕僘僨乕僞斣崋偑奿擺偝傟傑偡丅

                type    儕乕僪偟偨僟僀傾僌僲乕僘僨乕僞偺懏惈偑奿擺偝傟傑偡丅
                        幉斣崋
                            0      : 幉宍偱側偄僟僀傾僌僲乕僘僨乕僞
                            1乣m   : 幉宍僟僀傾僌僲乕僘僨乕僞偺侾幉巜掕
                                     (m : 嵟戝惂屼幉悢)
                          ALL_AXES : 幉宍僟僀傾僌僲乕僘僨乕僞偺慡幉巜掕
                                     (ALL_AXES : -1)

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                ODBDGN峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝

                                僟僀傾僌僲乕僘僨乕僞斣崋(number)偺巜掕偑晄揔愗
                                偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(axis)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 8) 僟僀傾僌僲乕僘僨乕僞偺儕乕僪乮斖埻巜掕乯

娭悢柤  cnc_diagnosr


愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_diagnosr(unsigned short FlibHndl,
                                  short *s_number, short axis, short *e_number,
                                                    short *length, void *diag);

夝愢    s_number,e_number偱巜掕偝傟偨斖埻偺 axis偱巜掕偝傟偨幉乮幉宆偺僟僀傾僌
        僲乕僘僨乕僞偺傒乯偺僟僀傾僌僲乕僘僨乕僞傪撉傒弌偟傑偡丅
        僨乕僞宍幃偼奺僟僀傾僌僲乕僘僨乕僞偵傛傝傑偡偑丄僶僀僩/儚乕僪/俀儚乕僪
        宍偺僟僀傾僌僲乕僘僨乕僞偼堦斒偵晞崋晅偺僶僀僫儕宍幃偱偡丅

        axis偵 ALL_AXES 傪巜掕偡傞偙偲偵傛傝丄巜掕偝傟偨斖埻偺幉宍僟僀傾僌僲乕
        僘僨乕僞偼慡幉偺撉傒庢傝偑峴傢傟傑偡丅

        僟僀傾僌僲乕僘僨乕僞偵偼宆偲幉偺懏惈偵傛傝埲壓偺傛偆側庬椶偑偁傝丄僟僀
        傾僌僲乕僘僨乕僞斣崋偛偲偵堎側傝傑偡丅

        僟僀傾僌僲乕僘僨乕僞偺庬椶 栚揑                            僶僀僩僒僀僘
        --------------------------+-------------------------------+------------
        價僢僩宍僨乕僞             1價僢僩偛偲偵堄枴傪帩偮         1
        價僢僩幉宍僨乕僞           1價僢僩偛偲偵堄枴傪帩偮(幉枅)   1
        僶僀僩宍僨乕僞             1僶僀僩挿偺僨乕僞傪婰壇         1
        僶僀僩幉宍僨乕僞           1僶僀僩挿偺僨乕僞傪婰壇(幉枅)   1
        儚乕僪宍僨乕僞             2僶僀僩挿偺僨乕僞傪婰壇         2
        儚乕僪幉宍僨乕僞           2僶僀僩挿偺僨乕僞傪婰壇(幉枅)   2
        俀儚乕僪宍僨乕僞           4僶僀僩挿偺僨乕僞傪婰壇         4
        俀儚乕僪幉宍僨乕僞         4僶僀僩挿偺僨乕僞傪婰壇(幉枅)   4

        偨偩偟丄價僢僩宍僟僀傾僌僲乕僘僨乕僞傪 1價僢僩扨埵偱撉傒偩偡偙偲偼偱偒
        傑偣傫丅摨堦偺僟僀傾僌僲乕僘僨乕僞斣崋偵懏偡傞8價僢僩(偮傑傝1僶僀僩)扨
        埵偱堦搙偵撉傒偩偡偙偲偵側傝傑偡丅

        奺僟僀傾僌僲乕僘僨乕僞偺徻嵶偵偮偄偰偼 CNC偺曐庣愢柧彂傪嶲徠偟偰偔偩偝
        偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        s_number
                儕乕僪傪奐巒偡傞僟僀傾僌僲乕僘僨乕僞斣崋傪巜掕偟傑偡丅
                娭悢偐傜偼丄幚嵺偵儕乕僪偝傟偨嵟弶偺僟僀傾僌僲乕僘僨乕僞斣崋偑
                曉傝傑偡丅

                巜掕壜擻側僟僀傾僌僲乕僘僨乕僞斣崋偼 CNC偺曐庣愢柧彂傪嶲徠偟偰
                偔偩偝偄丅

        e_number
                儕乕僪傪廔椆偡傞僟僀傾僌僲乕僘僨乕僞斣崋傪巜掕偟傑偡丅

                娭悢偐傜偼丄幚嵺偵儕乕僪偝傟偨嵟屻偺僟僀傾僌僲乕僘僨乕僞斣崋偑
                曉傝傑偡丅

                側偍丄CNC 懁僜僼僩偺婡擻捛壛側偳偵敽偄丄僟僀傾僌僲乕僘僨乕僞傕
                捛壛偝傟傞偙偲偑偁傝傑偡丅撉傒弌偡斖埻撪偵僟僀傾僌僲乕僘僨乕僞
                偑捛壛偝傟偨応崌丄僄儔乕偵側偭偨傝(栠傝抣:EW_LENGTH)丄傾僾儕働
                乕僔儑儞僾儘僌儔儉偺張棟偑惓偟偔幚峴偱偒側偔側傞壜擻惈偑偁傝傑
                偡丅偙偺傛偆側偙偲傪旔偗傞偨傔偵丄僟僀傾僌僲乕僘僨乕僞斣崋偑楢
                懕偟偰偄傞晹暘偺傒傪傑偲傔偰撉傒弌偟斖埻偵巜掕偡傞傛偆偵偟偰偔
                偩偝偄丅

        axis    儕乕僪偡傞幉斣崋傪巜掕偟傑偡丅
                    0      : 幉宍偱側偄僟僀傾僌僲乕僘僨乕僞
                    1乣m   : 幉宍僟僀傾僌僲乕僘僨乕僞偺侾幉巜掕
                                                            (m : 嵟戝惂屼幉悢)
                  ALL_AXES : 幉宍僟僀傾僌僲乕僘僨乕僞偺慡幉巜掕(ALL_AXES : -1)

                側偍丄axis偵壗傪巜掕偟偰傕幉宍偱側偄僟僀傾僌僲乕僘僨乕僞偼撉傒
                弌偝傟傑偡偑丄巜掕斖埻撪偵幉宍偺僟僀傾僌僲乕僘僨乕僞偑懚嵼偡傞
                帪丄axis=0傪巜掕偡傞偲僄儔乕偲側傝傑偡(栠傝抣:EW_ATTRIB)丅

        length  巜掕偟偨斖埻偺僟僀傾僌僲乕僘僨乕僞傪奿擺偡傞偺偵昁梫側僨乕僞僽
                儘僢僋挿傪巜掕偟傑偡丅
                僟僀傾僌僲乕僘僨乕僞侾屄偁偨傝偼壓恾偺傛偆偵側傝丄偦傟偑僟僀傾
                僌僲乕僘僨乕僞斣崋弴(徃弴)偵巜掕偝傟偨屄悢暘暲傃傑偡偺偱丄巜掕
                偡傞length偼偦傟傜偺崌寁偵側傝傑偡丅
                  丒[4+(奺僟僀傾僌僲乕僘僨乕僞偺僶僀僩僒僀僘)*(撉傒偩偡幉悢)]
                    偺崌寁

                娭悢偐傜偼丄幚嵺偵儕乕僪偟偨僒僀僘偑曉傝傑偡偺偱挿傔偵巜掕偡傞
                偙偲偑偱偒傑偡丅

                壓恾偼僟僀傾僌僲乕僘僨乕僞偺僒僀僘偑 1僶僀僩偺応崌偱偡丅
                僟僀傾僌僲乕僘僨乕僞偺僒僀僘偑 1僶僀僩偱 1屄偁偨傝偺length偑婏
                悢僶僀僩偵側傞応崌偼丄嵟屻偵僟儈乕椞堟偑昁梫偱偡丅
                僟僀傾僌僲乕僘僨乕僞偺僒僀僘偑 2,4僶僀僩偺応崌偼丄1屄(1幉)偁偨
                傝偺僒僀僘偑偦傟偧傟 2,4僶僀僩偵側傝傑偡偺偱僟儈乕椞堟偼晄梫偱
                偡丅

                           幉側偟/堦幉巜掕                    慡幉巜掕
                ODBDGN   0劇劅劅劅劉  劅                0劇劅劅劅劉        劅
                          劆datano劆  仾                 劆datano劆        仾
                         2劌劅劅劅劎  劆                2劌劅劅劅劎        劆
                          劆type  劆length/屄            劆type  劆   length/屄
                         4劌劅劍劅劊  劆                4劌劅劍劅劊        劆
                          劆cdata     劆                 劆cdatas[0]  :1幉 劆
                         5劌劅劎      劆                5劌劅劎            劆
                          劆dummy     伀                 乣  乣            劆
                         6劋劅劊      劅        4+1x(n-1)劌劅劎            劆
                                                         劆cdatas[n-1]:n幉 劆
                                                    4+1xn劌劅劎            劆
                                                         劆dummy(n偑婏悢   伀
                                                         劋劅劊  偺応崌)   劅

                n 偼丄嵟戝惂屼幉悢偱偡丅


        diag    僟僀傾僌僲乕僘僨乕僞傪曉偡椞堟傊偺億僀儞僞偱偡丅
                屄乆偺僟僀傾僌僲乕僘僨乕僞偺嶲徠偼丄ODBDGN峔憿懱傪巊梡偟傑偡丅
                typedef struct  iodbpsd {
                    short datano;              /* 僟僀傾僌僲乕僘僨乕僞斣崋 */
                    short type;                /* 忋埵僶僀僩:宆懏惈 */
                                               /* 壓埵僶僀僩:幉斣崋 */
                    union {
                        char cdata;            /* 價僢僩/僶僀僩宍僨乕僞 */
                        short idata;           /* 儚乕僪宍僨乕僞 */
                        long ldata;            /* 俀儚乕僪宍僨乕僞 */
                        char cdatas[MAX_AXIS]; /* 價僢僩/僶僀僩幉宍僨乕僞 */
                        short idatas[MAX_AXIS];/* 儚乕僪幉宍僨乕僞 */
                        long ldatas[MAX_AXIS]; /* 俀儚乕僪幉宍僨乕僞 */
                    } u ;
                } ODBDGN ;              /* MAX_AXIS : 嵟戝惂屼幉悢 */

                datano  儕乕僪偟偨僟僀傾僌僲乕僘僨乕僞斣崋偑奿擺偝傟傑偡丅

                type    儕乕僪偟偨僟僀傾僌僲乕僘僨乕僞偺懏惈偑奿擺偝傟傑偡丅
                        忋埵僶僀僩丗宆懏惈
                            0 : 價僢僩宆
                            1 : 僶僀僩宆
                            2 : 儚乕僪宆
                            3 : 俀儚乕僪宆

                        壓埵僶僀僩丗幉斣崋
                            0      : 幉宍偱側偄僟僀傾僌僲乕僘僨乕僞
                            1乣m   : 幉宍僟僀傾僌僲乕僘僨乕僞偺侾幉巜掕
                                     (m : 嵟戝惂屼幉悢)
                          ALL_AXES : 幉宍僟僀傾僌僲乕僘僨乕僞偺慡幉巜掕
                                     (ALL_AXES : -1)

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                僟僀傾僌僲乕僘僨乕僞奿擺椞堟偺僒僀僘(length)偑
                                晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                僟僀傾僌僲乕僘僨乕僞斣崋(s_number,e_number)偺
                                巜掕偑晄揔愗偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                幉斣崋(axis)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 9) 嵟戝桳岠寘悢丄彫悢揰埲壓寘悢偺儕乕僪

娭悢柤  cnc_getfigure

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_getfigure(unsigned short FlibHndl,
                        short data_type, short *valid_fig, short *dec_fig_in,
                                                        short *dec_fig_out);

夝愢    CNC 偺奺庬僨乕僞偺嵟戝桳岠寘悢丄擖椡扨埵丄弌椡扨埵偱偺彫悢揰埲壓寘悢傪
        撉傒弌偟傑偡丅

        僂傿儞僪僂儔僀僽儔儕偱撉傒庢傟傞抣偼丄CNC懁偺愝掕扨埵偱偺僶僀僫儕僨乕僞
        偱偡丅偦偺偨傔丄愝掕扨埵傪峫椂偟偰彫悢揰埵抲摍偺昞帵傪峴偆昁梫偑偁傝傑
        偡丅

        埲壓偺娭悢傪巊梡偡傞嵺偵丄桳岠偱偡丅

        丒幉宆僨乕僞            丒岺嬶僆僼僙僢僩        丒僇僗僞儉儅僋儘
                cnc_absolute            cnc_rdtofs              cnc_rdmacro
                cnc_machine             cnc_rdtofsr             cnc_rdmacror
                cnc_relative                                    cnc_rdpmacro
                cnc_distance                                    cnc_rdpmacror
                cnc_skip
                cnc_srvdelay
                cnc_accdecdly
                cnc_rddynamic

        娭悢偐傜曉傞抣偼埲壓偺捠傝偱偡丅

        丒嵟戝桳岠寘悢
                                        Power Mate
                -----------------------+---------------+
                幉宆僨乕僞              8
                岺嬶僆僼僙僢僩          7
                僇僗僞儉儅僋儘          8
                                                                乮扨埵乵寘乶乯

        丒擖椡扨埵乛弌椡扨埵偺彫悢揰埲壓寘悢
          1) 幉宆僨乕僞
                擖弌椡扨埵偺彫悢揰埲壓寘悢嫟偵侾幉栚偐傜尰嵼偺惂屼幉悢暘偺僨乕
                僞偑桳岠偲側傝傑偡丅

                                捈慄幉          夞揮幉
                ---------------+---------------+------------------------
                                [mm]    [inch]  [deg]
                ---------------+-------+-------+------------------------
                IS-A            2       3       2
                IS-B            3       4       3
                IS-C            4       5       4
                IS-A 偼丄Power Mate-H 偺応崌偵桳岠偱偡丅
                IS-C 偼丄Power Mate-D 偺応崌偵桳岠偱偡丅

                * "IS-A"乣"IS-C"偼丄CNC僷儔儊乕僞偺愢柧彂傪嶲徠偟偰偔偩偝偄丅

                * 捈慄幉偺儊僩儕僢僋乛僀儞僠偼丄埲壓偺CNC僷儔儊乕僞偵廬偄傑偡
                        擖椡扨埵偺偲偒 仺 擖椡愝掕扨埵乮0000#2乯
                        弌椡扨埵偺偲偒 仺 婡夿偺捈慄幉偺専弌扨埵乮1001#0乯

          2) 岺嬶僆僼僙僢僩
                擖椡扨埵偺彫悢揰埲壓寘悢偼侾幉栚偺僨乕僞偺傒偑桳岠偲側傝傑偡丅
                弌椡扨埵偺彫悢揰埲壓寘悢偼柍岠偲側傝傑偡丅

                                [mm]    [inch]
                ---------------+-------+--------
                IS-A            2       3
                IS-B            3       4
                IS-C            4       5
                IS-A 偼丄Power Mate-H 偺応崌偵桳岠偱偡丅
                IS-C 偼丄Power Mate-D 偺応崌偵桳岠偱偡丅

                * "IS-A"乣"IS-C"偼丄CNC僷儔儊乕僞偺愢柧彂傪嶲徠偟偰偔偩偝偄丅

          3) 僇僗僞儉儅僋儘
                擖椡扨埵偺彫悢揰埲壓寘悢偼侾幉栚偺僨乕僞偺傒偑桳岠偲側傝傑偡丅
                弌椡扨埵偺彫悢揰埲壓寘悢偼柍岠偲側傝傑偡丅

                                [mm]    [inch]
                ---------------+-------+--------
                IS-A            3       4
                IS-B            3       4
                IS-C            4       5
                IS-A 偼丄Power Mate-H 偺応崌偵桳岠偱偡丅
                IS-C 偼丄Power Mate-D 偺応崌偵桳岠偱偡丅

                * "IS-A"乣"IS-C"偼丄CNC僷儔儊乕僞偺愢柧彂傪嶲徠偟偰偔偩偝偄丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        data_type
                僨乕僞偺庬椶傪巜掕偟傑偡丅
                        0 : 幉宆僨乕僞
                        1 : 岺嬶僆僼僙僢僩
                        2 : 僇僗僞儉儅僋儘

        valid_fig
                嵟戝桳岠寘悢傪奿擺偡傞曄悢偺傾僪儗僗傪巜掕偟傑偡丅

        dec_fig_in
                擖椡扨埵偱偺彫悢揰埲壓寘悢傪奿擺偡傞攝楍偺愭摢傾僪儗僗傪巜掕偟
                傑偡丅偙偺攝楍偼嵟戝惂屼幉悢暘昁梫偱偡丅
                乮幉宆僨乕僞埲奜偺応崌丄攝楍偺愭摢偩偗偑桳岠偱偡乯

        dec_fig_out
                弌椡扨埵偱偺彫悢揰埲壓寘悢傪奿擺偡傞攝楍偺愭摢傾僪儗僗傪巜掕偟
                傑偡丅偙偺攝楍偼嵟戝惂屼幉悢暘昁梫偱偡丅
                乮幉宆僨乕僞埲奜偺応崌丄攝楍偺愭摢偩偗偑桳岠偱偡乯


栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰壓偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                僨乕僞偺庬椶(data_type)偺巜掕偑晄揔愗偱偡丅


CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻嵶偼 CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅

                        0000#2, 1001#0                  -+- 愝掕偺塭嬁傪庴偗傑偡
                        1004#0(Power Mate-H 偺応崌)     -+
                        1004#1(Power Mate-D 偺応崌)     -+

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (10) 僒乕儃挷惍梡幚揹棳偺儕乕僪

娭悢柤  cnc_rdcurrent

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdcurrent(unsigned short FlibHndl,
                                                                short *crrnt);

夝愢    亀僒乕儃挷惍幚揹棳亁偺抣傪撉傒弌偟傑偡丅

        師偵帵偡僷儔儊乕僞偺抣偑侽偺応崌丄幚揹棳偲偟偰偼侽偑庢摼偝傟傑偡丅
                Power Mate              2086

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        crrnt   僒乕儃挷惍梡幚揹棳傪奿擺偡傞攝楍偺愭摢傾僪儗僗傪巜掕偟傑偡丅偙
                偺攝楍偼嵟戝惂屼幉悢暘昁梫偱偡丅幚嵺偵桳岠偲側傞偺偼尰嵼偺惂屼
                幉悢傑偱偱偡丅
                long    crrnt[MAX_AXIS] ; /* MAX_AXIS : 嵟戝惂屼幉悢 */

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰壓偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵偼埲壓偺僷儔儊乕僞偑娭學偟傑偡丅
                徻嵶偼 夝愢暲傃偵CNC偺僷儔儊乕僞愢柧彂傪嶲徠偟偰偔偩偝偄丅
                        2086              --- 愝掕偺塭嬁傪庴偗傑偡

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (11) 僒乕儃挷惍梡幚懍搙偺儕乕僪

娭悢柤  cnc_rdsrvspeed

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdsrvspeed(unsigned short FlibHndl,
                                                                long *speed);

夝愢    亀僒乕儃挷惍幚懍搙亁偺抣傪撉傒弌偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        speed   僒乕儃挷惍梡幚懍搙傪奿擺偡傞攝楍偺愭摢傾僪儗僗傪巜掕偟傑偡丅偙
                偺攝楍偼嵟戝惂屼幉悢暘昁梫偱偡丅幚嵺偵桳岠偲側傞偺偼尰嵼偺惂屼
                幉悢傑偱偱偡丅
                long    speed[MAX_AXIS] ; /* MAX_AXIS : 嵟戝惂屼幉悢 */

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰壓偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (12) 僒乕儃挷惍梡儖乕僾僎僀儞偺儕乕僪

娭悢柤  cnc_rdloopgain

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdloopgain(unsigned short FlibHndl,
                                                                long *gain);

夝愢    亀僒乕儃挷惍儖乕僾僎僀儞亁偺抣傪撉傒弌偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        gain    僒乕儃挷惍梡儖乕僾僎僀儞傪奿擺偡傞攝楍偺愭摢傾僪儗僗傪巜掕偟傑
                偡丅偙偺攝楍偼嵟戝惂屼幉悢暘昁梫偱偡丅幚嵺偵桳岠偲側傞偺偼尰嵼
                偺惂屼幉悢傑偱偱偡丅
                long    gain[MAX_AXIS] ;  /* MAX_AXIS : 嵟戝惂屼幉悢 */

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰壓偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (13) 僆儁儗乕僞儊僢僙乕僕偺儕乕僪

娭悢柤  cnc_rdopmsg

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdopmsg(unsigned short FlibHndl, short type,
                                                short length, OPMSG *opmsg);

夝愢    CNC偺僆儁儗乕僞儊僢僙乕僕偺撪梕傪撉傒偩偟傑偡丅僆儁儗乕僞儊僢僙乕僕偼
        OPMSG撪偺data偵奿擺偝傟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        type    僆儁儗乕僞儊僢僙乕僕偺庬椶傪巜掕偟傑偡丅
                           0 : 戞侾儊僢僙乕僕

        length  僨乕僞僽儘僢僋挿乮OPMSG峔憿懱偺僒僀僘乯傪巜掕偟傑偡丅

                         0劇劅劅劅劅劅劅劅劅劅劅劅劉 劅劅
                          劆        datano        劆  仾
                         2劌劅劅劅劅劅劅劅劅劅劅劅劎  劆
                          劆         type         劆  劆
                         4劌劅劅劅劅劅劅劅劅劅劅劅劎  劆
                          劆       char_num       劆  劆
                         6劌劅劅劅劅劅劍劅劅劅劅劅劊length
                          劆 data[0]  劆              劆
                         7劌劅劅劅劅劅劎              劆
                          乣          乣              劆
                     6+255劌劅劅劅劅劅劎              劆
                          劆 data[255]劆              伀
                     6+256劋劅劅劅劅劅劊             劅劅

        opmsg   僆儁儗乕僞儊僢僙乕僕傪曉偡OPMSG峔憿懱傊偺億僀儞僞偱偡丅
                OPMSG峔憿懱偼師偺捠傝偱偡丅
                typedef struct msg {
                     short  datano ;         /* 僆儁儗乕僞儊僢僙乕僕斣崋 */
                     short  type ;           /* 僆儁儗乕僞儊僢僙乕僕偺庬椶 */
                     short  char_num ;       /* 儊僢僙乕僕暥帤悢 */
                     char  data[MSG_SIZE] ;  /* 僆儁儗乕僞儊僢僙乕僕暥帤楍 */

                } OPMSG ;                    /* MSG_SIZE : 儊僢僙乕僕暥帤悢 */

                datano          僆儁儗乕僞儊僢僙乕僕斣崋偑僙僢僩偝傟傑偡丅
                                儊僢僙乕僕偁傝
                                         100 乣  999
                                        2000 乣 2099
                                儊僢僙乕僕側偟
                                        -1

                type            僆儁儗乕僞儊僢僙乕僕偺庬椶偑僙僢僩偝傟傑偡丅
                                             0 : 戞侾儊僢僙乕僕


                char_num        僆儁儗乕僞儊僢僙乕僕暥帤悢偑僙僢僩偝傟傑偡丅
                                        1 乣 256 : 僆儁儗乕僞儊僢僙乕僕

                data            僆儁儗乕僞儊僢僙乕僕暥帤楍偑僙僢僩偝傟傑偡丅
                                ASCII 暥帤楍偑僙僢僩偝傟傑偡丅
                                廔抂偵'\0'偑僙僢僩偝傟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                OPMSG峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                僆儁儗乕僞儊僢僙乕僕偺庬椶(type)偺巜掕偑
                                晄揔愗偱偡丅

                EW_NOOPT        僆僾僔儑儞側偟
                                昁梫側NC僆僾僔儑儞傪愝掕偟偰壓偝偄丅

CNC僆僾僔儑儞   杮婡擻偵偼埲壓偺僆僾僔儑儞偑昁梫偲側傝傑偡丅
                        奜晹儊僢僙乕僕
                        奜晹僨乕僞擖椡

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅


僾儘僌儔儉椺
        埲壓偺僾儘僌儔儉偼僆儁儗乕僞儊僢僙乕僕傪撉傒偩偟丄偦偺撪梕傪夋柺偵
        昞帵偟傑偡丅

#include <stdio.h>
#include "apilib.h"

void example( void )
{
        OPMSG buf ;
        cnc_rdopmsg( FlibHndl, 0, 6+256, &buf ) ;
        if ( buf.datano != -1 )
                printf( "#04d %s\n", buf.datano. buf.data ) ;
        else
                printf( "No operator message.\n" ) ;
}

  (14) 僜僼僩僆儁僷僱偺弌椡怣崋僀儊乕僕偺儕乕僪

娭悢柤  cnc_rdopnlsgnl

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdopnlsgnl(unsigned short FlibHndl,
                                        short slct_data, IODBSGNL *sgnl);

夝愢    僜僼僩僆儁僷僱偺弌椡怣崋僀儊乕僕偺儕乕僪傪峴偄傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        slct_data
                僨乕僞慖戰僼儔僌傪巜掕偟傑偡丅
                        bit  0 : 儌乕僪怣崋
                        bit  1 : 乮枹巊梡乯
                        bit  2 : 乮枹巊梡乯
                        bit  3 : 憗憲傝僆乕僶儔僀僪怣崋
                        bit  4 : 庤摦憲傝懍搙僆乕僶儔僀僪怣崋
                        bit  5 : 憲傝懍搙僆乕僶儔僀僪怣崋
                        bit  6 : 乮枹巊梡乯
                        bit  7 : 僆僾僔儑僫儖僽儘僢僋僗僉僢僾怣崋
                        bit  8 : 僔儞僌儖僽儘僢僋怣崋
                        bit  9 : 儅僔儞儘僢僋怣崋
                        bit 10 : 僪儔僀儔儞怣崋
                        bit 11 : 儊儌儕曐岇怣崋
                        bit 12 : 帺摦塣揮媥巭怣崋
                        bit 13 : 乮枹巊梡乯
                        bit 14 : 乮枹巊梡乯
                        bit 15 : 乮枹巊梡乯
                        仸  奺怣崋偵懳墳偡傞價僢僩傪侽偵偡傞偲偦偺怣崋偼儕乕僪
                            偝傟傑偣傫丅偦偺怣崋傪儕乕僪偡傞帪偼丄懳墳偡傞價僢
                            僩傪侾偵偟偰偔偩偝偄丅

        sgnl    僜僼僩僆儁僷僱偺弌椡怣崋僀儊乕僕傪曉偡IODBSGNL峔憿懱傊偺
                億僀儞僞偱偡丅
                IODBSGNL峔憿懱偼師偺捠傝偱偡丅

                typedef struct iodbsgnl {
                     short     datano;        /* (枹巊梡) */
                     short     type;          /* 僨乕僞慖戰僼儔僌 */
                     short     mode;          /* 儌乕僪怣崋 */
                     short     hndl_ax;       /* 乮枹巊梡乯 */
                     short     hndl_mv;       /* 乮枹巊梡乯 */
                     short     rpd_ovrd;      /* 憗憲傝僆乕僶儔僀僪怣崋 */
                     short     jog_ovrd;      /* 庤摦憲傝懍搙僆乕僶儔僀僪怣崋 */
                     short     feed_ovrd;     /* 憲傝懍搙僆乕僶儔僀僪怣崋 */
                     short     spdl_ovrd;     /* (枹巊梡) */
                     short     blck_del;      /* 僆僾僔儑僫儖僽儘僢僋
                                                        僗僉僢僾怣崋 (0/1) */
                     short     sngl_blck;     /* 僔儞僌儖僽儘僢僋怣崋 (0/1) */

                     short     machn_lock;    /* 儅僔儞儘僢僋怣崋 (0/1) */
                     short     dry_run;       /* 僪儔僀儔儞怣崋 (0/1) */
                     short     mem_prtct;     /* 儊儌儕曐岇怣崋 (0/1) */
                     short     feed_hold;     /* 帺摦塣揮媥巭怣崋 (0/1) */
                } IODBSGNL ;

                datano          枹巊梡

                type            僨乕僞慖戰僼儔僌偑僙僢僩偝傟傑偡丅

                mode            儌乕僪怣崋偑僙僢僩偝傟傑偡丅
                                0 : MDI
                                1 : MEM
                                2 : EDIT
                                3 : HNDL or INC
                                4 : JOG
                                5 : REF

                hndl_ax         乮枹巊梡乯

                hndl_mv         乮枹巊梡乯

                rpd_ovrd        憗憲傝僆乕僶儔僀僪怣崋偑僙僢僩偝傟傑偡丅
                                0 : 100%
                                1 : 50%
                                2 : 25%
                                3 : F0
                jog_ovrd        庤摦憲傝懍搙僆乕僶儔僀僪怣崋偑僙僢僩偝傟傑偡丅
                                0 : 0   %       10 :  2.0%      20 :  52.0%
                                1 : 0.1 %       11 :  2.7%      21 :  72.0%
                                2 : 0.14%       12 :  3.7%      22 : 100  %
                                3 : 0.2 %       13 :  5.2%      23 : 140  %
                                4 : 0.27%       14 :  7.2%      24 : 200  %
                                5 : 0.37%       15 : 10.0%
                                6 : 0.52%       16 : 14.0%
                                7 : 0.72%       17 : 20.0%
                                8 : 1.0 %       18 : 27.0%
                                9 : 1.4 %       19 : 37.0%

                feed_ovrd       憲傝懍搙僆乕僶儔僀僪怣崋偑僙僢僩偝傟傑偡丅
                                0 :  0%         10 : 100%       20 : 200%
                                1 : 10%         11 : 110%
                                2 : 20%         12 : 120%
                                3 : 30%         13 : 130%
                                4 : 40%         14 : 140%
                                5 : 50%         15 : 150%
                                6 : 60%         16 : 160%
                                7 : 70%         17 : 170%
                                8 : 80%         18 : 180%
                                9 : 90%         19 : 190%

                spdl_ovrd       枹巊梡

                blck_del        僆僾僔儑僫儖僽儘僢僋僗僉僢僾怣崋 (0/1) 偑
                                僙僢僩偝傟傑偡丅


                sngl_blck       僔儞僌儖僽儘僢僋怣崋 (0/1) 偑僙僢僩偝傟傑偡丅

                machn_lock      儅僔儞儘僢僋怣崋 (0/1) 偑僙僢僩偝傟傑偡丅

                dry_run         僪儔僀儔儞怣崋 (0/1) 偑僙僢僩偝傟傑偡丅

                mem_prtct       儊儌儕曐岇怣崋 (0/1) 偑僙僢僩偝傟傑偡丅

                feed_hold       帺摦塣揮媥巭怣崋 (0/1) 偑僙僢僩偝傟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (15) 僜僼僩僆儁僷僱偺弌椡怣崋偺儔僀僩

娭悢柤  cnc_wropnlsgnl

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_wropnlsgnl(unsigned short FlibHndl,
                                                        IODBSGNL *sgnl);

夝愢    僜僼僩僆儁僷僱偺怣崋偺彂偒崬傒傪峴偄傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        sgnl    僆儁儗乕僞儊僢僙乕僕傪曉偡IODBSGNL峔憿懱傊偺億僀儞僞偱偡丅
                IODBSGNL峔憿懱偼師偺捠傝偱偡丅

                typedef struct iodbsgnl {
                     short     datano;        /* (枹巊梡) */
                     short     type;          /* 僨乕僞慖戰僼儔僌 */
                     short     mode;          /* 儌乕僪怣崋 */
                     short     hndl_ax;       /* 乮枹巊梡乯*/
                     short     hndl_mv;       /* 乮枹巊梡乯*/
                     short     rpd_ovrd;      /* 憗憲傝僆乕僶儔僀僪怣崋 */
                     short     jog_ovrd;      /* 庤摦憲傝懍搙僆乕僶儔僀僪怣崋 */
                     short     feed_ovrd;     /* 憲傝懍搙僆乕僶儔僀僪怣崋 */
                     short     spdl_ovrd;     /* (枹巊梡) */
                     short     blck_del;      /* 僆僾僔儑僫儖僽儘僢僋
                                                        僗僉僢僾怣崋 (0/1) */
                     short     sngl_blck;     /* 僔儞僌儖僽儘僢僋怣崋 (0/1) */
                     short     machn_lock;    /* 儅僔儞儘僢僋怣崋 (0/1) */
                     short     dry_run;       /* 僪儔僀儔儞怣崋 (0/1) */
                     short     mem_prtct;     /* 儊儌儕曐岇怣崋 (0/1) */
                     short     feed_hold;     /* 帺摦塣揮媥巭怣崋 (0/1) */
                } IODBSGNL ;

                datano          枹巊梡

                type            僨乕僞慖戰僼儔僌傪愝掕偟傑偡丅
                        bit  0 : 儌乕僪怣崋
                        bit  1 : 乮枹巊梡乯
                        bit  2 : 乮枹巊梡乯
                        bit  3 : 憗憲傝僆乕僶儔僀僪怣崋
                        bit  4 : 庤摦憲傝懍搙僆乕僶儔僀僪怣崋
                        bit  5 : 憲傝懍搙僆乕僶儔僀僪怣崋
                        bit  6 : 乮枹巊梡乯
                        bit  7 : 僆僾僔儑僫儖僽儘僢僋僗僉僢僾怣崋
                        bit  8 : 僔儞僌儖僽儘僢僋怣崋
                        bit  9 : 儅僔儞儘僢僋怣崋
                        bit 10 : 僪儔僀儔儞怣崋
                        bit 11 : 儊儌儕曐岇怣崋
                        bit 12 : 帺摦塣揮媥巭怣崋
                        bit 13 : 乮枹巊梡乯
                        bit 14 : 乮枹巊梡乯

                        bit 15 : 乮枹巊梡乯
                        仸  奺怣崋偵懳墳偡傞價僢僩傪侽偵偡傞偲偦偺怣崋偼儔僀僩
                            偝傟傑偣傫丅偦偺怣崋傪儔僀僩偡傞帪偼丄懳墳偡傞價僢
                            僩傪侾偵偟偰偔偩偝偄丅

                mode            儌乕僪怣崋傪巜掕偟傑偡丅
                                0 : MDI
                                1 : MEM
                                2 : EDIT
                                3 : HNDL or INC
                                4 : JOG
                                5 : REF

                hndl_ax         乮枹巊梡乯

                hndl_mv         乮枹巊梡乯

                rpd_ovrd        憗憲傝僆乕僶儔僀僪怣崋傪巜掕偟傑偡丅
                                0 : 100%
                                1 : 50%
                                2 : 25%
                                3 : F0

                jog_ovrd        庤摦憲傝懍搙僆乕僶儔僀僪巜掕傪僙僢僩偟傑偡丅
                                0 : 0   %       10 :  2.0%      20 :  52.0%
                                1 : 0.1 %       11 :  2.7%      21 :  72.0%
                                2 : 0.14%       12 :  3.7%      22 : 100  %
                                3 : 0.2 %       13 :  5.2%      23 : 140  %
                                4 : 0.27%       14 :  7.2%      24 : 200  %
                                5 : 0.37%       15 : 10.0%
                                6 : 0.52%       16 : 14.0%
                                7 : 0.72%       17 : 20.0%
                                8 : 1.0 %       18 : 27.0%
                                9 : 1.4 %       19 : 37.0%

                feed_ovrd       憲傝懍搙僆乕僶儔僀僪怣崋傪巜掕偟傑偡丅
                                0 :  0%         10 : 100%       20 : 200%
                                1 : 10%         11 : 110%
                                2 : 20%         12 : 120%
                                3 : 30%         13 : 130%
                                4 : 40%         14 : 140%
                                5 : 50%         15 : 150%
                                6 : 60%         16 : 160%
                                7 : 70%         17 : 170%
                                8 : 80%         18 : 180%
                                9 : 90%         19 : 190%

                spdl_ovrd       枹巊梡

                blck_del        僆僾僔儑僫儖僽儘僢僋僗僉僢僾怣崋 (0/1) 傪
                                巜掕偟傑偡丅

                sngl_blck       僔儞僌儖僽儘僢僋怣崋 (0/1) 傪巜掕偟傑偡丅

                machn_lock      儅僔儞儘僢僋怣崋 (0/1) 傪巜掕偟傑偡丅


                dry_run         僪儔僀儔儞怣崋 (0/1) 傪巜掕偟傑偡丅

                mem_prtct       儊儌儕曐岇怣崋 (0/1) 傪巜掕偟傑偡丅

                feed_hold       帺摦塣揮媥巭怣崋 (0/1) 傪巜掕偟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_DATA         僨乕僞偺岆傝
                                IODBSGNL峔憿懱偺儊儞僶偺抣偵晄揔側傕偺偑偁傝傑
                                偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (16) 僜僼僩僆儁僷僱偺斈梡弌椡怣崋僀儊乕僕偺儕乕僪

娭悢柤  cnc_rdopnlgnrl

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdopnlgnrl(unsigned short FlibHndl,
                                        short slct_data, IODBGNRL *opnlgnrl);

夝愢    僜僼僩僆儁僷僱偺斈梡弌椡怣崋僀儊乕僕偺儕乕僪傪峴偄傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        slct_data
                僨乕僞慖戰僼儔僌傪巜掕偟傑偡丅
                        bit 0 : 斈梡弌椡怣崋 1
                        bit 1 : 斈梡弌椡怣崋 2
                        bit 2 : 斈梡弌椡怣崋 3
                        bit 3 : 斈梡弌椡怣崋 4
                        bit 4 : 斈梡弌椡怣崋 5
                        bit 5 : 斈梡弌椡怣崋 6
                        bit 6 : 斈梡弌椡怣崋 7
                        bit 7 : 斈梡弌椡怣崋 8
                        仸  bit 8乣bit 15偼枹巊梡
                        仸  奺怣崋偵懳墳偡傞價僢僩傪 0 偵偡傞偲偦偺怣崋偼儕乕僪
                            偝傟傑偣傫丅偦偺怣崋傪儕乕僪偡傞帪偼丄懳墳偡傞價僢
                            僩傪 1 偵偟偰偔偩偝偄丅

        opnlgnrl
                僜僼僩僆儁僷僱偺斈梡怣崋傪曉偡IODBGNRL峔憿懱傊偺億僀儞僞偱偡丅
                IODBGNRL峔憿懱偼師偺捠傝偱偡丅
                typedef struct iodbgnrl {
                     short     datano;        /* 枹巊梡 */
                     short     type;          /* 僨乕僞慖戰僼儔僌 */
                     char      sgnal;         /* 斈梡怣崋侾乣俉 */
                } IODBGNRL ;

                datano          枹巊梡

                type            僨乕僞慖戰僼儔僌偑僙僢僩偝傟傑偡丅

                sgnal           斈梡怣崋偑僙僢僩偝傟傑偡丅
                                        bit 0 : 斈梡弌椡怣崋 1
                                        bit 1 : 斈梡弌椡怣崋 2
                                        bit 2 : 斈梡弌椡怣崋 3
                                        bit 3 : 斈梡弌椡怣崋 4
                                        bit 4 : 斈梡弌椡怣崋 5
                                        bit 5 : 斈梡弌椡怣崋 6
                                        bit 6 : 斈梡弌椡怣崋 7
                                        bit 7 : 斈梡弌椡怣崋 8

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅

        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (17) 僜僼僩僆儁僷僱偺斈梡弌椡怣崋偺儔僀僩

娭悢柤  cnc_wropnlgnrl

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_wropnlgnrl(unsigned short FlibHndl,
                                                        IODBGNRL *opnlgnrl);

夝愢    僜僼僩僆儁僷僱偺斈梡怣崋偺彂偒崬傒傪峴偄傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕僴儞僪儖傪巜掕偟傑偡丅

        opnlgnrl
                僜僼僩僆儁僷僱偺斈梡怣崋傪愝掕偡傞IODBGNRL峔憿懱傊偺億僀儞僞偱
                偡丅IODBGNRL峔憿懱偼師偺捠傝偱偡丅
                typedef struct iodbgnrl {
                     short     datano;        /* 枹巊梡 */
                     short     type;          /* 僨乕僞慖戰僼儔僌 */
                     char      sgnal;         /* 斈梡怣崋侾乣俉 */
                } IODBGNRL ;

                datano          枹巊梡

                type            僨乕僞慖戰僼儔僌傪愝掕偟傑偡丅
                                        bit 0 : 斈梡弌椡怣崋 1
                                        bit 1 : 斈梡弌椡怣崋 2
                                        bit 2 : 斈梡弌椡怣崋 3
                                        bit 3 : 斈梡弌椡怣崋 4
                                        bit 4 : 斈梡弌椡怣崋 5
                                        bit 5 : 斈梡弌椡怣崋 6
                                        bit 6 : 斈梡弌椡怣崋 7
                                        bit 7 : 斈梡弌椡怣崋 8
                        仸  bit 8 乣bit 15偼枹巊梡
                        仸  奺怣崋偵懳墳偡傞價僢僩傪 0 偵偡傞偲偦偺怣崋偼儔僀僩
                            偝傟傑偣傫丅偦偺怣崋傪儔僀僩偡傞帪偼丄懳墳偡傞價僢
                            僩傪 1 偵偟偰偔偩偝偄丅

                sgnal           斈梡怣崋傪愝掕偟傑偡丅
                                        bit 0 : 斈梡弌椡怣崋 1
                                        bit 1 : 斈梡弌椡怣崋 2
                                        bit 2 : 斈梡弌椡怣崋 3
                                        bit 3 : 斈梡弌椡怣崋 4
                                        bit 4 : 斈梡弌椡怣崋 5
                                        bit 5 : 斈梡弌椡怣崋 6
                                        bit 6 : 斈梡弌椡怣崋 7
                                        bit 7 : 斈梡弌椡怣崋 8

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅


CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (18) 僜僼僩僆儁僷僱偺斈梡怣崋柤徧偺儕乕僪

娭悢柤  cnc_rdopnlgsname

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_rdopnlgsname(unsigned short FlibHndl,
                                        short slct_data, IODBRDNA *brdna);

夝愢    僜僼僩僆儁僷僱偺斈梡怣崋柤徧偺儕乕僪傪峴偄傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        slct_data
                僨乕僞慖戰僼儔僌傪巜掕偟傑偡丅
                        bit 0 : 斈梡弌椡怣崋 1
                        bit 1 : 斈梡弌椡怣崋 2
                        bit 2 : 斈梡弌椡怣崋 3
                        bit 3 : 斈梡弌椡怣崋 4
                        bit 4 : 斈梡弌椡怣崋 5
                        bit 5 : 斈梡弌椡怣崋 6
                        bit 6 : 斈梡弌椡怣崋 7
                        bit 7 : 斈梡弌椡怣崋 8
                        仸  bit 8乣bit 15偼枹巊梡
                        仸  奺怣崋偵懳墳偡傞價僢僩傪 0 偵偡傞偲偦偺怣崋偼儕乕僪
                            偝傟傑偣傫丅偦偺怣崋傪儕乕僪偡傞帪偼丄懳墳偡傞價僢
                            僩傪 1 偵偟偰偔偩偝偄丅

        brdna   僜僼僩僆儁僷僱偺斈梡怣崋傪曉偡IODBRDNA峔憿懱傊偺億僀儞僞偱偡丅
                IODBRDNA峔憿懱偼師偺捠傝偱偡丅
                typedef struct iodbrdna {
                     short    datano;         /* 枹巊梡 */
                     short    type;           /* 僨乕僞慖戰僼儔僌 */
                     char     sgnl1_name[9];  /* 斈梡怣崋 1 柤徧 (ASCII) */
                     char     sgnl2_name[9];  /* 斈梡怣崋 2 柤徧 (ASCII) */
                     char     sgnl3_name[9];  /* 斈梡怣崋 3 柤徧 (ASCII) */
                     char     sgnl4_name[9];  /* 斈梡怣崋 4 柤徧 (ASCII) */
                     char     sgnl5_name[9];  /* 斈梡怣崋 5 柤徧 (ASCII) */
                     char     sgnl6_name[9];  /* 斈梡怣崋 6 柤徧 (ASCII) */
                     char     sgnl7_name[9];  /* 斈梡怣崋 7 柤徧 (ASCII) */
                     char     sgnl8_name[9];  /* 斈梡怣崋 8 柤徧 (ASCII) */
                } IODBRDNA ;

                datano          枹巊梡

                type            張棟偑峴傢傟偨僨乕僞慖戰僼儔僌偑愝掕偝傟傑偡丅

                sgnl1_name      斈梡怣崋 1 柤徧乮ASCII乯 劉
                sgnl2_name      斈梡怣崋 2 柤徧乮ASCII乯 劆
                sgnl3_name      斈梡怣崋 3 柤徧乮ASCII乯 劆
                sgnl4_name      斈梡怣崋 4 柤徧乮ASCII乯 劆巜掕偟偨柤徧偑
                sgnl5_name      斈梡怣崋 5 柤徧乮ASCII乯 劆     愝掕偝傟傑偡丅

                sgnl6_name      斈梡怣崋 6 柤徧乮ASCII乯 劆
                sgnl7_name      斈梡怣崋 7 柤徧乮ASCII乯 劆
                sgnl8_name      斈梡怣崋 8 柤徧乮ASCII乯 劊

                                柤徧偺嵟屻(sgnl?_name[8])偵偼丄NULL暥帤('\0')偑
                                僙僢僩偝傟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  (19) 僜僼僩僆儁僷僱偺斈梡怣崋柤徧偺愝掕

娭悢柤  cnc_wropnlgsname

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI cnc_wropnlgsname(unsigned short FlibHndl,
                                                        IODBRDNA *brdna);

夝愢    僜僼僩僆儁僷僱偺斈梡怣崋柤徧偺彂偒崬傒傪峴偄傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        brdna   僜僼僩僆儁僷僱偺斈梡怣崋傪曉偡IODBRDNA峔憿懱傊偺億僀儞僞偱偡丅
                IODBRDNA峔憿懱偼師偺捠傝偱偡丅
                typedef struct iodbrdna {
                     short    datano;         /* 枹巊梡 */
                     short    type;           /* 僨乕僞慖戰僼儔僌 */
                     char     sgnl1_name[9];  /* 斈梡怣崋 1 柤徧 (ASCII) */
                     char     sgnl2_name[9];  /* 斈梡怣崋 2 柤徧 (ASCII) */
                     char     sgnl3_name[9];  /* 斈梡怣崋 3 柤徧 (ASCII) */
                     char     sgnl4_name[9];  /* 斈梡怣崋 4 柤徧 (ASCII) */
                     char     sgnl5_name[9];  /* 斈梡怣崋 5 柤徧 (ASCII) */
                     char     sgnl6_name[9];  /* 斈梡怣崋 6 柤徧 (ASCII) */
                     char     sgnl7_name[9];  /* 斈梡怣崋 7 柤徧 (ASCII) */
                     char     sgnl8_name[9];  /* 斈梡怣崋 8 柤徧 (ASCII) */
                } IODBRDNA ;

                datano          枹巊梡

                type            僨乕僞慖戰僼儔僌傪巜掕偟傑偡丅
                        bit 0 : 斈梡弌椡怣崋 1
                        bit 1 : 斈梡弌椡怣崋 2
                        bit 2 : 斈梡弌椡怣崋 3
                        bit 3 : 斈梡弌椡怣崋 4
                        bit 4 : 斈梡弌椡怣崋 5
                        bit 5 : 斈梡弌椡怣崋 6
                        bit 6 : 斈梡弌椡怣崋 7
                        bit 7 : 斈梡弌椡怣崋 8
                        仸  bit 8乣bit 15偼枹巊梡
                        仸  奺怣崋偵懳墳偡傞價僢僩傪 0 偵偡傞偲偦偺怣崋偼儔僀僩
                            偝傟傑偣傫丅偦偺怣崋傪儔僀僩偡傞帪偼丄懳墳偡傞價僢
                            僩傪 1 偵偟偰偔偩偝偄丅

                sgnl1_name      斈梡怣崋 1 柤徧乮ASCII乯 劉
                sgnl2_name      斈梡怣崋 2 柤徧乮ASCII乯 劆
                sgnl3_name      斈梡怣崋 3 柤徧乮ASCII乯 劆
                sgnl4_name      斈梡怣崋 4 柤徧乮ASCII乯 劆柤徧傪愝掕偟傑偡丅
                sgnl5_name      斈梡怣崋 5 柤徧乮ASCII乯 劆
                sgnl6_name      斈梡怣崋 6 柤徧乮ASCII乯 劆
                sgnl7_name      斈梡怣崋 7 柤徧乮ASCII乯 劆
                sgnl8_name      斈梡怣崋 8 柤徧乮ASCII乯 劊


                                奺柤徧偺愭摢偐傜俉暥帤
                                        (sgnl?_name[0] - sgnl?_name[7])
                                偑丄CNC偵愝掕偝傟傑偡丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡

俹俵俠娭學
-------------------------------------------------------------------------------
  娭悢柤                婡丂擻丂撪丂梕
-------------------------------------------------------------------------------
  ( 1) pmc_rdpmcrng     PMC偺擟堄僨乕僞偺儕乕僪(斖埻巜掕)
  ( 2) pmc_wrpmcrng     PMC偺擟堄僨乕僞偺儔僀僩(斖埻巜掕)
  ( 3) pmc_rdpmcinfo    俹俵俠僨乕僞忣曬偺儕乕僪
-------------------------------------------------------------------------------

  ( 1) PMC偺擟堄僨乕僞偺儕乕僪(斖埻巜掕)

娭悢柤  pmc_rdpmcrng

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI pmc_rdpmcrng(unsigned short FlibHndl,
                        short adr_type, short data_type, short s_number,
                                short e_number, short length, IODBPMC *buf);

夝愢    巜掕偝傟偨PMC傾僪儗僗/斖埻偺PMC僨乕僞傪撉傒庢傝傑偡丅

        MMC偺傾僾儕働乕僔儑儞偲PMC偺儔僟乕僜僼僩偲偺娫偺僨乕僞偺傗傝庢傝偵巊梡
        偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        adr_type
                儕乕僪偡傞PMC傾僪儗僗偺庬椶偵懳墳偟偨幆暿僐乕僪傪巜掕偟傑偡丅

幆暿僐乕僪 PMC傾僪儗僗偺庬椶     嶲徠壜擻椞堟
----------+---------------------+---------------------+
0          G (PMC仺CNC傊偺怣崋)  0000-0255, 1000-1255
1          F (CNC仺PMC傊偺怣崋)  0000-0255, 1000-1255
2          Y (PMC仺婡夿傊偺怣崋) 0000-0127, 1000-1063
3          X (婡夿仺PMC傊偺怣崋) 0000-0127, 1000-1063
4          A (儊僢僙乕僕梫媮)    0000-0024
5          R (撪晹儕儗乕)        0000-0999, 9000-9117
6          T (壜曄僞僀儅)        0000-0079
7          K (僉乕僾儕儗乕)      0000-0019
8          C (僇僂儞僞)          0000-0079
9          D (僨乕僞僥乕僽儖)    0000-1859

(*) 傾僪儗僗 F,X 偺慡椞堟丄偍傛傃 R9000斣戜偵懳偟偰偺彂偒崬傒偼偱偒傑偣傫丅
    傑偨丄K0017乣K0019偺彂偒崬傒傕峴傢側偄偱壓偝偄丅
(*) 奺PMC偑懳墳壜擻側CNC偼丄PMC偺僾儘僌儔儈儞僌愢柧彂傪嶲徠偔偩偝偄丅

        data_type
                PMC僨乕僞偺宆傪巜掕偟傑偡丅
                PMC懁偺僨乕僞偺宆偲摨偠傕偺傪巜掕偟偰偔偩偝偄丅
                  0丗僶僀僩宆
                  1丗儚乕僪宆
                  2丗儘儞僌宆

        s_number
                儕乕僪傪奐巒偡傞PMC傾僪儗僗斣崋傪巜掕偟傑偡丅

        e_number
                儕乕僪傪廔椆偡傞PMC傾僪儗僗斣崋傪巜掕偟傑偡丅

        length  僨乕僞僽儘僢僋挿傪巜掕偟傑偡丅
                data_type偑 0(僶僀僩宆)偺応崌丗length = 8 + N

                data_type偑 1(儚乕僪宆)偺応崌丗length = 8 + N * 2
                data_type偑 2(儘儞僌宆)偺応崌丗length = 8 + N * 4
                仸 N偼撉傒庢傞僨乕僞偺屄悢

        buf     僨乕僞傪曉偡IODBPMC峔憿懱傊偺億僀儞僞偱偡丅
                IODBPMC峔憿懱偼師偺捠傝偱偡丅
                typedef struct  iodbpmc {
                        short   type_a ;        /* PMC傾僪儗僗偺庬椶 */
                        short   type_d ;        /* PMC僨乕僞偺宆 */
                        short   datano_s ;      /* 擖椡奐巒PMC傾僪儗僗 */
                        short   datano_e ;      /* 擖椡廔椆PMC傾僪儗僗 */
                        union {
                                char    cdata[N] ;/* PMC僨乕僞(僶僀僩宆) */
                                short   idata[N] ;/*          (儚乕僪宆) */
                                long    ldata[N] ;/*        丂(儘儞僌宆) */
                        } u ;                   /* N 偼撉傒庢傞僨乕僞偺屄悢 */
                } IODBPMC ;
        堷悢偺巜掕椺
        ~~~~~~~~~~~~
                (1) D0100 (儚乕僪宆偲偟傑偡) 傪撉傒庢傞丅
                        adr_type        9
                        data_type       1
                        s_number        100
                        e_number        101
                        length          8+2*1 (=10)
                        buf.u.idata[0]  D0100偺撪梕偑奿擺偝傟傞

                (2) R0200乣R0209 (僶僀僩宆偲偟傑偡) 傪撉傒庢傞丅
                        adr_type        5
                        data_type       0
                        s_number        200
                        e_number        209
                        length          8+1*10 (=18)
                        buf.u.cdata[0]  R0200乣R0209偺撪梕偑奿擺偝傟傞
                        乣buf.u.cdata[9]

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_NOPMC        PMC偑懚嵼偟傑偣傫丅

                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                IODBPMC峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                PMC傾僪儗僗斣崋(s_number, e_number)偺巜掕偑晄
                                揔愗偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                PMC傾僪儗僗偺庬椶(adr_type)丄傑偨偼PMC僨乕僞偺
                                宆(data_type)偺巜掕偑晄揔愗偱偡丅


CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 2) PMC偺擟堄僨乕僞偺儔僀僩(斖埻巜掕)

娭悢柤  pmc_wrpmcrng

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI pmc_wrpmcrng(unsigned short FlibHndl,
                                                short length, IODBPMC *buf);

夝愢    巜掕偝傟偨PMC傾僪儗僗/斖埻偺PMC僨乕僞傪彂偒崬傒傑偡丅

        MMC偺傾僾儕働乕僔儑儞偲PMC偺儔僟乕僜僼僩偲偺娫偺僨乕僞偺傗傝庢傝偵巊梡
        偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        length  僨乕僞僽儘僢僋挿傪巜掕偟傑偡丅
                type_d偑 0(僶僀僩宆)偺応崌丗length = 8 + N
                type_d偑 1(儚乕僪宆)偺応崌丗length = 8 + N * 2
                type_d偑 2(儘儞僌宆)偺応崌丗length = 8 + N * 4

                仸 N偼彂偒姺偊傞僨乕僞偺屄悢

        buf     彂偒姺偊傞僨乕僞傪巜掕偡傞IODBPMC峔憿懱傊偺億僀儞僞偱偡丅
                IODBPMC峔憿懱偼師偺捠傝偱偡丅
                typedef struct  iodbpmc {
                        short   type_a ;        /* PMC傾僪儗僗偺庬椶 */
                        short   type_d ;        /* PMC僨乕僞偺宆 */
                        short   datano_s ;      /* 弌椡奐巒PMC傾僪儗僗 */
                        short   datano_e ;      /* 弌椡廔椆PMC傾僪儗僗 */
                        union {
                                char    cdata[N] ;/* PMC僨乕僞(僶僀僩宆) */
                                short   idata[N] ;/*          (儚乕僪宆) */
                                long    ldata[N] ;/*        丂(儘儞僌宆) */
                        } u ;           /* N 偼彂偒姺偊傞僨乕僞偺屄悢 */
                } IODBPMC ;

                type_a  儕乕僪偡傞PMC傾僪儗僗偺庬椶偵懳墳偟偨幆暿僐乕僪傪巜掕偟
                        傑偡丅

                type_d  PMC僨乕僞偺宆傪巜掕偟傑偡丅
                        PMC懁偺僨乕僞偺宆偲摨偠傕偺傪巜掕偟偰偔偩偝偄丅
                          0丗僶僀僩宆
                          1丗儚乕僪宆
                          2丗儘儞僌宆

                datano_s
                        儔僀僩傪奐巒偡傞PMC傾僪儗僗斣崋傪巜掕偟傑偡丅

                datano_e
                        儔僀僩傪廔椆偡傞PMC傾僪儗僗斣崋傪巜掕偟傑偡丅


        巜掕偱偒傞傾僪儗僗偺庬椶丄奐巒傾僪儗僗丄廔椆傾僪儗僗偼乽PMC偺擟堄僨乕
        僞偺儕乕僪(斖埻巜掕)(pmc_rdpmcrng)乿偺乽PMC僨乕僞嶲徠壜擻椞堟乿傪嶲徠
        偟偰偔偩偝偄丅

        堷悢偺巜掕椺
        ~~~~~~~~~~~~
                (1) D0100 (儚乕僪宆偲偟傑偡) 偵 250 傪彂偒崬傓丅
                        buf.type_a      9
                        buf.type_d      1
                        buf.datano_s    100
                        buf.datano_e    101
                        length          8+2*1 (=10)
                        buf.u.idata[0]  250

                (2) R0200乣R0209 (僶僀僩宆偲偟傑偡) 偺偡傋偰偵 0 傪彂偒崬傓丅
                        buf.type_a      5
                        buf.type_d      0
                        buf.datano_s    200
                        buf.datano_e    209
                        length          8+1*10 (=18)
                        buf.u.cdata[0]  偡傋偰 0
                        乣buf.u.cdata[9]

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰偔偩偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_NOPMC        PMC偑懚嵼偟傑偣傫丅

                EW_LENGTH       僨乕僞僽儘僢僋挿偺岆傝
                                IODBPMC峔憿懱偺僒僀僘(length)偑晄惓偱偡丅

                EW_NUMBER       僨乕僞斣崋偺岆傝
                                PMC傾僪儗僗斣崋(datano_s, datano_e)偺巜掕偑晄揔
                                愗偱偡丅

                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                PMC傾僪儗僗偺庬椶(type_a)丄傑偨偼PMC僨乕僞偺宆
                                (type_d)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅

CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

  ( 3) 俹俵俠僨乕僞忣曬偺儕乕僪

娭悢柤  pmc_rdpmcinfo

愰尵    #include        "Fwlib32.h"
        FWLIBAPI short WINAPI pmc_rdpmcinfo(unsigned short FlibHndl,
                                        short adr_type, ODBPMCINF *pmcif);

夝愢    PMC偺庬椶暿偺懏惈丄傾僪儗僗偺桳岠斖埻摍偺僨乕僞忣曬傪撉傒偩偟傑偡丅

堷悢    FlibHndl
                儔僀僽儔儕傪巊梡偡傞僾儘僙僗傪幆暿偟傑偡丅
                cnc_allclibhndl(), cnc_allclibhndl2() 偱庢摼偟偨儔僀僽儔儕
                僴儞僪儖傪巜掕偟傑偡丅

        adr_type
                PMC傾僪儗僗偺庬椶傪巜掕偟傑偡丅
                        0 乣 : pmc_rdpmcrng()娭悢偺昞嶲徠
                        -1   : 慡傾僪儗僗忣曬

        pmcif   僨乕僞忣曬傪曉偡ODBPMCINF峔憿懱傊偺億僀儞僞偱偡丅
                ODBPMCINF峔憿懱偼師偺捠傝偱偡丅
                typedef struct odbpmcinf {
                   short        datano ;        /* PMC僨乕僞忣曬偺屄悢 */
                   struct       {
                      char           pmc_adr ;  /* PMC傾僪儗僗偺庬椶 */
                      char           adr_attr ; /* PMC傾僪儗僗偺懏惈 */
                      unsigned short top_num ;  /* PMC傾僪儗僗偺愭摢斣崋 */
                      unsigned short last_num ; /* PMC傾僪儗僗偺嵟廔斣崋 */
                   } info[64] ;
                } ODBPMCINF ;

                datano          PMC僨乕僞忣曬偺屄悢 (1 - 64)
                                * 摨偠PMC傾僪儗僗偑暋悢屄偵暘妱偝傟偰偄傞応
                                  崌偑偁傝傑偡丅
                pmc_adr         PMC傾僪儗僗偺庬椶 (ASCII CODE)
                adr_attr        PMC傾僪儗僗偺懏惈
                                    bit 7 : 彂偒崬傒嬛巭
                                                0 : 壜          1 : 晄壜
                                    bit 0乣6 : (枹巊梡)
                top_num         PMC傾僪儗僗偺愭摢斣崋
                last_num        PMC傾僪儗僗偺嵟廔斣崋
                                    * pmc_rdpmcrng()娭悢偺昞傪嶲徠偔偩偝偄丅

栠傝抣  惉岟偡傞偲 EW_OK 傪曉偟丄僄儔乕偺応崌偼 EW_OK 埲奜偺抣傪曉偟傑偡丅
        庡側僄儔乕偼埲壓偺捠傝偱偡丅
        乮偦偺懠偺僄儔乕偵偮偄偰偼丄亀儔僀僽儔儕偺栠傝抣亁傪嶲徠偟偰壓偝偄乯
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                栠傝抣          堄枴乛懳張曽朄
                劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅
                EW_ATTRIB       僨乕僞懏惈偺岆傝
                                僨乕僞偺庬椶(adr_type)偺巜掕偑晄揔愗偱偡丅

CNC僆僾僔儑儞   杮婡擻偵僆僾僔儑儞偼昁梫偁傝傑偣傫丅丅


CNC僷儔儊乕僞   杮婡擻偵僷儔儊乕僞偼娭學偟傑偣傫丅

CNC儌乕僪       偡傋偰偺儌乕僪偱巊梡偱偒傑偡丅

