You can use external mode to receive data from an executable while it runs on the Texas Instruments™ Hercules RM57Lx LaunchPad hardware board. You can also tune model parameters in the executable and evaluate the effects of different parameter values until you find the optimal ones. For more information, see Host-Target Communication with External Mode Simulation (Simulink Coder).
External mode accelerates parameter tuning. You do not have to build, load, and run the executable each time you change the value of a parameter. You can also use external mode to develop and validate your application using the actual data and hardware for which it is designed. You cannot achieve this software-hardware interaction solely by simulating a model.
To tune parameters with external mode:
(Optional) Select a signal for logging or visualization using external mode. For example, use the Simulation Data Inspector, Display blocks, or Scope blocks to visualize data, or use a To File block to log signal data.
Configure the model to simulate in external mode.
Build and run the executable on the Texas Instruments Hercules RM57Lx LaunchPad.
Connect the model on your host computer to the executable running on the Texas Instruments Hercules RM57Lx LaunchPad.
(Optional) On your host computer, observe the data that external mode sends from the executable.
On your host computer, change parameter values in the model that external mode applies to the executable.
Find the optimal parameter values by making adjustments and observing the results.
Save the new parameter values, disable external mode in the model, and save the model.
Verify that you can run an executable on the Texas Instruments Hercules RM57Lx LaunchPad, as described in Build and Run Executable on the Texas Instruments Hercules RM57Lx LaunchPad.
In the model, set Simulation mode to
To the left of Simulation mode,
set the Simulation stop time. The default value
10.0 seconds. To run the model for an indefinite
When the model stops simulating in external mode, the binary executable stops running on the hardware.
(Optional) If your model contains sink (Simulink) blocks, use them to observe data that external mode sends from the executable to the model on the host computer. Also review the options under the Simulation Data Inspector.
Runs the binary executable on the hardware board.
Runs the model on the host computer in external mode.
Establishes external mode communication between the executable and the model.
If your model does not contain a sink block, the MATLAB® Command Window displays a warning message. You can disregard this warning or add a sink block to the model.
Change block parameter values in the model on your host computer. External mode applies the new parameter values to the executable running on the Texas Instruments Hercules RM57Lx LaunchPad hardware board. Observe the effects of those changes and optimize the parameter values.
Any Simulink® sink blocks in your model receive data from the hardware board and display it on your host computer.
Click Stop to stop the model simulating in external mode.