Subprogram (PAL)

Last change: Aug 24, 2022

Create a subprogram

There are two ways to create a subprogram in SYMplus™:

On the one hand, you can create a subprogram like a main program, i.e. either directly via the Start Assistant or via F1 File > F1 New. While the type "Main program" is preset, you must then only pay attention to change to "Subprogram". If necessary, you can also do this later via F1 File > F2 Settings. Pay attention also to the fact that a subprogram may not be named freely, but only a - max. 4-digit - number as name is allowed. Do not use L or % or any other letter or symbol additionally. 1234 is correct, L1234 or %1234 is not!

You can also create a subprogram directly from the main program. The moment you have marked an NC block in the main program with G22 ("Subprogram call"), F4 Open becomes active in the pictogram line below. If no subprogram with this number is yet found in the currently used folder (see also under "Troubleshooting" below), it will be newly created and later also automatically saved under the corresponding number when you exit the subprogram with "F10 Save, return to program call-up". There is a small "catch" with this method of creating or editing a subprogram. The possibility of changing to the free mode with F7 Editor is not available.

Troubleshooting

If the software reports an error in the G22 subroutine during the simulation, it reads:

Error: The sub-program is not availably or faulty!

"Faulty" can mean many things, it can be a formal error, e.g. a writing error, if the subroutine has been written separately in "free mode" and an error has occurred (e.g. GO instead of G0). But it can also be a circle end point error, which is not explicitly recognized and distinguished at this point. If you open the subprogram with F4 and do not recognize the error immediately, you should save the main program and open it via F1 File > F3 Open separately.

If you open it with F4 and it is empty, but you had previously created and written it via F1 File > F1 New, then this can have two causes:

a) You have chosen a wrong file name, no number or a too long number. Also L1234 is wrong, the subprogram must be called 1234, L is the address for the call! Then you have to rename the program.

b) You have saved it to a folder that is not the "active" folder and also not the "central subroutine folder". You can see which folder is the "active" one by selecting F1 File > F3 Save or F4 Open from the main menu. Note that the software does not "remember" a folder that you have selected F1 BrowseIf necessary, go via F2 Add ... and thus link the folder you want permanently. You can create a "central subroutine folder" in the Setup mode via F4 System configuration > F1 Presettings (!) > ... for each mode (PAL, PAL C/Y or PAL 3+2, ...) individually. This is useful, for example, for a subprogram that you want to call from different main programs, e.g. engraving a logo or a subprogram for tool change.

Both, renaming and moving to another folder, can be done via F1 File > F5 Management ..., or of course in the Windows File Manager (Explorer) if you are more familiar with it.