Showing results for 
Search instead for 
Do you mean 
Solved! Go to solution

CSE - variable declaration

Hello everybody,


is it possible to use a declared variable out of a sub program (.spf) in the main program (.mpf)?


I know I can use the R-parameters, but this would be a bad solution.


Best wishes from Hamburg


Accepted by topic author VikP
‎09-07-2016 05:08 AM

Re: CSE - variable declaration

If the variable is declared inside the subprogram is will "removed/deleted" when return back to the main program, due to the fact that this is in another context.


In Sinumerik it is possible to call a subprogram with a parameter which can be changed inside the subrog and the result is still visible in the calling program. (Call by reference)


The related subprogram need to be declared at the start of the simulation with e.g.

EXTERN CallByRefSubprogram(VAR REAL)



Thomas Schulz
Siemens PLM
Manufacturing Engineering Software

Re: CSE - variable declaration

Hi Thomas,


it works. Thank you very much!

Learn online

Solution Information