
NOTE: It is best practice to ensure sample times are exactly the same all over your model file unless you
specifically need different sample rates in different blocks of your Simulink model. If you must use two
or more different sample times, they must be integer multiples of what you specify as “Fixed step size”.
Choose “Stop time” based on the
amount of time you want to run the
embedded program. For this lab, it
will be a good practice to leave it at
inf (infinite).
Choose Solver options> Type to be
Fixed-Step. Variable Step, the other
option is to simulate continuous
systems and should be chosen only
when the simulation is run in
MATLAB. For all embedded
programs, fixed step should be the
step size. The “Solver” needs to be
set to “discrete (no continuous
states)” unless a continuous time
system is modeled (there may be computational issues with this).
Next, go to Code generation. Under Target Selection> System Target file, click browse to select the file
xpctarget.tlc, as shown in the image below. This will allow the MATLAB compiler to generate executable
code that is compatible for xPC embedded systems ; such as Advantech PC104 computer boards. You
also need to go to xPC target options and deselect ‘Automatically download application after building’;
doing this will stop MATLAB from automatically trying to download the application file to the target
computer (there are errors when multiple targets are connected to the same host). Be sure to click “Apply”
at every step and save all changes. You are now ready to build our first application model and use
Standalone or DOS Loader mode to run them on the PC104 targets.
Comentarios a estos manuales