Why does the UDP Send Block not work with Code Generation?
11 views (last 30 days)
MathWorks Support Team on 7 Feb 2019
I am trying to compile a signal generator and send the signal through the UDP Send Block to other systems in my computer, but the UDP Send Block cannot be Code Generated, what can I do?
MathWorks Support Team on 21 Mar 2022
Edited: MathWorks Support Team on 21 Mar 2022
Only the UDP Send Block from the DSP System Toolbox is available for code generation. This UDP Send Block relies on precompiled DLLs that contain functions to pack the data in the required protocol. You can read more about it here in the C/C++ Code Generation section:
Fortunately, there is an option in the Configuration Parameters that allows you to pack these DLLs so that they're easy to find in the generated code. The instructions to use this option is here:
Once we have packed the code in a zip, we just need the DLLs to be placed next to the EXE if no further changes are made to "UDP Send Block".
This EXE runs as fast as possible. In order to accurately run the EXE in real-time, we recommend Simulink Desktop Real-Time. More information here:
Otherwise, you can build your own logic into the main.c function (using Sleep() or similar) to try and achieve real-time performance.