Memory usage for user-defined functions
To consume less memory in the
Micro800
controller, use a user-defined function (UDF) instead of a user-defined function block (UDFB) whenever possible.Calculation | UDF | UDFB | UDF Advantages | UDF Disadvantages |
---|---|---|---|---|
Execute once: C = A + B |
|
| Memory usage:
236 bytes less (28.78% less memory) than UDFB | The output parameter name is less flexible because the parameter name must be the same as the UDF name. |
Execute twice: C x = Ax + Bx |
|
| Memory usage:
384 bytes less (36.78% less memory) than UDFB | UDF can only monitor local variables for the last execution of the UDF. UDFB can monitor local variables for both instances. |
Memory consumption comparison between UDF and UDFB
Baseline: Empty project

UDF single execution main program

UDF definition

Controller memory after a single execution of the UDF

UDFB single execution main program

UDFB definition

Controller memory after a single execution of the UDFB

Controller memory after executing the UDF twice

Provide Feedback