User`s guide

Step-by-Step Example of Fortran and xPC Target
11-5
Step-by-Step Example of Fortran and xPC Target
This example uses the demo Atmosphere model that comes with Simulink. The
following procedures require you to know how to write Fortran code
appropriate for Simulink and xPC Target. See “Creating Fortran S-Functions”
in the writing S-Functions documentation for these details.
This section includes the following topics:
“Creating an xPC Target Atmosphere Model for Fortran” on page 11-5
“Compiling Fortran Files” on page 11-7
“Creating a C-MEX Wrapper S-Function” on page 11-9
“Compiling and Linking the Wrapper S-Function” on page 11-9
“Validating the Fortran Code and Wrapper S-Function” on page 11-10
“Preparing the Model for the xPC Target Application Build” on page 11-11
“Building and Running the xPC Target Application” on page 11-13
Before you start, you should create an xPC Target Simulink model for the
Atmosphere model. See “Creating an xPC Target Atmosphere Model for
Fortran” on page 11-5.
Creating an xPC Target Atmosphere Model for
Fortran
To create an xPC Target Atmosphere model for Fortran, you need to add an
xPC Target Scope block to the
sfcndemo_atmos model. Perform this procedure
if you do not already have an xPC Target Atmosphere model for Fortran.
1 From the MATLAB window, change directory to the working directory, for
example,
xpc_fortran_test.
2 Type
sfcndemo_atmos
The sfcndemo_atmos model is displayed.
3 Add an xPC Target Scope block of type Target.