C2000: Viewing variables in Simulink and Embedded Coder

28 views (last 30 days)
I am using Simulink + Embedded Coder to generate test code for the F28379D processor (one of the targets in the C2000 toolbox). I can generate and upload code with no problems.
Now, I have the ADCs setup, and I want to view the ADC results as the code is running in real time (like using a debugger to view an ADC result in the watch window). How can I do this in Simulink?

Accepted Answer

Ayush Anand
Ayush Anand on 4 Apr 2024 at 4:55
Edited: Ayush Anand on 4 Apr 2024 at 4:59
Hi Richard,
Viewing ADC results in real-time as your code generated from Simulink is running on a Texas Instruments F28379D processor can be achieved through various methods within the Simulink environment. Here are some possible approaches:
External Mode: External mode allows you to run your model on the target hardware and view parameters in real-time from Simulink on your host PC. You can run the model in external mode by following the steps below:
  1. Configure External Mode: You can do this by going to the model's Configuration Parameters (Simulation > Model Configuration Parameters), under the "Hardware Implementation" settings. Set the "Hardware board" to your specific target (F28379D), and then in the "External Mode" section, ensure that external mode is enabled.
  2. Signal Logging: Use signal logging to monitor ADC results. Right-click on the signal in your model and select "Log Selected Signals".
  3. Run in External Mode: Connect your hardware to your PC, and then run your model in external mode by clicking on the external mode button in Simulink's toolbar. Your model will now run on the hardware, and you should be able to see your logged signals in real-time in Simulink.
Dashboard Blocks: Simulink's Dashboard blocks allow you to add interactive controls and displays to your model. You can setup dashboard blocks following the steps below:
  1. Add Dashboard Blocks: From the Simulink Library Browser, find the Dashboard blocks (e.g., Gauges, Displays) and add them to your model. Connect them to the signals you want to monitor.
  2. Configure for External Mode: Ensure your model is set up for external mode as described above.
  3. Run and Monitor: Run your model in external mode and observe the ADC results on the dashboard blocks in real-time as the code executes on the hardware.
Data Inspector: The Simulink Data Inspector allows you to view and analyze data from your model in real-time.
  1. Enable Data Streaming: For the signals you want to monitor, enable streaming to the Data Inspector. This can be done by right-clicking the signal and selecting "Stream signal to Data Inspector".
  2. Run in External Mode: With your model configured for external mode, run it. Open the Data Inspector to view the streamed signals in real-time.
You can read more about running Simulink in external mode here:
Hope this helps!

More Answers (0)

Tags

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!