User`s guide
Getting Started
14-11
The times2 model contains a simple S-function, called timestwo,thattakesthe
input sine wave signal and doubles its amplitude. The TLC file corresponding
to the S-function is shown below:
%% Copyright (c) 1994-98 by The MathWorks, Inc.
%%
%% Abstract:
%% TLC file for timestwo.c used in Real-Time Workshop
%% S-Function test.
%implements "timestwo" "Ada"
%% Function: Outputs
==========================================================
%function Outputs(block, system) Output
-- %<Type> Block: %<Name>
-- Multiply input by two
%<LibBlockOutputSignal(0, "", "", 0)> := ...
%<LibBlockInputSignal(0, "", "", 0) > * 2.0;
%endfunction
%% [EOF] timestwo.tlc
The key line in this TLC file is the assignment of two times the
LibBlockInputSignal to the LibBlockOutputSignal. This line directs the
Target Language Compiler to place the algorithm directly into the generated
Ada code.
This TLC file is located in
matlabroot/toolbox/simulink/blocks/tlc_ada/timestwo.tlc.
Generating the Ada Code
The build process is similar to the case where your model does not contain any
S-functions. The only additional requirement for generating Ada code for
models containing S-functions is to provide a TLC file with the same name as
the S-function. Otherwise, the build procedure is exactly the same.