NewsCNCnetPDMAbout usSupport
  

CNC_ALLCLIBHNDL3 | HANDLE

Description

Allocates the library handle and connects to CNC that has the specified IP address or the Host Name.

Before executing this function, set the IP address and the port number of the FOCAS1/Ethernet (TCP) or FOCAS2/Ethernet (TCP) function on the CNC side correctly.

MTConnect Fanuc Adapter

Universal Fanuc Driver

Fanuc Focas Library CD

Declaration

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

FWLIBAPI short WINAPI cnc_allclibhndl3(const char *ipaddr, unsigned short port, long timeout, unsigned short *FlibHndl);

Arguments

ipaddr   [ in ]

Specify character string of CNC's IP address or Host Name to connect.
(Ex. "192.168.0.1" or "CNC-1.FACTORY")

port   [ in ]

Specify port number of the FOCAS1/Ethernet or FOCAS2/Ethernet (TCP) function.

timeout   [ in ]
Specify seconds for timeout. If specify 0, timeout process is ignored and the library functions wait infinity.

The best timeout value is different according as system. For example, in case of the hi-speed network system, 10 seconds is sufficient for timeout. But in case of relaying by low-speed telephone line, more than 60 seconds is well for timeout. So you must specify the timeout value after the measurement of your communication time.
FlibHndl   [ out ]

Specify pointer to variable including the library handle.
See "Library handle" for details.

Return

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
EW_SOCKET
(-16)
Socket communication error
Check the power supply of CNC, Ethernet I/F board, Ethernet connection cable.
EW_NODLL
(-15)
There is no DLL file for each CNC series
EW_HANDLE
(-8)
Allocation of handle number is failed.

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

CNC option

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

However, in case of Series 16i/18i/21i-B, 0i-B/C/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 E E E X E X X X E E E E E E E E
T (Turning) X E E E X - X X X E E E E E E E E
LC (Loader) - - - - - - X X X X X X X X X - -

0i-D0i-F16i18i30i-A30i-B
P (Punch press)E E E E - E
L (Laser) - - E - - E
W (Wire) - - E E E E


Power Mate i-DE
Power Mate i-HE
Power Motion i-AE

"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

freelibhndl   cnc_settimeout  

Example(C Language)


The following program let you connect a CNC where its IP address is
190.190.11.11 and its port number of the Ethernet (TCP) is 8193
and read the status information from it.
Timeout is 10 seconds right now.

#include "fwlib32.h"
void example( void )
{
    unsigned short h;
    short ret;
    ODBST buf;
    ret = cnc_allclibhndl3( "190.190.11.11", 8193, 10, &h ) ;
    if ( !ret ) {
            cnc_statinfo( h, &buf ) ;
            cnc_freelibhndl( h ) ;
    } else {
            printf( "ERROR!(%d)\n", ret ) ;
    }
}

Example(C#)


The following program let you connect a CNC where its IP address is
190.190.11.11 and its port number of the Ethernet (TCP) is 8193
and read the status information from it.
Timeout is 10 seconds right now.

class example
{
    public void sample()
    {
        ushort h;
        short ret;
        Focas1.ODBST buf = new Focas1.ODBST();
        ret = Focas1.cnc_allclibhndl3("190.190.11.11", 8193, 10, out h);
        if (ret == Focas1.EW_OK)
        {
                Focas1.cnc_statinfo(h, buf);
                Focas1.cnc_freelibhndl(h);
        }
        else
        {
                Console.WriteLine("ERROR!({0})", ret);
        }
    }
}

Privacy notice

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

https://www.inventcom.net/fanuc-focas-library/handle/cnc_allclibhndl3

Fanuc Focas Library | Handle | cnc_allclibhndl

Allocates the library handle which is used by the Data window library.... [read more]
Fanuc Focas Library | Handle | cnc_allclibhndl

Fanuc Focas Library | Handle | cnc_allclibhndl2

Allocates the library handle to the specified node number.... [read more]
Fanuc Focas Library | Handle | cnc_allclibhndl2

Fanuc Focas Library | Handle | cnc_freelibhndl

Frees the library handle which was used by the Data window library.... [read more]
Fanuc Focas Library | Handle | cnc_freelibhndl

Fanuc Focas Library | Handle | cnc_getlibopt

Reads the current status of FOCAS2 library's optional specifications. The readable... [read more]
Fanuc Focas Library | Handle | cnc_getlibopt

Fanuc Focas Library | Handle | cnc_rdnodeinfo

Reads the specified node information of the HSSB.... [read more]
Fanuc Focas Library | Handle | cnc_rdnodeinfo

Fanuc Focas Library | Handle | cnc_rdnodenum

Reads the number of node of the HSSB.... [read more]
Fanuc Focas Library | Handle | cnc_rdnodenum

Fanuc Focas Library | Handle | cnc_setdefnode

Sets the default node number which is allocated by... [read more]
Fanuc Focas Library | Handle | cnc_setdefnode

Fanuc Focas Library | Handle | cnc_setlibopt

Changes FOCAS2 library's optional specifications dynamically. The changeable options are... [read more]
Fanuc Focas Library | Handle | cnc_setlibopt

Fanuc Focas Library | Handle | cnc_settimeout

Changes timeout value, which is specified at allocating the library handle.... [read more]
Fanuc Focas Library | Handle | cnc_settimeout

Fanuc Focas Library | Handle | flist_Handle

CNC: Function Reference related to library handle, node... [read more]
Fanuc Focas Library | Handle | flist_Handle
Modified: 2023-12-05