News CNCnetPDM About us Support  



The start of sampling is notified.

In case of cnc_sdtstartsmpl, start sampling after trigger. However, in case of this function, start sampling immediately after function call.

Therefore, after function call, acquire data immediately by cnc_sdtreadsmpl2. Trigger is confirmed by trg, the one argument of cnc_sdtreadsmpl2.

MTConnect Fanuc Adapter

Universal Fanuc Driver

Fanuc Focas Library CD


#include "fwlib32.h" or "fwlib64.h"

FWLIBAPI short WINAPI cnc_sdtstartsmpl2(unsigned short FlibHndl,short path, short condition, TRG_DATA trg_data);


FlibHndl   [ in ]

Specify the library handle. See "Library handle" for details.

path   [ in ]

When sequence number is set to triger, specify CNC path number.

condition   [ in ]

trigger information

SEQ:set sequence number to trigger
P_UP:set rise-up of the signal to trigger
P_DW:set rise-down of the signal to trigger

? When change of the signal is set to trigger, set 1 to P_UP and P_DW.

trg_data   [ in ]

Specified trigger data.

typedef struct trg_data {           /* trigger data */
    long seq_no;                    /* sequence number */
    typedef struct pmc_data{    /* PMC signal */
        short unittype;         /* PMC path (unit type)  */
        char adr;               /* kind of PMC address */
        unsigned char bit;      /* bit number */
        unsigned short no;      /* PMC address number */
    } pmc_trg;

The member of the pmc_trg structure is as follows.

PMC path (unit type)
0:not sampled (at this bit position)
1:1st PMC(include PMC-L)
2:2nd PMC(optional)
3:3rd PMC(optional)
4:4th PMC(optional)
5:5th PMC(optional)
9:Dual-check safety PMC(optional)
kind of PMC address
0:G(Signal to PMC->CNC)
1:F(Signal to CNC->PMC)
2:Y(Signal to PMC->machine)
3:X(Signal to machine->PMC)
4:A(Message display)
5:R(Internal relay)
7:K(Keep relay)
9:D(Data table)
10:M(Input signal from other PMC path)
11:N(Output signal to other PMC path)
12:E(Extra relay)
?T(Timer)·C(Counter) address cannot be sampled.
bit number of PMC address
PMC address number


EW_OK is returned on successful completion, otherwise any value except EW_OK is returned.

The major error codes are as follows.

Return code Meaning/Error handling
condition is wrong.
Channel data setting is invalid.
Channel data setting is not completed.
Trigger option of signal is not set.
Path number is wrong.
CNC execution denied
In order to get more information for this err_no return value, execute cnc_getdtailerr function.
1:Sampling already started.
Execute this function again after executing of cnc_sdtcancelsmpl or cnc_sdtendsmpl.
20:PMC signal setting(unit type) is wrong.
21:PMC signal setting(kind of PMC address) is wrong.
22:PMC signal setting(PMC address number) is wrong.
23:PMC signal setting(bit number) is wrong.
4:the others

As for the other return codes or the details, see "Return status of Data window function"

CNC option

For HSSB connection,

    The extended driver/library function is necessary.

For Ethernet connection,

    The Ethernet function and the extended driver/library function are necessary.

    However, in case of 0i-D/F, Series 30i and PMi-A, the required CNC option is as follows.

    When Embedded Ethernet is used,

    above two optional functions are not required.

    When Ethernet board is used,

    only Ethernet function is required.

CNC parameter

This function is not related to CNC parameter.

CNC mode

This function can be used in any CNC mode.

Available CNC

0i-A 0i-B/C(Note) 0i-D 0i-F 15 15i 16 18 21 16i-A 18i-A 21i-A 16i-B 18i-B 21i-B 30i-A 30i-B
M (Machining)X X X O X X X X X X X X X X X X O
T (Turning) X X X O X - X X X X X X X X X X O
LC (Loader) - - - - - - X X X X X X X X X - -

P (Punch press)X X X X - X
L (Laser) - - X - - X
W (Wire) - - X X X X

Power Mate i-DX
Power Mate i-HX
Power Motion i-AX

"O" : Both Ethernet and HSSB
"E" : Ethernet
"H" : HSSB
"X" : Cannot be used
"-" : None

Note) 0i-C does not support the HSSB function.

See Also

cnc_sdtclrchnl   cnc_sdtsetchnl2   cnc_sdtcancelsmpl   cnc_sdtreadsmpl2   cnc_sdtendsmpl2   cnc_sdtread1shot  

Privacy notice

This website uses cookies. By continuing to use it you agree to our privacy policy.

Fanuc Focas Library | Motor | cnc_loadtorq

Reads abnormal load torque data (estimated load torque) of servo motors or spindle motors. Data is stored in ODBLOAD structure in signed binary form. motor... [read more]

