Description
Reads the management data of NC programs already registered in CNC.
The management data of NC program are
- Number of registered programs(In case of 0i-F, 30i, the number of the reserved folders by system are added.)
- Number of available programs
- Character number of used memory
- Character number of unused memory
Universal Fanuc Driver
Fanuc Focas Library CD
Declaration
Arguments
Specify the library handle. See "Library handle" for details.
Specify the output format.
0 | : | binary |
1 | : | ASCII |
Specify the length of data block.
12 | : | binary |
31 | : | ASCII |
prginfo Pointer to the ODBNC structure including the program directory.
The ODBNC structure is as follows.
typedef struct odbnc {
union {
struct {
short reg_prg ; /* Number of registered programs. */
short unreg_prg ; /* Number of available programs. */
long used_mem ; /* Character number of used memory. */
long unused_mem ;/* Character number of unused memory. */
} bin ;
char asc[31] ; /* Buffer for ASCII format */
} u ;
} ODBNC ;
- type=0
- Each data are stored in each members of the structure with binary format.
- type=1
- ASCII strings are stored in "prginfo.u.asc" with following format.
prginfo.bin.reg_prg | Number of registered programs. |
prginfo.bin.unreg_prg | Number of available programs. |
prginfo.bin.used_mem | Character number of used memory. |
prginfo.bin.unused_mem | Character number of unused memory. |
% LF d1 LF d2 LF d3 LF d4 LF %
LF | 0x0A ('\n') |
d1 | Number of registered programs |
d2 | Number of available programs |
d3 | Character number of used memory |
d4 | Character number of unused memory |
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 |
---|---|
(2) |
Length of the block (length) is illegal. |
(4) |
Output format (type) is illegal. |
As for the other return codes or the details, see "Return status of Data window function"
CNC option
For HSSB connection,
For Ethernet connection,
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 | O |
"O" | : | Both Ethernet and HSSB | |
"E" | : | Ethernet | |
"H" | : | HSSB | |
"X" | : | Cannot be used | |
"-" | : | None |
Note) 0i-C does not support the HSSB function.
Example(C Language)
The following program reads the management data of NC program, and displays them.
#include "fwlib32.h"
void example( void )
{
ODBNC buf ;
short ret ;
ret = cnc_rdproginfo( h, 0, 16, &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 ) ;
}
}
Example(C#)
The following program reads the management data of NC program, and displays them.
class example
{
public void sample()
{
Focas1.ODBNC_1 buf = new Focas1.ODBNC_1();
short ret;
ret = Focas1.cnc_rdproginfo(h, 0, 16, buf);
if (ret != Focas1.EW_OK)
{
Console.WriteLine("ERROR: {0}", ret);
}
else
{
Console.WriteLine("Registered program number = {0}",
buf.reg_prg);
Console.WriteLine("Registerable program number = {0}",
buf.unreg_prg);
Console.WriteLine("Used memory = {0}",
buf.used_mem);
Console.WriteLine("Free memory = {0}",
buf.unused_mem);
}
}
}