UDP Receive for Code Generation under Embedded Coder????

Hello again, I'm generating code with the Embedded Coder from the 2011a Matlab release, and I want to use a Simulink block from the Instrument Control Toolbox (UDP Receive) to get data from a Socket Connection. I manage to make it work perfectly while I simultate the model with Simulink, but when I generate code there are no code lines for the UDP Receive Block, except for the output assignment.
I'm doing something wrong or there is no way to create code from this block? Do I have to create my own S-function to solve this problem? Do I have to write an emedded matlab code block program for this purpouse or it will fail?
Thank you in advance.

Answers (1)

I don't believe these blocks are supported for code generation, because (I suspect) UDP communications are very target-specific. Which target are you using for generating code? If it's Windows, Linux, Embedded Linux or VxWorks, there are some OS-specific blocks provided in Simulink Coder and Embedded Coder that will work with code generation, see for example the UDP Receive block for Windows in Simulink Coder.
HTH,
Arnaud

4 Comments

I'm using the ert.tlc file to generate the code.
The platform where I'm going to place the code it's a Embedded Linux.
I already tryed to build my own S-function with the linux libraries but, Matlab on windows won't compile those functios (i tryed lcc compiler and the Visual Studio 2010 Express), I guess that the problem is OS-dependecies/compabilities.
So what do you think the next step should be? Create an atomic subsystem and change the called function in every different OS?
I'm going to try again the other UDP receive block, but it doesnt allow to configure the data output, so I'm not sure if it is going to be completely useful
Thank you anyway.
Use the UDP Receive block for Embedded Linux:
http://www.mathworks.com/help/releases/R2011a/toolbox/ecoder/ref/udpreceive.html
A good way to manage driver blocks across various platforms would be to use a Variant Subsystem (http://www.mathworks.com/help/toolbox/simulink/slref/variantsubsystem.html) that you can switch according to the platform.
It works!
I can simulate on windows and probably (i havent got time to test it) it will work on Linux.
Thank you very very much both of you!

Sign in to comment.

Asked:

on 3 Aug 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!