MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Podręcznik Użytkownika Strona 268

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 386
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 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
Przeglądanie stron 267
1 2 ... 263 264 265 266 267 268 269 270 271 272 273 ... 385 386

Komentarze do niniejszej Instrukcji

Brak uwag