function reuse

The reuse of functions can be achieved in the following ways:
1. Add to the lib library
Create a lib library to store frequently used modules. When using, copy directly from the lib, and the generated functions can be reused.
2. The chart is reusable by default. The chart module
nested in the simulink model is auto reusable. To ensure successful reuse, the Function packing in Code Generation can be changed from the default auto mode to Reusable Function.
3. Reuse
of Right-click to select Treat as atomic unit in Block Parameters (subsystem). Then select Function packing as Reusable Function in Code Generation. Of course, you can also choose the function name. If the last item, file name options, is in non-auto mode, the reused function will be encapsulated in a new .c file.
4. You can also customize the module to achieve function reuse.
This not been used. If you are interested, you can try it yourself
 Note

  • The formal parameters of the multiplexing function cannot directly use global variables. If the multiplexing is unsuccessful, you can consider adding a data convertion or unit delay between the multiplexing module and the model, or adding a custom atomic module.

  • When the module is reused, it needs to be copied directly. If the module is changed, if the forced reuse mode is still selected, it cannot be compiled. If it is in the auto mode, the code will be generated inline.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325833465&siteId=291194637