MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Uživatelská příručka Strana 268

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 386
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 267
10 Targeting Custom Hardware
10-10
Figure 10-1: Format of a Device Driver S-Function
#define S_FUNCTION_NAME filename
Define a name for the entry point function:
Include the definition of the Simulink
data structure (SimStruct):
#include "simstruc.h"
Initialize the size information in the
mdlInitializeSizes(S)
Readfromorwritetohardware(depending
SimStruct:
mdlOutputs(y,x,u,S)
Obtain dialog box parameters and
mdlInitializeConditions(x0,S)
Include code generator header file:
#include "cg_sfun.h"
Set the block’s sample time to the sample
time specified in the dialog box:
mdlInitializeSampleTimes(S)
Device Driver
Clean up after completion of program:
mdlTerminate(S)
on whether the block is for input or output):
S-Function
initialize the board:
Include MEX header file:
#include "simulink.c"
Define the S-function as level 2:
#define S_FUNCTION_LEVEL 2
Include the MEX header file:
#ifdef MATLAB_MEX_FILE
#include "mex.h"
#endif
Zobrazit stránku 267
1 2 ... 263 264 265 266 267 268 269 270 271 272 273 ... 385 386

Komentáře k této Příručce

Žádné komentáře