What do you do when the program will not fit in the machine?
NC programs are stored in the control, loaded into the NCK working memory (RAM) when needed and executed from there. For small programs this is no trouble at all.
But in die and mould work the geometry program coming out of CAM can reach 100 MB. A file that size can neither be stored in nor executed from the NCK working memory. The answer is to keep the program in external memory and read it in as it runs.
The command that does this is EXTCALL. This page covers the command itself and the program management logic around it.
EXTCALL syntax and short path designations, the default path in SD42700 and the search order, the reload memory (FIFO) and its size limit, the jump-command trap in external programs, Reset and POWER ON behaviour, and Siemens’ warning about USB.How a die program is structured: technology apart, geometry apart
Die programs are usually built in two parts:
- The main program carries all the technology: tool calls, spindle speeds, zero offset, tolerance setting (CYCLE832), coolant.
- The subprograms carry nothing but geometry:
G90followed by thousands of coordinate lines.
Tool changes define where the subprograms split. In other words, each tool gets its own geometry file.
The benefit is not only memory: you can change the technology without touching the geometry. If the speed is not right you change one line in the main program; you never open the three-million-line geometry file.
What can be used as external memory?
| Control | Available external memory |
|---|---|
| 840D sl | Local drive · Network drive · USB drive |
| 828D | User CF card · Network drive · USB drive |
If USB is used, the interface is defined too: on 840D sl, only the USB interfaces on the operator panel front or the TCU; on 828D, only the USB interface on the PPU front.
EXTCALL syntax
What goes in the brackets is a constant or variable of type STRING.
- Path may be absolute or relative, and is optional.
- Program name is specified without the
_N_prefix. - The file extension (
MPF,SPF) is optional and can be attached with_or.. All three forms are valid:"SHAFT","SHAFT_SPF","SHAFT.SPF".
Short path designations
| Designation | Meaning | Valid on |
|---|---|---|
LOCAL_DRIVE: | Local drive | 840D sl |
CF_CARD: | CF card | 840D sl (interchangeable with LOCAL_DRIVE) and 828D (user CF card) |
USB: | USB drive on the operator panel front | 840D sl and 828D |
Example
PCALL on ordinary subprograms does not work here. If you need to carry a value across, use an R parameter or a GUD.The default path: SD42700 and the search order
The path to the external program directory can be preset with a setting data:
With that set, you write only the program name in the main program and the control assembles the full path itself.
$SC_ prefix says so: Setting data, Channel-specific. It should not be confused with machine data.Where does the control look if you give no path?
With a relative path or no path at all, the search runs like this:
- If a path is preset in SD42700, the search starts there. The absolute path is formed by linking: the default path in SD42700 + the separator
/+ the path and program name given in the EXTCALL command. - If it is not found there, the directories of the user memory are searched.
The search ends the first time the subprogram is found. If it is not found at all, program execution is aborted at the EXTCALL line.
With an absolute path there is no search: if the subprogram exists at that path it runs, and if it does not, execution is aborted.
The reload memory (FIFO) — the limit most people miss
Executing an external subprogram requires a reload memory. The program is read into it in chunks, processed, and makes way for the next chunk.
- Default size: 30 KB.
- It can be changed only by the machine manufacturer, via
MD18360 MM_EXT_PROG_BUFFER_SIZE. - External subprograms executed in parallel need a separate reload memory each.
GOTOF, GOTOB, CASE, FOR, LOOP, WHILE, REPEAT, IF, ELSE, ENDIF — then the jump destinations must lie within the reload memory. A loop that jumps outside that 30 KB window will not work in an external program. Die geometry is usually plain coordinate lines so this rarely bites, but the moment you try to call a subprogram containing loops with EXTCALL, this is the wall you hit first.What happens on Reset, end of program and POWER ON?
- Reset and POWER ON interrupt external subprogram calls and delete the associated load memory.
- However, a program selected for “Execution from external source” stays selected for it after a reset or end of program. The behaviour is no different from internally selected programs, as long as the external program memory is still available.
In practice: pressing Reset resets the read position of the external program. To get back to where you were you need a block search — and with EXTCALL programs that has its own twist: the real interruption point is not in the main program but inside the called subprogram.
Common mistakes
Running production die work from a USB stick
Siemens explicitly advises against it. If the connection drops, machining stops on the spot.
Scattering the main program and subprograms across folders
If they are not in the same folder the path must be written out; if it is not, execution is aborted at the EXTCALL line.
Not deleting the old copy
The search stops at the first match. An old file on the SD42700 path beats the up-to-date one in user memory.
Trying to pass parameters to an external subprogram
It is not possible. Use an R parameter or a GUD to carry values.
Calling a subprogram containing loops with EXTCALL
It will not work if the jump destinations fall outside the reload memory.
Trying to edit a CF card program from the panel on an 828D
Programs executed from external memory cannot be edited on the panel. If the program is larger than the NCK memory it has to be edited externally, on a PC for example.
Writing the _N_ prefix in the program name
In EXTCALL the program name is written without the _N_ prefix.
Frequently asked questions
What is the difference between EXTCALL and a normal subprogram call?
A normal subprogram sits in NCK memory and can take parameters. A program called with EXTCALL is in external memory, is read in chunks and cannot take parameters.
Do I have to write the extension?
No, it is optional. "SHAFT", "SHAFT_SPF" and "SHAFT.SPF" are all valid.
Can I enlarge the reload memory?
Not yourself. MD18360 MM_EXT_PROG_BUFFER_SIZE is changed only by the machine manufacturer.
What happens if I pull the USB drive while the program is running?
Machining stops immediately and the tool or workpiece may be damaged. That is exactly why Siemens recommends not using a USB flash drive to execute an external subprogram.
How do I get back to where I was in an external program?
With a block search. But note: the real interruption point is not in the main program, it is inside the called subprogram; the search pointer asks for both levels. The practical route is to select the interruption point as the target.
Does this apply to an 828D as well?
The EXTCALL syntax, SD42700 and the no-parameter rule are the same on both. The difference is in the external memory options: 840D sl uses a local drive, 828D uses the user CF card, and the short path designations follow accordingly.
Sources
- Siemens AG — SINUMERIK 840D sl / 828D Job Planning, Programming Manual, 01/2015, document no. 6FC5398-2BP40-5BA2: Section 2.24.3.10 Execute external subprogram — 840D sl (pp.190–192) and 2.24.3.11 — 828D (p.193): syntax, short path designations, SD42700 $SC_EXT_PROG_PATH, search order, reload memory and MD18360, the jump-command restriction, the ShopMill/ShopTurn note, Reset/POWER ON behaviour and the USB notice
- Siemens AG — SINUMERIK Advanced CNC Operation and Programming, 05/2010: Section 2.8 Program data transfer and program management (the 100 MB geometry program problem, external memory hardware options), 2.10 Program structure for die making (technology/geometry split, the main program example with CYCLE832 and EXTCALL, the rule that all programs should be in one folder)