Fanuc Focas Library | Motor | cnc_rdctrldi

Reads control input signal for spindle monitor.... [read more]

Fanuc Focas Library | Motor | cnc_rdctrldo

Reads control output signal for spindle monitor.... [read more]

Fanuc Focas Library | Motor | cnc_rdcurrent

Reads The servo adjustment real current. When the following parameter is '0', '0' is... [read more]

Fanuc Focas Library | Motor | cnc_rdfromservoid2

Read specified servo id information from FROM. Each information is stored in member of the ODBCSVID2 structure.... [read more]

Fanuc Focas Library | Motor | cnc_rdfromspindleid2

Read specified spindle id information from FROM. Each information is stored in member of the ODBCSPID2 structure.... [read more]

Fanuc Focas Library | Motor | cnc_rdloopgain

Reads The servo adjustment loop gain.... [read more]

Fanuc Focas Library | Motor | cnc_rdnspdl

Reads the number of spindles which CNC can control. It is not the number of mounted spindles.... [read more]

Fanuc Focas Library | Motor | cnc_rdopmode

Reads The operation mode for spindle adjustment.... [read more]

Fanuc Focas Library | Motor | cnc_rdposerrs

Reads The position deflection S for spindle adjustment. The position deflection S is valid only when... [read more]

Fanuc Focas Library | Motor | cnc_rdposerrs2

Reads The position deflection S1, S2 for spindle adjustment in the synchronous control mode. The... [read more]

Fanuc Focas Library | Motor | cnc_rdposerrz

Reads The position deflection Z for spindle adjustment in the rigid tapping mode. The position... [read more]

Fanuc Focas Library | Motor | cnc_rdservoid2

Read specified servo id information from adaptation device. Each information is stored in member of the ODBCSVID2 structure.... [read more]

Fanuc Focas Library | Motor | cnc_rdspdlalm

Reads the alarm number corresponding to the message of spindle alarm for spindle monitor.... [read more]

Fanuc Focas Library | Motor | cnc_rdspindleid2

Read specified spindle id information from adaptation device. Each information is stored in member of the ODBCSPID2 structure.... [read more]

Fanuc Focas Library | Motor | cnc_rdsrvspeed

Reads The servo adjustment real speed.... [read more]

Fanuc Focas Library | Motor | cnc_rdsynerrrg

Reads The synchronous error for spindle adjustment in the rigid tapping mode. The synchronous error... [read more]

Fanuc Focas Library | Motor | cnc_rdsynerrsy

Reads The synchronous error for spindle adjustment in the synchronous control mode. The synchronous... [read more]

Fanuc Focas Library | Motor | cnc_sdtcancelsmpl

Cancel of sampling is notified. If you want to cancel the sampling after sampling starts, execute this function. This function can be... [read more]

Fanuc Focas Library | Motor | cnc_sdtclrchnl

The channel data setting for sampling is cleared. When you change the channel data number for sampling, beforehand execute this... [read more]

Fanuc Focas Library | Motor | cnc_sdtendsmpl

The end of sampling is notified. In case that the error occurred by cnc_sdtreadsmpl, execute this function.... [read more]

Fanuc Focas Library | Motor | cnc_sdtendsmpl2

The end of sampling is notified. In case that the error occurred by cnc_sdtreadsmpl2, execute this function.... [read more]

Fanuc Focas Library | Motor | cnc_sdtread1shot

Read the data for 8 channels that are set by cnc_sdtsetchnl function.... [read more]

Fanuc Focas Library | Motor | cnc_sdtreadsmpl

Reads the sampling data. (The cycle of sampling is 1msec.)... [read more]

Fanuc Focas Library | Motor | cnc_sdtreadsmpl2

Reads the sampling data. In case of using cnc_sdtstartsmpl2, acquire data immediately after the function call by this function. Trigger... [read more]

Fanuc Focas Library | Motor | cnc_sdtsetchnl

The channel data for the sampling of various data of Servo and Spindle are set. As for the data which can be acquired, refer to... [read more]

Fanuc Focas Library | Motor | cnc_sdtsetchnl2

The channel data for the sampling of various data are set. The setting to acquire servo, spindle information and ,in addition, PMC signal and CNC... [read more]

Fanuc Focas Library | Motor | cnc_sdtstartsmpl

The start of sampling is notified. When the block of the specified sequence number is executed, sampling is... [read more]

Fanuc Focas Library | Motor | cnc_wrfromservoid2

Write specified servo id information to FROM.... [read more]

Fanuc Focas Library | Motor | cnc_wrfromspindleid2

Write specified spindle id information to FROM.... [read more]

Fanuc Focas Library | Motor | flist_Motor

CNC: Function related to servo/spindle... [read more]
Modified: 2018-06-11