Technical data
Writing a Block Target File
3-17
As an example, given S-function foo requiring a #define and two function 
declarations in the header file, you could define the following function.
%function BlockTypeSetup(block, system) void
%% Place a #define in the model's header file
%openfile buffer
#define A2D_CHANNEL 0
%closefile buffer
%<LibCacheDefine(buffer)>
%% Place function prototypes in the model's header file
%openfile buffer
void start_a2d(void);
void reset_a2d(void);
%closefile buffer
%<LibCacheFunctionPrototype(buffer)>
%endfunction
TLC Output Block Functions
The remaining block functions are Target Language Compiler output functions 
executed by the system target file 
mdlbody.tlc for each block in the model.
Enable(block, system)
Nonvirtual subsystem Enable functions are created whenever a Simulink 
subsystem contains an Enable block. Including the 
Enable function in a block’s 
TLC file places the block’s specific enable code into this subsystem 
Enable 
function. See 
sin_wave.tlc for an example of the Enable function.
Disable(block, system)
Nonvirtual subsystem Disable functions are created whenever a Simulink 
subsystem contains a Disable block. Including the 
Disable function in a block’s 
TLC file places the block’s specific disable code into this subsystem 
Disable 
function. See 
outport.tlc for an example of the Disable function.










