The conditions of the function about CNC mode and the kind of programare as follows.
EDIT mode
MDI mode
Other mode
MDI program
×
O
×
Selected program
O
×
×
Not selected program
O
O
O
O: Available / ×: Not available (The return code is EW_MODE)
This function works normally if OP signal is 1 but STL signal is 0
(for example, feed hold stopping, single block stopping, etc).
The return value of this function and the position of the execution pointer change as follows by the existence of the playback option.
Upper : With the playback option
Lower : Withouit the playback option
1) Search of the word in selected program (main program).
Mode
MEM
MEM
EDIT
EDIT
MDI
JOG/HNDL
Others
Operation status
Auto run (OP=1,STL=1)
Stop/Halt (OP=1,STL=0)
Stop/Halt (OP=1,STL=0)
Idle mode (OP=0,STL=0)
Idle mode (OP=0,STL=0)
Idle mode (OP=0,STL=0)
Idle mode (OP=0,STL=0)
Return value of cnc_pdf_searchword
EW_REJECT
EW_OK
EW_OK
EW_OK
EW_OK
EW_OK
EW_REJECT
EW_MODE
EW_MODE
EW_MODE
EW_MODE
Pointer movement of selected program
None
Moves
Moves
Moves
Moves(*1)
Moves
None
None
None(*1)
None
Pointer movement in the executing screen
None
Moves
Moves
Moves
Moves(*1)
Moves
None
None
None(*1)
None
(*1) The mode was switched from MDI to EDIT/MEM and the pointer position was confirmed.
2) Search of the word in unselected program (not main program).
Mode
MEM
MEM
EDIT
EDIT
MDI
JOG/HNDL
Others
Operation status
Auto run (OP=1,STL=1)
Stop/Halt (OP=1,STL=0)
Stop/Halt (OP=1,STL=0)
Idle mode (OP=0,STL=0)
Idle mode (OP=0,STL=0)
Idle mode (OP=0,STL=0)
Idle mode (OP=0,STL=0)
Return value of cnc_pdf_searchword
EW_OK
EW_OK
EW_OK
EW_OK
EW_OK
EW_OK
EW_OK
Pointer movement of selected program
None
None
None
None
None
None
None
Pointer movement in the executing screen
None
None
None
None
None
None
None
3) Search of the word in MDI program.
Mode
MDI
MDI
MDI
Others
Operation status
Auto run (OP=1,STL=1)
Stop/Halt (OP=1,STL=0)
Idle mode (OP=0,STL=0)
Idle mode (OP=0,STL=0)
Return value of cnc_pdf_searchword
EW_REJECT
EW_OK
EW_OK
EW_MODE
Pointer movement of selected program
None
None(*2)
Moves
None
Moves
Pointer movement in the executing screen
None
Moves
Moves
None
None(*3)
(*2) In cnc_pdf_rdactpt though it doesn't move, running is restarted from the block where the searched word exists. (*3) In the executing screen though it doesn't move, running is restarted from the block where the searched word exists.
4) MEM running:Search of the word in main program during subprogram call(M98).
Mode
MEM
MEM
EDIT
Operation status
Auto run (OP=1,STL=1)
Stop/Halt (OP=1,STL=0)
Stop/Halt (OP=1,STL=0)
Return value of cnc_pdf_searchword
EW_OK
EW_OK
EW_OK
Pointer movement of Main program (Execution position at returning from subprogram)
None
None
None
5) MEM running:Search of the word in main program during macro program call(G65).
Mode
MEM
MEM
EDIT
Operation status
Auto run (OP=1,STL=1)
Stop/Halt (OP=1,STL=0)
Stop/Halt (OP=1,STL=0)
Return value of cnc_pdf_searchword
EW_OK
EW_OK
EW_OK
Pointer movement of Main program (Execution position at returning from macro program)
None
None
None
6) MEM running:Search of the word in main program during external subprogram call(M198).
Mode
MEM
MEM
EDIT
Operation status
Auto run (OP=1,STL=1)
Stop/Halt (OP=1,STL=0)
Stop/Halt (OP=1,STL=0)
Return value of cnc_pdf_searchword
EW_OK
EW_OK
EW_OK
EW_MODE
Pointer movement of Main program (Execution position at returning from external subprogram)
None
Moves(*4)
Moves(*4)
None
(*4) It moves to the block where the searched word exists.
7) MEM running:Search of the word in subprogram during subprogram call(M98).
Mode
MEM
MEM
EDIT
Operation status
Auto run (OP=1,STL=1)
Stop/Halt (OP=1,STL=0)
Stop/Halt (OP=1,STL=0)
Return value of cnc_pdf_searchword
EW_REJECT
EW_OK
EW_OK
EW_MODE
Pointer movement of Sub program
None
Moves
Moves
None
8) MEM running:Search of the word in macro program during macro program call(G65).
Mode
MEM
MEM
EDIT
Operation status
Auto run (OP=1,STL=1)
Stop/Halt (OP=1,STL=0)
Stop/Halt (OP=1,STL=0)
Return value of cnc_pdf_searchword
EW_REJECT
EW_OK
EW_OK
EW_MODE
Pointer movement of Macro program
None
Moves
Moves
None
9) MDI running:Search of the word in MDI program during subprogram call(M98).
Mode
MDI
MDI
Operation status
Auto run (OP=1,STL=1)
Stop/Halt (OP=1,STL=0)
Return value of cnc_pdf_searchword
EW_REJECT
EW_DATA(*5)
Pointer movement of MDI program
None
Moves(*6)
(*5) EW_DATA is the return value of cnc_pdf_cnc_pdf_searchresult(The return value of nc_pdf_searchword is EW_OK). (*6) It moves to the end block of the program of MDI.
10) MDI running:Search of the word in MDI program during macro program call(G65).
Mode
MDI
MDI
Operation status
Auto run (OP=1,STL=1)
Stop/Halt (OP=1,STL=0)
Return value of cnc_pdf_searchword
EW_REJECT
EW_DATA(*7)
Pointer movement of MDI program
None
Moves(*8)
(*7) EW_DATA is the return value of cnc_pdf_cnc_pdf_searchresult(The return value of nc_pdf_searchword is EW_OK). (*8) It moves to the end block of the program of MDI.
11) MDI running:Search of the word in MDI program during external subprogram call(M198).
Mode
MDI
MDI
Operation status
Auto run (OP=1,STL=1)
Stop/Halt (OP=1,STL=0)
Return value of cnc_pdf_searchword
EW_REJECT
EW_OK
Pointer movement of MDI program
None
Moves(*9)
(*9) It moves to the block where the searched word exists.
12) MDI running:Search of the word in sub program during subprogram call(M98).
Mode
MDI
MDI
Operation status
Auto run (OP=1,STL=1)
Stop/Halt (OP=1,STL=0)
Return value of cnc_pdf_searchword
EW_REJECT
EW_OK
Pointer movement of MDI program
None
None
13) MDI running:Search of the word in macro program during macro program call(G65).
#include "fwlib32.h" or "fwlib64.h"FWLIBAPI short WINAPI cnc_pdf_searchword(unsigned short FlibHndl, char *prog_name, unsigned long line_no,
unsigned long search_type,unsigned long search_direct, unsigned long repeat, char* buffer );
Arguments
FlibHndl
[ in ]
Specify the library handle. See "Library handle" for details.
prog_name
[ in ]
Program path makes of the "drive name","path name" and "file name".
Please refer to "General Description (Specifying the folder and file name for FS30i, 0i-D/F and PMi-A.)" for details of the file name.
If the value of "prog_name" is NULL, the previous progaram name is specifed.
When you use this function for the MDI program , you have to be specifed the "MDI".
line_no
[ in ]
Specify the line number to search from.
When you search from the first line of a program, you have to specify 0.
When you specify other than the existing line number, this function never returns error result as the return code.
In this case, next cnc_pdf_searchresult function would return EW_NUMBER error.
type
[ in ]
Specify the type of the search operation.
0
:
Character search (Search the one address character.)
1
:
Word search (Search the string by word basis.)
2
:
Last line search (Search the bottom of line)
When you commands "Character search", you have to set the only one address character as the target string.
If you set except the address character or more than two characters, this function returns EW_DATA error.
When you commands "Word search" for the only one address character, you have no error and the address character is going to be searched.
When you commands "Last line search", this function ignores the parameters direct, repeat and prog_data.
direct
[ in ]
Specify the direction to search.
0
:
Search towards the top of the program.
1
:
Search towards the bottom of the program.
repeat
[ in ]
Specify the limitation of times the string is found when there are many strings matching within the program.
If you specify 0, this function returns EW_DATA error.
prog_data
[ in ]
Specify the pointer to the buffer holding the target string to search.
It is a NULL terminated ASCII string. The size of string, including NULL character, must be within 128. If it were more than 128, this function would return EW_DATA error.
The first character of the string must be an address character (G, F, etc).
You cannot search for the macro string or the characters in the macro string.
After the address character, the next character must be a number, '+', '-' or '-'.
If you use one of the following characters, you get EW_DATA error as the return code.
Except the available code for CNC
The small letter of alphabets
Address 'O' or the string consisted of 'O' + program number
'%'(EOR)
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_BUSY (-1)
Busy
CNC is searching the program text right now.
EW_DATA (5)
Data error
In order to get more information for this err_no return value, execute cnc_getdtailerr function.
The following detail status will be set onto the member, err_no of ODBERR structure.
1
:
The program name(prog_name) error
3
:
The search type(search_type) error
4
:
The search direction(search_direct) error
5
:
The repeat count(repeat) error
6
:
The size of string error
7
:
The content of the string error
EW_NOOPT (6)
No option
The extended driver/library function is necessary.
EW_PROT (7)
Write protection in CNC side
CNC parameter is a state of write-protection(O8000-/O9000- protection, encoding).
EW_MODE (12)
CNC mode error
EW_REJECT (13)
CNC execution denied
- CNC is in the emergency stop.