Target Language Compiler | ![]() ![]() |
Getting Started
In the example directory, the "external function" is found in the file my_alg.c
. You are also provided with a C S-function called wrapsfcn.c
that glues my_alg.c
into Simulink. Set up the exercise as follows:
tlctutorial/wrapper
to your working directory.
externalcode.mdl
from your working directory. The block diagram looks like the following.
wrapsfcn
does not exist. Can you figure out why?
The S-function block simply multiplies its input by two. If you activate the Scope block, you see a sine wave that oscillates between -2.0 and 2.0. The variable yout
that is created in your MATLAB workspace steps through these values.
In the remainder of the exercise, you build and run a stand-alone version of the model, then write some TLC code that allows Real-Time Workshop to build a stand-alone executable that calls the S-function my_alg.c
directly.
![]() | Why Wrap? | Generate Code Without a Wrapper | ![]() |