
Parameter access
●
Do not access parameters more often than necessary.
●
Process string parameters in a separate task, because this requires a
lot of calculating time.
●
Access to parameters via direct variables is significantly faster than
functions.
●
Access to parameters via functions is faster than function blocks.
●
Access to local list parameters (Axis1) requires a relatively long calculat‐
ing time and should either be outsourced to a slower task or carried out
element-by-element
with
"MX_fReadParamDINT()"
/
"WriteParamDINT()".
Functions /function blocks
●
If the same function blocks or functions are used several times in a task
cycle, they should be called in direct succession, if possible (cache ef‐
fect!).
●
Only call function blocks as long as necessary - especially cyclic func‐
tion blocks.
●
A constant value can already be assigned to a function block parameter
at declaration.
●
Outputs of function blocks can be directly read, it is not necessary to as‐
sign them to a variable.
Check function
The check function detects and avoids incorrect access. The checks are run
for pointer access, array access, range limits, division by 0… When the fre‐
quently processed code has been sufficiently checked, this automatic check
(implicit check function) can be switched off.
Example:
Switching off the implicit check function
In this case, runtime checks are not run within the POU:
{attribute 'no check'}
FUNCTION MyFunc : INT
Structured programming
●
Using subfunctions or subfunction blocks only provides higher perform‐
ance if these functions/function blocks are used several times.
●
By means of CASE instruction, different code branches can be system‐
atically processed according to the status of the functionality or applica‐
tion.
●
Transmission parameters / return values to functions and function
blocks should be as compact as possible. In the case of large data
quantities, access the data in global form, or transmit them via
VAR_IN_OUT
or
REFERENCE
.
DOK-INDRV*-MLD3-**VRS*-AP02-EN-P
Bosch Rexroth AG
235/267
Rexroth IndraDrive Rexroth IndraMotion MLD (2G) as of MPx-18
Programming information
LSA Control S.L. www.lsa-control.com [email protected] (+34) 960 62 43 01