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
Go to Solution.
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)
it works. Thank you very much!