Description
Reads the list of program numbers (program directory) of all NC programs registered in CNC.
Program numbers, comments and character numbers of programs included in specified program number range are read with ASCII string format.
Specify the start program number to be read in "datano_s" and the end one in "datano_e".
Store "datano_s=1" and "datano_e"=9999 to read all programs.
As for type=1 in series 15/15i, the range specification is invalid and all programs are always read.
In Series 16/18, 16i/18i, Power Mate i, it is possible to use this function for the program number 8 digits, however it is necessary to switch API to the one for the program number 8 digits.
In Series 15i, it is necessary to switch API to the one for the program number 8 digits.
See Program number 8 digits for details.
Format of input data
The program directory list which is read from CNC is the string composed of ASCII characters as the following format.
-
type=0 Oxxxx Oxxxx ... %
type=1 % LF Oxxxx (COMMENT) LF Oxxxx (COMMENT) LF ... LF %
type=2 Oxxxx (COMMENT) CHAR_NUMBER Oxxxx (COMMENT) CHAR_NUMBER ... %
where,
LF | 0x0A ('\n': EOB) |
Oxxxx | Program number. This is an ASCII string without the leading '0' at numeric part, and sorted in numeric order. ("O1" - "O9999") |
CHAR_NUMBER | Character number of the program. This is an ASCII string without the leading '0'. The number is raised to 80-character unit. |
COMMENT | The comment which is written just after the program number is stored. The maximum character number of the comment body is 48. (50 including the before and the behind parentheses.) Only beginning 48 characters are stored for the comment in case that the length of the comment is longer than 48 characters. If the program has no comment, only parentheses ("()") are stored. |
For all cases, when no program is registered or there is no program in the specified range, only '%' is stored.
A null character('\0') is not added at the end of each strings stored in the buffer.
For example, when the next programs are registered in CNC, the result of this function, in case that datano_s=1 and datano_e=9999, is as follows.
Program number (COMMENT) | Character number |
O0012 (TEST) ; | 420 |
O0200 (WORK1); | 352 |
O0201 ; | 537 |
O9001 (SUB-PRO1) ; | 781 |
type | Contents to be read |
0 | "O12O200O201O9001%" |
1 | "%\nO12(TEST)\nO200(WORK1)\nO201()\nO9001(SUB-PRO1)\n%" |
2 | "O12(TEST)420O200(WORK1)352O201()537O9001(SUB-PRO1)781%" |
If the buffer size is not enough for the specified programs, the buffer is filled up to the specified size.
In case of 15 bytes, the result is as follows.
type | Contents to be read |
0 | "O12O200O201O900" |
1 | "%\nO12(TEST)\nO20" |
2 | "O12(TEST)420O20" |
Universal Fanuc Driver
Fanuc Focas Library CD
Declaration
For the program number 8 digits :
FWLIBAPI short WINAPI cnc_rdprogdir(unsigned short FlibHndl,short type, long datano_s,long datano_e,unsigned short length, PRGDIR *prgdir);
Arguments : HSSB
Specify the library handle.
See "Library handle" for details.
0 | : | only the program number |
1 | : | program number and comment |
2 | : | program number, comment, and number of use characters. |
Specify the start program number.
Specify the end program number.
Specify the length of a block(buffer size).
Pointer to the PRGDIR structure including program directory.
The PRGDIR structure is as follows.
typedef struct prgdir {
char prg_data[MAX_PBUF] ; /* Directory data. */
} PRGDIR ; (MAX_PBUF : maximum character number to read)
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 |
---|---|
(1) |
This application is not customized for the program number 8 digits. See Program number 8 digits for details. |
(2) |
Length of the block (length) is illegal. |
(3) |
Start program number (datano_s) or end program number (datano_e) 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
And this function is related to the following CNC option.
- Series 15/15i Program name 48 characters
If this option does not exist, the maximum program name is 16 characters.
For HSSB connection,
The extended driver/library function is necessary.
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 | X |
"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_rdprogdir2 cnc_rdprogdir3 cnc_rdprogdir4