0% found this document useful (0 votes)
17 views8 pages

Reversed Biasd

simiconductors techniques
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views8 pages

Reversed Biasd

simiconductors techniques
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

USING REAL TIME WINDOWS TARGET TO

COMPILE AND EXECUTE A SIMULINK


PROGRAM

• When you log onto the PC assigned to your group, open up Matlab 6.1

• Next type in simulink in the Matlab command window, this opens up the
Simulink library which contains all the blocks for constructing a simulink
program.

• The test program stgsample1.mdl should already be present under the


c:\Matlab6p1\work directory , if not it can be downloaded from the ECE496
website (In the ECE 496 Administration Webpage --- Simulink Model
Example For Windows)

• Copy the test program onto your PC using a floppy disk as there is no network
connection for any PCs.

• Now through Simulink the stgsample1.mdl can be opened and used as a test
program to check your hardware OR also as a means to build your control
program on it.

• A picture of the sample program is shown in Figure 1.

• Typing in stglib at the MATLAB command prompt will bring up the software
library for the ServoToGo Board. The different hardware blocks (ADC, DAC
etc) in the sample program have been taken from stglib

• The options for using the ADC, DAC, Read Encoder and Digital Output
blocks have been shown in figures 2 through 5. They can be accessed by
double clicking on each block.
Figure 1

Figure 2
Figure 3

Figure 4
Figure 5

• The settings for all of the respective blocks should be set as shown in the
above figures. You can specify the channel you want to use in the blocks
above but the change should be reflected in the hardware too (i.e the
connector to the break out board of the Servo To Go or any other board should
also be switched to the respective channel).

• After all the settings are set in the control program, the Real Time Workshop
and RTWT settings must be set also. The procedure to do this is given below.

• To this end, select Tools from the Simulink model menubar and then selecting
Real-Time Workshop followed by Options from the pull-down menu. From
the Simulation Parameters window, click on the Real-Time Workshop tab
as shown in Figure 6.

• If the text in the System target file, Template makefile, and Make
command edit boxes is not the same as shown in Figure 6, the user must click
on the Browse button. From the resulting System Target File Browser
window, the user should select Real-Time Windows Target (QRTS
extensions) rtwinqrts.tlc as shown in Figure 7.
Figure 6

Figure 7
• After saving this select the Solver Button in the Simulation Parameters
window as shown in Figure 8 and make sure all options are set according to
the options shown in the Figure 8.

Figure 8

• To enable the “scopes”(devices which display the data) select the Signal &
Triggering option in Tools ->External Mode Control. The window shown
in Figure 9 should pop up. Please set all the options as set in Figure 9, and
enable the scopes required for your use.

• Save all the changes you made and now you are ready to build the model. To
do this select Tools -> RTW Options -> Build Model from the Simulink
Model.

• Now to execute your program select Tools ->External Mode Control Panel.
The window shown in Figure 10 should appear.
Figure 9

Figure 10

• Hit Connect followed by Start Real Time Code. This should start the program.
Press Stop Real Time Code whenever you need to stop interacting with the
hardware.
Note: It would make it a lot easier to execute any control program you build by
developing the test program given to you as this will save you from making any
errors while selecting the options.
Whenever you make any changes in your program, the program needs to be
saved and compiled.

You might also like