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.
Universal Fanuc Driver
Fanuc Focas Library CD
Declaration
Arguments
Specify character string of CNC's IP address or Host Name to connect.
(Ex. "192.168.0.1" or "CNC-1.FACTORY")
Specify port number of the FOCAS1/Ethernet or FOCAS2/Ethernet (TCP) function.
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.
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 |
---|---|
(-16) |
Check the power supply of CNC, Ethernet I/F board, Ethernet connection cable. |
(-15) |
|
(-8) |
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) | |||||||||||||||||
T (Turning) | - | ||||||||||||||||
LC (Loader) | - | - | - | - | - | - | - | - |
0i-D | 0i-F | 16i | 18i | 30i-A | 30i-B | |
---|---|---|---|---|---|---|
P (Punch press) | - | |||||
L (Laser) | - | - | - | - | ||
W (Wire) | - | - |
Power Mate i-D | |
Power Mate i-H | |
Power Motion i-A | E |
"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
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);
}
}
}