www.gusucode.com > rtwdemos 工具箱matlab源码程序 > rtwdemos/rtwdemo_pcgd_intro_script.m
%% Introduction % % This example shows how to use the Embedded Coder(R) product to generate % code for a supplied Simulink(R) control algorithm model, integrate the % generated code with an existing system, and validate simulation and % executable results. % %% Format % This example consists of the following seven modules: % % * Understanding the Model % * Configuring the Data Interface % * Function Partitioning within the Generated Code % * Calling External C Code from the Simulink(R) Model and Generated Code % * Integrating the Generated Code into the External Environment % * Testing the Generated Code % * Evaluating the Generated Code % % Each module provides the following information and builds on what you learned % and generated in previous modules: % % * Estimated completion time % * Goals % * Background information, models, tasks, and task activation links that % help you achieve the module goals % * Links to the previous and next modules % * Links to more information about module topics, including alternative % methods for completing tasks % % This example uses scripts that simplify use of the example. Everything that is done % by script can be done from the MATLAB(R) prompt or from Simulink(R) menus. % You execute a script by clicking a Task link. % For example, click the following link to execute a script that briefly % displays the dialog box shown after the link: % % <matlab:RTWDemos.pcgd_example_script *Task:* Run a script to show a dialog box.> % % <<exampleScript.jpg>> % %% Prerequisite Knowledge % This example assumes the following prerequisite knowledge: % % MathWorks(R) products % % * How to read, write, and apply MATLAB scripts % * How to create a basic Simulink(R) and Stateflow(R) model % * How to run Simulink(R) simulations and evaluate the results % % C programming % % * C data types and storage classes % * Function prototypes and methods of calling functions % * How to compile a C function % % Metrics for evaluating embedded software % % * Basic code readability issues % * RAM/ROM usage % %% Using This Example % Each module focuses on a specific aspect of code generation or integration. % You can complete the modules independently, during different sessions, or % in a single session. The total estimated completion time is four hours. % % For most tasks, you have the option of completing the task on % your own by following the instructions, or you can execute a script by % clicking its <matlab:why; *Task:*> link. Some scripts require % time to run. In such cases, a dialog box appears when the task is complete. % If the link fails, error messages appear in the MATLAB Command Window. % % Each module has a unique model and data set. As a result, the modules are % independent and do not have to run in a specific order. When you transition % between modules, the example saves the current model locally, capturing your % modifications to the model and model data. % % To recover a model in its original state, delete the local copy of the % model and model data. The model data is saved as |PCG_Demo_#_data.mat|. % %% Third-Party Software % The modules *Integrating the Generated Code into the External Environment* % and *Testing the Generated Code* use the Eclipse(TM) IDE and the Cygwin(TM)/gcc % compiler. Instructions on how to install and use Eclipse(TM) and Cygwin(TM)/gcc % appear at the end of the example in *Installing and Using Cygwin(TM) and Eclipse(TM)*. % Copyright 2007-2012 The MathWorks, Inc.