Real-Time Windows Target ® For Use with Real-Time Workshop User’s Guide Version 2
How to Contact The MathWorks: www.mathworks.com comp.soft-sys.matlab Web Newsgroup info@mathworks.com Technical support Product enhancement suggestions Bug reports Documentation error reports Order status, license renewals, passcodes Sales, pricing, and general information 508-647-7000 Phone 508-647-7001 Fax The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098 Mail support@mathworks.com suggest@mathworks.com bugs@mathworks.com doc@mathworks.com service@mathworks.
Contents Getting Started 1 What Is the Real-Time Windows Target? . . . . . . . . . . . . . . . . 1-2 Expected User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Real-Time Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Real-Time Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Signal Acquisition and Analysis . . .
System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 Hardware Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 Software Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 Real-Time Windows Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 Getting or Updating Your License . . . . . . . . . . . . . . . . . . . . . . . 2-8 Installing from a CD . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Real-Time Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Entering Simulation Parameters for Real-Time Workshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating a Real-Time Application . . . . . . . . . . . . . . . . . . . . . . . Entering Additional Scope Parameters for Signal Tracing . . . Running a Real-Time Application . . . . . . . . . . . . . . . . . . . . . . . Running a Real-Time Application from the MATLAB Command Line . . . . . . . . . . . . .
I/O Driver Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7 Real-Time Windows Target Library . . . . . . . . . . . . . . . . . . . . . . 4-7 Simulink Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9 Analog Input Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10 Analog Output Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12 Digital Input Block . . . . . . . . . . . . . . . . . . .
Supported I/O Boards Reference A Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2 ISA Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2 PCMCIA Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-10 PCI Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-11 Compact PCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vi Contents
1 Getting Started The Real-Time Windows Target has many features. An introduction to these features and the Real-Time Windows Target software environment will help you develop a model for working with Real-Time Windows Target. What Is the Real-Time Windows Target? (p. 1-2) A PC solution for prototyping and testing real-time systems Features (p. 1-4) Real-time kernel, real-time application, signal acquisition and analysis, and parameter tuning Hardware Environment (p.
1 Getting Started What Is the Real-Time Windows Target? The Real-Time Windows Target is a PC solution for prototyping and testing real-time systems. It is an environment where you use a single computer as a host and target. In this environment you use your desktop or laptop PC with MATLAB®, Simulink®, and Stateflow® (optional) to create models using Simulink blocks and Stateflow diagrams.
What Is the Real-Time Windows Target? Expected User To benefit from reading this book, you should be familiar with • Using Simulink and Stateflow to create models as block diagrams, and simulating those models in Simulink • The concepts and use of Real-Time Workshop to generate executable code When using Real-Time Workshop and the Real-Time Windows Target, you do not need to program in C or other low-level programming languages to create and test real-time systems.
1 Getting Started Features The Real-Time Windows Target software environment includes many features to help you prototype and test real-time applications. This section includes the following topics: • “Real-Time Kernel” on page 1-4 • “Real-Time Application” on page 1-5 • “Signal Acquisition and Analysis” on page 1-6 • “Parameter Tuning” on page 1-7 Real-Time Kernel The Real-Time Windows Target uses a small real-time kernel to ensure that the real-time application runs in real time.
Features • Scheduler — The timer interrupt clocks a simple scheduler that runs the executable. The number of tasks is equal to the number of sampling periods in the model with multitasking mode. With single-tasking mode, there is only one task. The maximum number of tasks is 32, and faster tasks have higher priorities than slower tasks. For example, a faster task can interrupt a slower task. During execution, the executable stores data in buffers.
1 Getting Started • Relation to the kernel — The executable must be loaded and executed directly by the Real-Time Windows Target kernel. It cannot be executed without the kernel. The kernel runs as a kernel-mode driver, intercepts timer interrupts from the PC clock, maintains clock signals for the Windows operating system, and ensures real-time execution of the real-time application. As a result, both the kernel and the real-time application run at CPU ring zero.
Features For more information, see “Signal Logging to the MATLAB Workspace” on page 3-30 and “Signal Logging to a Disk Drive” on page 3-38. Parameter Tuning Change the parameters in your Simulink model and observe the effect of those changes during a simulation or while running an application in real time. Simulink external mode — You use Simulink external mode to connect your Simulink block diagram to your real-time application.
1 Getting Started Hardware Environment The hardware environment consists of a PC-compatible computer and I/O boards. This section includes the following topics: • “PC-Compatible Computer” on page 1-8 • “Input/Output Driver Support” on page 1-8 PC-Compatible Computer You can use any PC-compatible computer that runs Windows NT 4.0, Windows 2000, or Windows XP. Your computer can be a desktop, laptop, or notebook PC.
Hardware Environment I/O driver block library — The Real-Time Windows Target provides a custom Simulink block library. The I/O driver block library contains universal drivers for supported I/O boards. These universal blocks are configured to operate with the library of supported drivers. This allows easy location of driver blocks and easy configuration of I/O boards. You drag and drop a universal I/O driver block from the I/O library the same way as you would from a standard Simulink block library.
1 Getting Started Software Environment The software environment is a place to design, build, and test an application in nonreal time and real time. This section includes the following topics: • “Non-Real-Time Simulation” on page 1-10 • “Real-Time Execution” on page 1-10 • “Development Process” on page 1-11 Non-Real-Time Simulation You create a Simulink model and use Simulink in normal mode for non-real-time simulation on your PC computer.
Software Environment Real-time execution — The Real-Time Windows Target provides the necessary software that uses the real-time resources on your computer hardware. Based on your selected sample rate, the Real-Time Windows Target uses interrupts to step your application in real time at the proper rate. With each new interrupt, the executable computes all of the block outputs from your model.
1 Getting Started System Concepts A more detailed understanding of Real-Time Workshop and the Real-Time Windows Target can help you when creating and running your real-time applications.
System Concepts Data Buffers and Transferring Data At each sample interval of the real-time application, Simulink stores contiguous data points in memory until a data buffer is filled. Once the data buffer is filled, Simulink suspends data capture while the data is transferred back to MATLAB through Simulink external mode. Your real-time application, however, continues to run. Transfer of data is less critical than maintaining deterministic real-time updates at the selected sample interval.
1 Getting Started 1-14
2 Installation and Configuration The Real-Time Windows Target requires the installation of MATLAB, Simulink, Real-Time Workshop, and the Real-Time Windows Target kernel. Also, make sure you set your working directory outside the MATLAB root directory. Required Products (p. 2-2) MATLAB®, Simulink®, Real-Time Workshop®, and the Real-Time Windows Target Related Products (p.
2 Installation and Configuration Required Products The Real-Time Windows Target is a self-targeting system where the host and the target computer are the same computer. You can install it on a PC-compatible computer running Windows NT 4.0, Windows 2000, or Windows XP.
Required Products Simulink Simulink provides an environment where you model your physical system and controller as a block diagram. You create the block diagram by using a mouse to connect blocks and a keyboard to edit block parameters. Unsupported Simulink blocks — You can use the Real-Time Windows Target with most Simulink blocks including discrete-time and continuous-time systems. The Real-Time Windows Target does not support blocks that do not run in real time nor does it support To File blocks.
2 Installation and Configuration Real-Time Workshop Real-Time Workshop provides the utilities to convert your Simulink models into C code, and then, with the Open Watcom C/C++ compiler, compile the code into a real-time executable. The Real-Time Windows Target is designed for maximum flexibility during rapid prototyping. This flexibility allows parameter tuning and signal tracing during a real-time run, but increases the size of the generated code.
Related Products Related Products The MathWorks provides several products that are especially relevant to the kinds of tasks you can perform with the Real-Time Windows Target. For more information about any of these products, see either The online documentation for that product if it is installed or if you are reading the documentation from the CD • The MathWorks Web site, at http://www.mathworks.
2 Installation and Configuration System Requirements The Real-Time Windows Target requires a PC-compatible computer. This section includes the following topics: • “Hardware Requirements” on page 2-6 • “Software Requirements” on page 2-7 Hardware Requirements The following table lists the minimum hardware resources the Real-Time Windows Target requires on your computer.
System Requirements Software Requirements The Real-Time Windows Target 2.5 has certain product prerequisites that must be met for proper installation and execution. The following table lists the software you need to install on your computer to run the Real-Time Windows Target. Software Description Operating system On supported Windows platforms MATLAB 7.0 On the Release 14 CD. Allows installation of Simulink. Simulink 6.0 On the Release 14 CD Real-Time Workshop 6.0 On the Release 14 CD.
2 Installation and Configuration Real-Time Windows Target The Real-Time Windows Target (Version 2.5) is available on CD or as a Web downloadable. If you installed the Real-Time Windows Target (Version 1.0, 1.5, or 2.2) and the kernel — You need to uninstall the kernel before you can install the Real-Time Windows Target (Version 2.5). This removes the old version of the kernel. If you did not install the Real-Time Windows Target (Version 1.0, 1.5, or 2.
Real-Time Windows Target Installing from a CD Real-Time Windows Target (Version 2.5) is distributed on the MathWorks Release 14 CD with the general installation program. After you get a valid Personal License Password (PLP), you can install the Real-Time Windows Target software. For detailed information about the installation process, see the MATLAB Installation Guide for Windows documentation: 1 Insert the Release 14 CD into your host CD-ROM drive.
2 Installation and Configuration 3 Under Access Login Users, select download products. The Access Login page opens. 4 Enter your E-mail Address and Password. Click the Log In button. The downloads page appears. 5 From the left list, select the Windows check box, and then click the Continue button. From the Select Your Products list, select the Real-Time Windows Target 2.5 check box, and then click the Continue button. 6 On the next Web page, click the Real-Time Windows Target link.
Real-Time Windows Target Files on Your Computer When using the Real-Time Windows Target, you may find it helpful to know where files are located: • MATLAB working directory — Simulink models (model.mdl) and the Real-Time Windows Target executable (model.rwd) Note Select a working directory outside the MATLAB root. See “Initial Working Directory” on page 2-13. • Real-Time Workshop project directory — The Real-Time Workshop C-code files (model.c, model.h) are in a subdirectory called model_rtwin.
2 Installation and Configuration The Real-Time Windows Target provides files to help Real-Time Workshop generate C code from your Simulink model and compile that code to a real-time executable: • System Target File (rtwin.tlc) — Defines the process of generating C code for the Real-Time Windows Target. • Template Makefile and Makefile (rtwin.tmf, model_name.mk) — The template makefile serves as a template for generating the real makefile, which the make utility uses during model compilation.
Initial Working Directory Initial Working Directory Set your MATLAB working directory outside the MATLAB root directory. The default MATLAB root directory is c:\matlabN, where N is the MATLAB version number.
2 Installation and Configuration Real-Time Windows Target Kernel A key component of the Real-Time Windows Target is a real-time kernel that interfaces with the Windows operating system in a way that allows your real-time executable to run at your selected sample rate. The kernel assigns the highest priority of execution to your real-time executable.
Real-Time Windows Target Kernel 3 Check that the kernel was correctly installed. Type rtwho MATLAB should display a message similar to Real-Time Windows Target version 2.5.0 (C) The MathWorks, Inc. 1994-2003 MATLAB performance = 100.0% Kernel timeslice period = 1 ms Once the kernel is installed, you can leave it installed. After you have installed the kernel, it remains idle, which allows Windows to control the execution of any standard Windows application.
2 Installation and Configuration Uninstalling the Kernel If you encounter any problems with the Real-Time Windows Target, you can uninstall the kernel. The kernel executable file remains on your hard drive so that you can reinstall it: 1 In the MATLAB window, type rtwintgt -uninstall MATLAB displays the message You are going to uninstall the Real-Time Windows Target kernel.
Real-Time Windows Target Kernel To uninstall the kernel, click the MATLAB Start button, and select Simulink->Real-Time Windows Target->Uninstall real-time kernel. Alternately, from the DOS prompt of your computer, type rtwintgt -uninstall and the kernel will uninstall from your system. Typing rtwintgt -forceuninstall forcibly deregisters the kernel from the operating system without deleting any files. This option should only be used when all other attempts to uninstall the kernel fail.
2 Installation and Configuration Testing the Installation The Real-Time Widows Target includes several demo models. You can use one of the demo models to test your installation. Demo models simplify testing of your installation since they are configured with settings that include the correct target, scope settings, sample time, and integration algorithm. Once you have completed the installation of the Real-Time Windows Target and the kernel, we recommend a quick test by at least running the model rtvdp.
Testing the Installation The Simulink model rtvdp.mdl window opens. 2 From the Tools menu, point to Real-Time Workshop, and then click Build Model. The MATLAB window displays the following messages: ### ### . . ### . . ### ### for Starting Real-Time Workshop build for model: rtvdp Invoking Target Language Compiler on rtvdp.rtw . Compiling rtvdp.c . Created Real-Time Windows Target module rtvdp.rwd.
2 Installation and Configuration 4 From Simulation menu, click Start Real-Time Code. The Scope window displays the output signals. If your Scope window looks like the figure shown below, then you have successfully installed the Real-Time Windows Target and have run a real-time application. 5 From Simulation menu, click Stop Real-Time Code. The real-time application stops running, and the Scope window stops displaying the output signals.
Testing the Installation Displaying Status Information The Real-Time Windows Target provides the command rtwho for accessing the kernel and displaying status information. It lists information about the version number, kernel performance, and history variables. Also, you can determine whether or not the Real-Time Windows kernel is presently installed: 1 In the MATLAB window, type rtwho MATLAB displays messages similar to those shown below. Real-Time Windows Target version 2.5.0 (C) The MathWorks, Inc.
2 Installation and Configuration Detecting Excessive Sample Rates If your specified sample rate is too fast, the Real-Time Windows Target detects and reports this during real-time execution. Sampling rates exceeding 10 kHz can be achieved on Pentium computers. Once the model is running, the rtwho command can be issued in the MATLAB command line to observe the system performance. As indicated, MATLAB performance decreases as the system becomes overloaded: Real-Time Windows Target version 2.5.
Testing the Installation 2 Double-click a demo block to open the model.
2 Installation and Configuration 2-24
3 Basic Procedures The basic procedures explain how to create a Simulink or real-time application, and how to run a simulation or execution. Simulink Model (p. 3-2) Create a Simulink model and run a non-real-time simulation Real-Time Application (p. 3-15) Create a real-time application, generate code from that model, and run a real-time execution Signal Logging to the MATLAB Workspace (p.
3 Basic Procedures Simulink Model A Simulink model is a graphical representation of your physical system. You create a Simulink model for a non-real-time simulation of your system, and then you use the Simulink model to create a real-time application. This section includes the following topics: • “Creating a Simulink Model” on page 3-2 — Create a simple Simulink model. • “Entering Configuration Parameters for Simulink” on page 3-6 — Enter configuration parameters for the Simulink model.
Simulink Model An empty Simulink window opens. With the toolbar and status bar disabled, the window looks like the following. 3 In the Simulink Library Browser window, double-click Simulink, and then double-click Sources. Click and drag Signal Generator to the Simulink window. Click Continuous. Click and drag Transfer Fcn to the Simulink window. Click Sinks. Click and drag Scope to the Simulink window.
3 Basic Procedures 5 Double-click the Transfer Fcn block. The Block Parameters dialog box opens. In the Numerator text box, enter [10000] In the Denominator text box, enter [1 70 10000] Your Block Parameters dialog box will look similar to the figure shown below. 6 Click OK. 7 Double-click the Signal Generator block. The Block Parameters dialog box opens. From the Wave form list, select square.
Simulink Model 1 In the Frequency text box, enter 20 From the Units list, select rad/sec. Your Block Parameters dialog box will look similar to the figure shown below. 8 Click OK. The completed Simulink block diagram is shown below.
3 Basic Procedures 9 From the File menu, click Save As. The Save As dialog box opens. In the File name text box, enter a filename for your Simulink model and click Save. For example, type rtwin_model Simulink saves your model in the file rtwin_model.mdl. To specify a default Real-Time Windows Target configuration set for your model, see “Specifying a Default Real-Time Windows Target Configuration Set” on page 3-13.
Simulink Model 1 In the Simulink window, and from the Simulation menu, click Configuration Parameters. In the Configuration Parameters dialog box, click the Solver tab. The Solver pane opens. 2 In the Start time box, enter 0.0. In the Stop time box, enter the amount of time you want your model to run. For example, enter 10.0 seconds. 3 From the Type list, choose Fixed-step. Real-Time Workshop does not support variable step solvers. 4 From the Solver list, choose a solver.
3 Basic Procedures Your Solver pane will look similar to the figure shown below. 7 Do one of the following: - Click Apply to apply the changes to your model and leave the dialog box open. - Click OK to apply the changes to your model and close the Configuration Parameters dialog box.
Simulink Model Entering Scope Parameters for Signal Tracing You enter or change scope parameters to specify the x-axis and y-axis in a Scope window. Other properties include the number of graphs in one Scope window and the sample time for models with discrete blocks. After you add a Scope block to your Simulink model, you can enter the scope parameters for signal tracing: 1 In the Simulink window, double-click the Scope block. A Scope window opens. 2 Click the Parameters button.
3 Basic Procedures 4 Do one of the following: - Click Apply to apply the changes to your model and leave the dialog box open. - Click OK to apply the changes to your model and close the Scope parameters dialog box. 5 In the Scope window, point to the y-axis shown in the figure below, and right-click.
Simulink Model 6 From the pop-up menu, click Axes Properties. 7 The Scope properties: axis 1 dialog box opens. In the Y-min and Y-max text boxes, enter the range for the y-axis in the Scope window. For example, enter -2 and 2 as shown in the figure below. 8 Do one of the following: - Click Apply to apply the changes to your model and leave the dialog box open. - Click OK to apply the changes to your model and close the Axes Parameters dialog box.
3 Basic Procedures Simulink runs the simulation and plots the signal data in the Scope window. During the simulation, the Scope window displays the samples for one time range, increases the time offset, and then displays the samples for the next time range.
Simulink Model 3 Do one of the following: - Let the simulation run to the stop time. - From the Simulation menu, click Stop. The simulation stops. MATLAB does not display any messages. Specifying a Default Real-Time Windows Target Configuration Set The preceding sections describe how to use the Simulink Configuration Parameters dialog to configure simulation parameters for a Simulink model.
3 Basic Procedures See “Creating a Real-Time Application” on page 3-21 for a description of how to build your Real-Time Windows Target application. Note To revert to the default configuration set, Configuration, or any other configuration set you have for the model, use Model Explorer. This is an alternative tool that you can use to enter simulation parameters for a model. This document does not describe how to use the Model Explorer.
Real-Time Application Real-Time Application You create a real-time application to let your system run while synchronized to a real-time clock. This allows your system to control or interact with an external system. This is necessary if you use your system to stabilize a physical plant.
3 Basic Procedures 3 From the Device type list, choose 32-bit Real-Time Windows Target. 1 Click the Real-Time Workshop node. The Real-Time Workshop pane opens. 2 In the Target selection section, click the Browse button at the RTW system target file list. The System Target File Browser opens. 3 Select the system target file for the Real-Time Windows Target and click OK. The system target file rtwin.tlc, the template makefile rtwin.
Real-Time Application Although not visible in the Real-Time Workshop pane, the external target interface MEX file rtwinext is also configured after you click OK. This allows external mode to pass new parameters to the real-time application and to return signal data from the real-time application. The data is displayed in Scope blocks or saved with signal logging. Your Real-Time Workshop pane will look similar to the figure shown below.
3 Basic Procedures Entering Scope Parameters for Signal Tracing You enter or change scope parameters to format the x-axis and y-axis in a Scope window. Other parameters include the number of graphs in a one Scope window and whether the scope is connected to a continuous or discrete model. If you entered the scope parameters for running a simulation, you can skip this procedure. This information is repeated here if you did not run a simulation.
Real-Time Application 4 Do one of the following: - Click Apply to apply the changes to your model and leave the dialog box open. - Click OK to apply the changes to your model and close the Scope parameters dialog box. 5 In the Scope window, point to the y-axis and right-click. From the menu, click Axes Properties. The Scope properties: axis 1 dialog box opens.
3 Basic Procedures 6 In the Y-min and Y-max text boxes enter the range for the y-axis in the Scope window. For example, enter -2 and 2. 7 Do one of the following: - Click Apply to apply the changes to your model and leave the dialog box open. - Click OK to apply the changes to your model and close the Scope properties: axis 1 dialog box.
Real-Time Application Creating a Real-Time Application Real-Time Workshop generates C code from your Simulink model, then the Open Watcom C/C++ compiler compiles and links that C code into a real-time application. After you enter parameters into the Configuration Parameters dialog box for Real-Time Workshop, you can build a real-time application. This procedure uses the Simulink model rtwin_model.
3 Basic Procedures Entering Additional Scope Parameters for Signal Tracing Simulink external mode connects your Simulink model to your real-time application. This connection allows you to use the Simulink block diagram as a graphical user interface to your real-time application. After you have created a real-time application, you can enter scope parameters for signal tracing with Simulink external mode: 1 In the Simulation window, and from the Simulation menu, click Configuration Parameters.
Real-Time Application 4 Click OK. 5 In the Simulation window, and from the Tools menu, click External Mode Control Panel. The External Mode Control Panel dialog box opens.
3 Basic Procedures 6 Click the Signal & Triggering button. The External Signal & Triggering dialog box opens. 7 Select the Select all check box. From the Source list, choose manual. From the Mode list, choose normal. The X under Signal selection indicates that a signal is tagged for data collection, and T indicates that the signal is tagged as a trigger signal. 8 In the Duration box, enter the number of sample points in a data buffer.
Real-Time Application 10 Do one of the following: - Click Apply to apply the changes to your model and leave the dialog box open. - Click Close to apply the changes to your model and close the dialog box. You must click the Apply or Close button on the Signal and Triggering dialog box for the changes you made to take effect. Generally it is not necessary to rebuild your real-time application.
3 Basic Procedures Running a Real-Time Application You run your real-time application to observe the behavior of your model in real time with the generated code. The process of connecting consists of • Establishing a connection between your Simulink model and the kernel to allow exchange of commands, parameters, and logged data. • Running the application in real time. After you build the real-time application, you can run your model in real time. This procedure uses the Simulink model rtwin_model.
Real-Time Application 2 In the Simulation window, and from the Simulation menu, click Start Real-Time Code. You can also start the execution from the toolbar by clicking . Simulink runs the execution and plots the signal data in the Scope window. In this example, the Scope window displays 1000 samples in 1 second, increases the time offset, and then displays the samples for the next 1 second. Note Transfer of data is less critical than calculating the signal outputs at the selected sample interval.
3 Basic Procedures 3 Do one of the following: - Let the execution run until it reaches the stop time. - From the Simulation menu, click Stop Real-time Code. The real-time application stops 4 In the Simulation window, and from the Simulation menu, click Disconnect From Target. 5 From the Simulation menu, click External.
Real-Time Application Running a Real-Time Application from the MATLAB Command Line You can use the MATLAB command-line interface as an alternative to using the Simulink GUI. Enter commands directly in the MATLAB window or enter them in an M-file. After you build the real-time application, you can run your model in real time. This procedure uses the Simulink model rtwin_model.
3 Basic Procedures Signal Logging to the MATLAB Workspace Signal logging is the process of saving (logging) data to a variable in your MATLAB workspace or to a MAT-file on your disk drive. This allows you to use MATLAB functions for data analysis and MATLAB plotting functions for visualization. You can save data to a variable during a simulation or during an execution. To use signal logging with the Real-Time Windows Target, you must add a Scope block to your Simulink model.
Signal Logging to the MATLAB Workspace 2 On the toolbar, click the Parameters button. A Scope parameters dialog box opens. 3 Click the Data history tab. 4 Do one of the following: - If you are running a simulation, you can select the Limit data points to last check box, and enter the number of sample points to save. - If you are running an execution, do not select the Limit data points to last check box.
3 Basic Procedures 7 Do one of the following: - Click Apply to apply the changes to your model and leave the dialog box open. - Click OK to apply the changes to your model and close the Scope parameters dialog box. When you modify anything in the Scope parameters dialog box, you must click the Apply or OK button for the changes to take effect, and you must rebuild your real-time application before connecting and starting it. If you do not rebuild, an error dialog box will open.
Signal Logging to the MATLAB Workspace After you create a Simulink model and add a Scope block, you can enter the signal and triggering properties for logging to the MATLAB workspace. This procedure uses the Simulink model rtwin_model.mdl as an example and assumes you have already loaded that model: 1 In the Simulink window, and from the Tools menu, click External Mode Control Panel. The External Mode control Panel dialog box opens. 2 Click the Signal & Triggering button.
3 Basic Procedures The Duration value specifies the number of contiguous points of data to be collected in each buffer of data. We recommend that you enter a Duration value equal to the total number of sample points that you need to collect rather than relying on a series of buffers to be continuous. If you enter a value less than the total number of sample points, you will lose sample points during the time needed to transfer values from the data buffer to the MATLAB workspace.
Signal Logging to the MATLAB Workspace 5 Do one of the following: - Click Apply to apply the changes to your model and leave the dialog box open. - Click Close to apply the changes to your model and close the dialog box. You must click the Apply or Close button on the Signal and Triggering dialog box for the changes you made to take effect. Generally it is not necessary to rebuild your real-time application.
3 Basic Procedures MATLAB lists the structure of the variable ScopeData.signals. This structure contains one or more vectors of signal data depending on the number of signal inputs to the Scope block. ans = values: label: title: plotStyle: [10000x1 double] '' '' 1 2 To plot the first 1000 points, type plot(ScopeData.time(1:1000), ScopeData.signals.values(1:1000)) MATLAB plots the first 1000 samples from 0.0000 to 0.9990 seconds.
Signal Logging to the MATLAB Workspace 3 The variable ScopeData is not automatically saved to your hard disk. To save the variable ScopeData, type save ScopeData MATLAB saves the scope data to the file ScopeData.mat.
3 Basic Procedures Signal Logging to a Disk Drive Signal logging is the process of saving (logging) data to a variable in your MATLAB workspace and then saving that data to a MAT-file on your disk drive. This allows you to use MATLAB functions for data analysis and MATLAB plotting functions for visualization. Using the data archiving feature to provide in the External Mode Control Panel, you can save data to a file during execution. You cannot save data to a disk drive during a simulation.
Signal Logging to a Disk Drive 1 In the Simulink window, double-click the Scope block. A Scope window opens. 2 On the toolbar, click the Parameters button. A Scope parameters dialog box opens. 3 Click the Data history tab. 4 Do one of the following: - If you are running a simulation, you can select the Limit data points to last check box, and enter the number of sample points to save. - If you are running an execution, do not select the select the Limit data points to last check box.
3 Basic Procedures The Scope parameters dialog box is related to the Data Archiving dialog box. In the Scope parameters dialog box, you must select the Save data to workspace check box to be able to save data to a disk drive, for two reasons: - The data is first transferred from the data buffer to the MATLAB workspace before being written to a MAT-file. - The Variable name entered in the Scope parameters dialog box is the same as the one in the MATLAB workspace and the MAT-file.
Signal Logging to a Disk Drive 7 Do one of the following: - Click Apply to apply the changes to your model and leave the dialog box open. - Click OK to apply the changes to your model and close the Scope parameters dialog box. When you modify anything in the Scope parameters dialog box, you must click the Apply or OK button for the changes to take effect. Also, you must rebuild your real-time application before connecting and starting a real-time application.
3 Basic Procedures 4 In the Duration box, enter the number of sample points in a data buffer. For example, if you have a sample rate of 1000 samples/second and a stop time of 10 seconds, then enter 10000 The Duration value is related to the Limit data points to last value in the Scope parameters dialog box. The smaller of either value limits the number of sample points saved to the MATLAB workspace.
Signal Logging to a Disk Drive 5 Do one of the following: - Click Apply to apply the changes to your model and leave the dialog box open. - Click Close to apply the changes to your model and close the dialog box. You must click the Apply or Close button on the Signal and Triggering dialog box for the changes you made to take effect, but you do not have to rebuild your real-time application.
3 Basic Procedures Entering Data Archiving Parameters The Data Archiving dialog box is related to the Scope parameters dialog box. In the Scope parameters dialog box, you must select the Save data to workspace check box to be able to save data to a disk drive, for two reasons: • The data is first transferred from the scope data buffer to the MATLAB workspace before being written to a MAT-file.
Signal Logging to a Disk Drive 2 Click the Data archiving button. The External Data Archiving dialog box opens. This dialog box allows you to specify data archiving options. 3 Select the Enable archiving check box. 4 In the Directory text box, enter the path to a directory on your disk drive. For example, if your MATLAB working directory is named mwd, enter c:\mwd 5 In the File text box, enter the filename prefix for the data files to be saved. For example, enter data MATLAB names the files data_0.
3 Basic Procedures 6 Select the Append file suffix to variable names check box. Within each MAT-file, a variable is saved with the same name you entered in the Variable name text box (Data history pane on the Scope parameters dialog box). By selecting the Append file suffix to variable names check box, the same suffix that is added to the MAT-file is added to the variable name. For example, if you entered the variable name ScopeData, then within the file data_0.mat will be a variable ScopeData_0.
Signal Logging to a Disk Drive 1 In the MATLAB window, type ScopeData MATLAB lists the structure of the variable ScopeData. The variable ScopeData is a MATLAB structure containing the fields time vector, signal structure, and a string containing the block name. ScopeData = time: [10000x1 double] signals: [1x1 struct] blockName: 'rtwin_model/Scope' 2 To list the MAT-files saved to your disk drive, type dir *.mat MATLAB displays the MAT-files in your current working directory. data_0.
3 Basic Procedures 3-48
Parameter Tuning Parameter Tuning Simulink external mode connects your Simulink model to your real-time application. The block diagram becomes a graphical user interface to the real-time application.
3 Basic Procedures Changing Model Parameters You must use Simulink external mode to change model parameters. While external mode is running, you can open any Simulink block and change a parameter value. External mode will automatically transfer the new value to the real-time application during execution. After you start running your real-time application, you can change parameters and observe the changes to the signals. To start a real-time application, see “Running a Real-Time Application” on page 3-26.
Parameter Tuning 3 In the Denominator box, change 70 to 30. Click OK. The effect of changing a block parameter is shown in the Scope window.
3 Basic Procedures 3-52
4 Advanced Procedures The Real-Time Windows Target provides driver blocks for more than 200 I/O boards. These driver blocks connect the physical world to your real-time application. I/O Boards (p. 4-2) Install I/O boards and enter hardware information I/O Driver Blocks (p. 4-7) Select analog and digital driver blocks from the Simulink library and add to your Simulink model Using Analog I/O Drivers (p.
4 Advanced Procedures I/O Boards Typically I/O boards are preset from the factory for certain base addresses, voltage levels, and unipolar or bipolar modes of operation. Boards often include switches or jumpers that allow you to change many of these initial settings. For information about setting up and installing any I/O board, read the board manufacturer’s documentation.
I/O Boards After you add an I/O driver block to your Simulink model, you can select and configure the I/O board installed in your computer. This procedure uses the AD512 I/O board from Humusoft as an example: 1 Double-click an I/O driver block. The Block Parameters dialog box opens. 2 Click the Install new board button. From the list, point to a manufacturer, and then click a board name. For example, point to Humusoft, and then click AD512. The I/O board dialog box opens.
4 Advanced Procedures 4 Click the Test button. The Real-Time Windows Target tries to connect to the selected board, and if successful, displays the following message. 5 On the message box, click OK, and then on the I/O board dialog box, click OK again. The I/O driver Block Parameters dialog box closes, and the parameter values are saved with your Simulink model. The I/O board information is included with each I/O driver block.
I/O Boards PCI Bus Board You do not have to set a base address with a PCI board. The plug-and-play feature of Microsoft Windows assigns a PCI slot number. You can enter the slot number in the I/O board dialog box, or you can let the driver determine the slot number for you. You open the I/O board dialog box from any I/O driver Block Parameters dialog box. We recommend that before you use a PCI or PCMCIA board, you install the drivers supplied by the board manufacturer.
4 Advanced Procedures We recommend that before you use a PCI or PCMCIA board, you install the drivers supplied by the board manufacturer. The Real-Time Windows Target does not use these manufacturer-supplied drivers. However, they sometimes initiate the plug-and-play recognition of the board. Without these drivers installed, the board might be invisible to your computer and Real-Time Windows Target.
I/O Driver Blocks I/O Driver Blocks The Analog Input, Analog Output, Digital Input, Digital Output, Counter Input, and Encoder Input blocks provide an interface to your physical I/O boards and your real-time application. They ensure that the C code generated with Real-Time Workshop correctly maps block diagram signals to the appropriate I/O channels. You can have multiple blocks associated with each type of I/O block and board.
4 Advanced Procedures After you create a Simulink model, you can add an I/O block. This procedure adds an Analog Input block and uses the Simulink model rtwin_model.mdl as an example: 1 In the MATLAB window, type rtwinlib The Real-Time Windows Target block library window opens.
I/O Driver Blocks 2 Click and drag the Analog Input block to your Simulink model. Remove the Signal Generator block and connect the Analog Input block to the Transfer Function block. Your Simulink model will look similar to the following figure. You next task is to enter parameters for the Analog Input block. See “Analog Input Block” on page 4-10. Simulink Library This topic describes how to access the Real-time Windows Target library from the Simulink window.
4 Advanced Procedures 2 In the left column, double-click Real-Time Windows Target. Click and drag the Analog Input block to your Simulink model. Remove the Signal Generator block and connect the Analog Input block to the Transfer Function block. Your Simulink model will look similar to the figure shown below. You next task is to enter parameters for the Analog Input block. See “Analog Input Block” on page 4-10.
I/O Driver Blocks 3 In the Input channels box, enter a channel vector that selects the analog input channels you are using on this board. The vector can be any valid MATLAB vector form. For example, to select all eight analog input channels on the AD512 board, enter [1,2,3,4,5,6,7,8] or [1:8] If you want to use the first three analog input channels, enter [1,2,3] 4 From the Input range list, choose the input range for all of the analog input channels you entered in the Input channels box.
4 Advanced Procedures 6 Select one of the following: - Click the Apply button to apply the changes to your model and leave the dialog box open. - Click the OK button to apply the changes to your model and close the Block Parameters: Analog Input dialog box. Analog Output Block The Real-Time Windows Target I/O blocks allow you to select and connect specific analog channels to your Simulink model.
I/O Driver Blocks 2 In the Sample time box, enter the same value you entered in the Fixed step size box from the Configuration Parameters dialog box. For example, enter 0.001 3 In the Output channels box, enter a channel vector that selects the analog input channels you are using on this board. The vector can be any valid MATLAB vector form.
4 Advanced Procedures 7 Enter a final value for each analog channel you entered in the Output channels box. For example, if you entered [1,2] in the Output channels box, and you want final values of 0 volts, enter [0,0]. If you chose Volts, your dialog box will look similar to the figure shown below. 8 Do one of the following: - Click Apply to apply the changes to your model and leave the dialog box open.
I/O Driver Blocks Digital Input Block The Real-Time Windows Target I/O blocks allow you to select and connect specific digital lines or digital channels to your Simulink model. After you have added a Digital Input block to your Simulink model, you can enter the parameters for this I/O driver. This procedure uses Humusoft’s AD512 I/O board as an example: 1 Double-click the Digital Input block. The Block Parameters: Digital Input dialog box opens.
4 Advanced Procedures 4 From the Channel mode list, choose one of the following options: - Bit — Returns a value of 0 or 1. - Byte — Groups eight digital lines into one digital channel and returns a value of 0 to 255. If you chose Bit, your dialog box will look similar to the figure shown below. 5 Do one of the following: - Click Apply to apply the changes to your model and leave the dialog box open. - Click OK to apply the changes to your model and close the Block Parameters: Digital Input dialog box.
I/O Driver Blocks After you have added a Digital Output block to your Simulink model, you can enter the parameters for this I/O driver. This procedure uses Humusoft’s AD512 I/O board as an example: 1 Double-click the Digital Output block. The Block Parameters: Digital Output dialog box opens. 2 In the Sample time box, enter the same value you entered in the Fixed step size box from the Configuration Parameters dialog box. For example, enter 0.
4 Advanced Procedures 5 Enter the initial values for each digital output line or channel you entered in the Output channels box. For example, if you entered [1,2,3,4] in the Output channels box, and you want initial values of 0 and 1, enter [0,0,1,1] If you choose Byte from the Channel mode list, enter a value between 0 and 255 for each digital output channel. For example, for one byte (8 digital lines) with an initial value of 25, enter [25].
I/O Driver Blocks If you chose Bit, your dialog box will look similar to the figure shown below. 7 Do one of the following: - Click Apply to apply the changes to your model and leave the dialog box open. - Click OK to apply the changes to your model and close the Block Parameters: Digital Output dialog box. Counter Input Block This Real-Time Windows Target I/O block allows you to select and connect specific counter input channels to your Simulink model.
4 Advanced Procedures 1 Double-click the Counter Input block. The Block Parameters: Counter Input dialog box opens. 2 In the Sample time box, enter the same value you entered in the Fixed step size box from the Configuration Parameters dialog box. For example, enter 0.001 3 In the Input channels box, enter a channel vector that selects the counter input channels you are using on this board. The vector can be any valid MATLAB vector form.
I/O Driver Blocks 5 From Clock input active edge, which determines which clock edge should increment the counter, select - rising — Low to high transitions - falling — High to low transitions Not all counter chips support selecting the input edge. In this case, the pull-down menu will reflect the supported option only. 6 From Gate input functionality, which defines the action of the counter’s gate pin, select - none — Gate is disabled.
4 Advanced Procedures - latch & reset on falling edge — The count of the counter is remembered and then the counter is reset when high to low transition of the gate occurs. Not all counter chips support all gate modes. Only supported gate modes are shown in the pull-down menu. 7 Do one of the following: - Click Apply to apply the changes to your model and leave the dialog box open. - Click OK to apply the changes to your model and close the Block Parameters: Counter Input dialog box.
I/O Driver Blocks - double — Counts the rising edges from both stripe sets - single — Counts the rising edges from one stripe set - quadruple — Counts rising and falling edges from both stripe sets Quadruple mode yields four times more pulses per revolution than the single mode. Therefore, quadruple is more precise and is recommended unless other parameters dictate otherwise. 5 The encoder interface chip has a reset pin in addition to encoder inputs.
4 Advanced Procedures Output Signals from an I/O Block I/O driver blocks output multiple signals as a vector instead of individual channels or lines. To connect the individual channels and lines to parts of your Simulink model, you need to separate the vector with a Demux block. After you add and configure an I/O driver block in your Simulink model, you can separate and connect the output signals from the blocks: 1 In the Simulink window, and from the View menu, click Library Browser.
I/O Driver Blocks 5 Finish making connections and selecting display options. - Connect the Analog Input block to the Demux block input. - Connect each of the Demux block output lines to the input of other blocks. - In the Simulink window, and from the Format menu, click Port/Signal Displays->Wide Nonscalar Lines, and click Signal Dimensions. In this simple example, inputs 1 and 2 are not connected, but they could be connected to other Simulink blocks.
4 Advanced Procedures Variations with Channel Selection For a better understanding of how to specify device settings when using both analog and digital signals, this section uses the I/O board DAS-1601 from Keithley-Metrabyte as an example. The following is a specification summary of the DAS-1601 board: • Analog input (A/D) — 16 single-ended or 8 differential analog inputs (12-bit), polarity is switch configured as either unipolar (0 to 10 volts) or bipolar (+/- 10 volts).
I/O Driver Blocks Input vector with single-ended analog — Now, assume your DAS-1601 board is configured to be single-ended analog input. In this case, 16 analog input channels are supported. The complete input vector is [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] or [1:16] To use the first four single-ended analog input channels, enter [1 2 3 4] or [1:4] This illustration shows the resulting block diagram.
4 Advanced Procedures This illustration shows the block implementation. Depending on the board and the number of channels used, I/O conversion time can affect the maximum sample rate that can be achieved on your system. Rather than converting unused channels, we recommend specifying only the set of channels that are actually needed for your model.
Using Analog I/O Drivers Using Analog I/O Drivers Control systems have unique requirements for I/O devices that the Real-Time Windows Target supports. This section includes the following topics: • “I/O Driver Characteristics” on page 4-29 • “Normalized Scaling for Analog Inputs” on page 4-30 I/O Driver Characteristics The Real-Time Windows Target uses off-the-shelf I/O boards provided by many hardware vendors. These boards are often used for data acquisition independently of the Real-Time Windows Target.
4 Advanced Procedures Normalized Scaling for Analog Inputs The Real-Time Windows Target allows you to normalize I/O signals internal to the block diagram. Generally, inputs represent real-world values such as angular velocity, position, temperature, pressure, and so on.
Using Analog I/O Drivers In your block diagram, you can do this as follows. 0 to +5 Volts and Normalized Unipolar From the Input range list, choose 0 to +5 V, and from the Block output signal list, choose Normalized unipolar. This example converts a normalized unipolar value to volts, but you could also easily convert directly to another parameter in your model. 0 to 5 volts --> ([0 to 1] normalized * 5.0 In your block diagram, you can do this as follows.
4 Advanced Procedures In your block diagram, you can do this as follows. -10 to +10 Volts and Normalized Unipolar From the Input range list, choose -10 to +10 V, and from the Block output signal list, choose Normalized unipolar. This example converts a normalized bipolar value to volts, but you could also easily convert directly to another parameter in your model. -10 to 10 volts --> ([0 to 1] normalized - 0.5) * 20 In your block diagram, do this as follows.
Using Analog I/O Drivers A voltage range on the D/A converter is set to -10 to +10 volts, and the Block input signal is chosen as Normalized bipolar, then a Simulink signal of amplitude -1 results in an output voltage of -10 volts. Similarly, a Simulink signal of amplitude +1 results in an output voltage of +10 volts. This may require that you adjust your signal amplitudes in Simulink using a Gain block, Constant block, and Summer block depending on the selected voltage range.
4 Advanced Procedures 4-34
5 Troubleshooting Solutions have been worked out for some common errors and problems that can occur when you are using the Real-Time Windows Target. Building Older Models (p. 5-2) Solution to building older models Plots Not Visible in Simulink Scope Block (p. 5-3) Solution to plots not being visible in scope blocks Failure to Connect to Target (p. 5-4) Solution to target connection failure Sample Time Too Fast (p. 5-5) Solution to sample times being too small S-Functions Using Math Functions (p.
5 Troubleshooting Building Older Models If you are building an older model for Real-Time Windows Target, you might get a message like the following: "Real-Time Workshop utilizes device specific information (e.g., microprocessor word sizes) to reproduce a bit true representation of the diagram. This information is not specified in this model. If you continue, Real-Time Workshop will use a 32-bit Generic target setting." This is simply a warning, and you can ignore the message.
Plots Not Visible in Simulink Scope Block Plots Not Visible in Simulink Scope Block For data to plot correctly in a Simulink Scope block, you must specify the following: • External mode selected from the Simulation menu in the Configuration Parameters dialog • Connect to target selected from the Simulation menu • Select one or more signals for capture (designated with “X”) in the External Signal & Triggering dialog box from the Tools->External Mode Control Panel menu.
5 Troubleshooting Failure to Connect to Target Possible Problem — When trying to connect to the target, the Simulation Errors dialog box displays Checksum mismatch. Target code needs to be rebuilt Solution — This indicates that the model structure has changed since the last time code was generated. You must rebuild the real-time application. If your model fails to build successfully, we recommend that you delete .mk and .
Sample Time Too Fast Sample Time Too Fast During a run, you might not see any output in the Scope window. This could indicate that the sample time is too small. In the MATLAB Command Window, type rtwho Check the value for MATLAB performance. A value less than 80% indicates that your sample time might be too small. In general, we recommend that you start by choosing a slow sample rate. For example, select a sample time of 0.01 second, and confirm that your system runs correctly and plots are displayed.
5 Troubleshooting S-Functions Using Math Functions Possible problem — When you create your own S-functions that include math functions, the S-functions compile okay, but you cannot build the application. Solution — Add the Real-Time Windows Target header to your S-function. For example, add #include #include"rtwintgt.h" The header #include must precede the header #include"rtwintgt.h".
A Supported I/O Boards Reference The Real-Time Windows Target includes support for more than 200 I/O boards. Multiple boards can be used as I/O for a model provided they do not have overlapping base addresses. If you have a board that is not listed here, you can support it by adding your own I/O driver. Introduction (p.
A Supported I/O Boards Reference Introduction This appendix includes the following topics: • “ISA Bus” on page A-2 • “PCMCIA Bus” on page A-10 • “PCI Bus” on page A-11 • “Compact PCI” on page A-14 • “PXI Bus” on page A-14 • “PC/104 Bus” on page A-15 • “Standard Devices” on page A-16 Note Some of the functions on a board might not be supported by the Real-Time Windows Target. Check the MathWorks Web site for an updated list of supported boards and functions at http://www.mathworks.
Introduction ISA Bus Supported I/O Boards (Continued) Manufacturer Board Name PCL-714 PCL-722 PCL-724 PCL-725 PCL-726 PCL-727 PCL-728 PCL-730 PCL-731 PCL-733 PCL-734 PCL-735 PCL-812 PCL-812PG PCL-814B PCL-816 PCL-818 PCL-818H PCL-818HD PCL-818HG PCL-818L A-3
A Supported I/O Boards Reference ISA Bus Supported I/O Boards (Continued) Manufacturer Board Name Analog Devices RTI-800 RTI-815 Axiom AX5032IO AX5064I AX50640 AX5215H AX5244H AX5412-H AX5412-L AX5611C-H AX5611C-L Data Translation DT2801 DT2801-A DT2801/5716 DT2805 DT2805/5716 DT-2809 DT2811-PGH DT2811-PGL DT2819 DT2820 A-4
Introduction ISA Bus Supported I/O Boards (Continued) Manufacturer Board Name Humusoft AD512 MC101-CE150 MF604 Intelligent Instrumentation PCI-20377W Keithley-Metrabyte ADC-16 DAC-02 DAS-1201 DAS-1202 DAS-1401 DAS-1402 DAS-1601 DAS-1602 DAS-16G1 DAS-16G2 DAS-8 DAS-8/AO DAS-8PGA DAS-8PGA-G2 DDA-06 PDISO-8 PIO-12 PIO-24 A-5
A Supported I/O Boards Reference ISA Bus Supported I/O Boards (Continued) Manufacturer Board Name PIO-32IN PIO-32IO PIO-32OUT PIO-96 PIO-HV REL-16 Measurement Computing CIO-DAC02 CIO-DAC02/16 CIO-DAC08 CIO-DAC08/16 CIO-DAC16 CIO-DAC16/16 CIO-DAS08 CIO-DAS08-AOH CIO-DAS08-AOL CIO-DAS08-AOM CIO-DAS08/Jr CIO-DAS08/Jr-AO CIO-DAS08/Jr/16 CIO-DAS08/Jr/16-AO CIO-DAS08-PGH A-6
Introduction ISA Bus Supported I/O Boards (Continued) Manufacturer Board Name CIO-DAS08-PGL CIO-DAS08-PGM CIO-DAS-1401/12 CIO-DAS-1402/12 CIO-DAS-1402/16 CIO-DAS16 CIO-DAS16/330 CIO-DAS16/F CIO-DAS16/Jr CIO-DAS16Jr/16 CIO-DAS-1601/12 CIO-DAS-1602/12 CIO-DAS-1602/16 CIO-DAS48-PGA CIO-DDA06 CIO-DDA06/JR CIO-DDA06/16 CIO-DDA06/JR/16 CIO-DI48 CIO-DI96 CIO-DI192 A-7
A Supported I/O Boards Reference ISA Bus Supported I/O Boards (Continued) Manufacturer Board Name CIO-DIO24 CIO-DIO24H CIO-DIO48 CIO-DIO48H CIO-DIO96 CIO-DIO192 CIO-DISO48 CIO-DO24DD CIO-DO48DD CIO-DO48H CIO-DO96H CIO-DO192H CIO-DUAL-AC5 CIO-PDISO8 CIO-PDISO16 CIO-QUAD02 CIO-QUAD04 CIO-RELAY08 CIO-RELAY16 CIO-RELAY24 CIO-RELAY32 A-8
Introduction ISA Bus Supported I/O Boards (Continued) Manufacturer Board Name National Instruments AT-MIO-16E-1 AT-MIO-16E-2 AT-MIO-64E-3 AT-MIO-16E-10 AT-MIO-16DE-10 AT-AI-16XE-10 AT-MIO-16XE-10 AT-MIO-16XE-50 Lab-PC Lab-PC+ Lab-PC-1200 Lab-PC-1200-AI PC-DIO-24 PC-DIO-24PnP PC-OPDIO-16 Quanser MultiQ-3 Scientific Solutions LabMaster DMA-PGH LabMaster DMA-PGL Technology80 Model T5312B A-9
A Supported I/O Boards Reference PCMCIA Bus This table lists the PCMCIA bus I/O boards supported by the Real-Time Windows Target.
Introduction PCMCIA Bus Supported I/O Boards (Continued) Manufacturer Board Name DAQCard-AI-16XE-50 DAQCard-DIO-24 PCI Bus This table lists the PCI bus I/O boards supported by the Real-Time Windows Target.
A Supported I/O Boards Reference PCI Bus Supported I/O Boards (Continued) Manufacturer Board Name Measurement Computing PCI-DAS08 PCI-DAS1000 PCI-DAS1001 PCI-DAS1002 PCI-DAS1200 PCI-DAS1200/Jr PCI-DAS1602/12 PCI-DAS1602/16 PCI-DAS1602/16/Jr PCI-DIO24 PCI-DIO24H PCI-DIO48H PCI-DIO96 PCI-DIO96H PCI-DUAL-AC5 PCIM-DDA06/16 PCI-QUAD04 Meilhaus Electronic ME-2000 ME-2600 National Instruments PCI-1200 PCI-6013 PCI-6014 A-12
Introduction PCI Bus Supported I/O Boards (Continued) Manufacturer Board Name PCI-6023E PCI-6024E PCI-6025E PCI-6031E PCI-6032E PCI-6033E PCI-6034E PCI-6035E PCI-6036E PCI-6052E PCI-6071E PCI-6703 PCI-6704 PCI-MIO-16E-1 PCI-MIO-16E-4 PCI-MIO-16XE-10 PCI-MIO-16XE-50 Quanser MultiQ-PCI Sensoray Model 626 A-13
A Supported I/O Boards Reference Compact PCI This table lists the compact PCI I/O boards supported by the Real-Time Windows Target. Compact PCI Supported I/O Boards Manufacturer Board Name Measurement Computing CPCI-DIO24H CPCI-DIO48H CPCI-DIO96H PXI Bus This table lists the PXI bus I/O boards supported by the Real-Time Windows Target.
Introduction PC/104 Bus This table lists PC/104 bus I/O devices supported by the Real-Time Windows Target.
A Supported I/O Boards Reference Standard Devices This table lists standard I/O devices supported by the Real-Time Windows Target.
B Custom I/O Driver Blocks Reference Custom I/O device drivers can be used in combination with the Real-Time Windows Target. We do not recommend using Analog Input, Analog Output, Digital Input, or Digital Output drivers as a starting point for creating custom device drivers. You can write custom I/O device drivers to work with the Real-Time Windows Target. I/O Register Access from S-Functions Limitation (p.
B Custom I/O Driver Blocks Reference I/O Register Access from S-Functions Limitation For Windows NT, Windows 2000, and Windows XP, drivers can access I/O registers only from the real-time kernel and not from Simulink.
I/O Register Access from S-Functions Limitation Incompatibility with Win32 API Calls The Real-Time Windows Target kernel intercepts the interrupt from the system clock. It then reprograms the system clock to operate at a higher frequency for running your real-time application. At the original clock frequency, it sends an interrupt to the Windows operating system to allow Windows applications or any software using the Win32 API to run.
B Custom I/O Driver Blocks Reference Unsupported C Functions If you create your own custom I/O driver blocks, you should first check for C functions that are supported by the Real-Time Windows Target. Functions that use the Windows operating system are not supported with the Real-Time Windows Target. This is because the kernel intercepts the system clock and first runs the real-time application.
Unsupported C Functions Supported C Functions You can use ANSI C functions that do not use the Windows operating system in your custom blocks or I/O drivers.
B Custom I/O Driver Blocks Reference B-6
Index A adding Analog Input block 4-7 I/O driver blocks 4-7 input blocks 4-7 analog input normalized scaling 4-30 Analog Input block configuring 4-10 Analog Output block configuring 4-12 A/D See analog-to-digital analog-to-digital channel selection 4-26 application Real-Time Windows Target 1-5 B before you install obtaining a valid license 2-8 C capturing and displaying signals 1-2 CD installation 2-9 changing parameters parameter tuning 1-7 channel selection entering configurations 4-26 compact PCI insta
Index Demux block separating I/O signals 4-24 description Simulink external mode 1-12 device drivers channel selection 4-26 custom I/O 4-33 writing custom B-1 Digital Input block configuring 4-15 Digital Output block configuring 4-16 D/A See digital-to-analog digital-to-analog channel selection directories installed 2-11 MATLAB working 2-11 project 2-11 Real-Time Workshop working 2-11 working 2-11 disk drive plotting logged data 3-46 signal logging 3-38 DSP Blockset compatible software 1-4 Index-2 E Enco
Index system target 2-11 system target file 2-12 template makefile 2-12 working directory 2-11 Fixed-Point Blockset compatible software 1-4 H hardware system requirements 2-6 I I/O blocks Analog Input block 4-10 Analog Output block 4-12 Counter Input block 4-19 Digital Input block 4-15 Digital Output block 4-16 Encoder Input block 4-22 input and output 4-7 separating signals 4-24 I/O boards compact PCI boards 4-5 configuring 4-2 installing 4-2 ISA bus 4-4 list of supported A-1 overview 4-2 PC/104 bus 4-5
Index L O licenses getting or updating 2-8 system requirements 2-8 list supported I/O boards A-1 logging data to disk drive 3-44 data to workspace 3-30 opening demo library 2-22 output blocks overview 4-7 overview I/O boards 4-2 input blocks 4-7 installing kernel 2-14 output blocks 4-7 parameter tuning 3-49 real-time application 3-15 Real-Time Windows Target 1-2 system concepts 1-12 system requirements 2-6 testing installation 2-18 M makefile 2-12 MathWorks compatible software 1-4 DSP Blockset 1-4 Fixe
Index plotting logged data from disk 3-46 logged data from workspace 3-35 R real-time control 1-2 execution 1-10 hardware-in-the-loop 1-2 signal processing 1-2 real-time application and the development process 1-11 connecting to Simulink model 3-22 creating 3-21 overview 3-15 Real-Time Windows Target 1-5 Real-Time Workshop parameters 3-15 scope properties for signal tracing 3-18 simulation parameters for Real-Time Workshop 3-15 software environment 1-5 starting 3-26 stopping 3-26 real-time kernel Real-Tim
Index setting initial working directory 2-13 working directory 2-13 signal and triggering entering properties 3-32 properties 3-41 signal archiving See signal logging signal data plotting from disk drive 3-46 plotting from workspace 3-35 signal logging entering scope properties 3-30 feature 1-6 plotting data 3-35 signal and triggering properties 3-41 to disk drive 3-38 to MATLAB workspace 3-30 signal logging to disk drive data archiving parameters 3-44 signal and triggering properties 3-41 signal logging t
Index supported I/O boards compact PCI bus A-14 ISA bus A-2 list A-1 PC/104 bus A-15 PCI bus A-11 PCMCIA bus A-10 PXI bus A-14 system concepts data buffers 1-13 overview 1-12 transferring data 1-13 system requirements hardware 2-6 licenses 2-8 overview 2-6 software 2-7 software environment 2-7 updating licenses 2-8 system target file 2-12 using I/O device drivers 4-29 V valid license obtaining 2-8 W Web downloadable installing from 2-9 Win32 incompatible with I/O drivers B-3 working directory initial 2-
Index Index-8