MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Guida Utente Pagina 268

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 386
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 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
Vedere la pagina 267
1 2 ... 263 264 265 266 267 268 269 270 271 272 273 ... 385 386

Commenti su questo manuale

Nessun commento