C2000 Simulink using TI DCL library functions

10 vues (au cours des 30 derniers jours)
Maximilian Weigelt
Maximilian Weigelt le 27 Jan 2023
Commenté : Finlay le 12 Mai 2025
Hello, how to use Digital Control Library in Simulink for C2000 F28388D microcontroller? In particular, I would like to use the PID controller and the Refgen functions. The functions require pointer variables and structs as arguments. I tried so far to integrate the functions with the coder.opaque/coder.ceval command and with the C-function caller block. But there were always errors that the variable rgen does not exist.
  1 commentaire
Mark McBroom
Mark McBroom le 5 Fév 2023
It should be possible to call a function in the DCL library using either approach you mentioned. You will need to provide the ML Function code or C Caller block settings are are using.

Connectez-vous pour commenter.

Réponses (1)

Rishav
Rishav le 6 Avr 2023
To use the Refgen block, you can define the struct "rgen" in MATLAB workspace and use the "From Workspace" block to pass the struct to the Refgen block. To define the struct "rgen", you can use the following code:
rgen = struct('Type', 'Sinusoidal', 'Amplitude', 1, 'Frequency', 0.1);
Then, you can use the "From Workspace" block to pass the struct to the Refgen block.
Similarly, you can use the "From Workspace" block to pass pointer variables to the PID controller block.
  1 commentaire
Finlay
Finlay le 12 Mai 2025
Hi, I just wanted to check if this is the reccomended approach for using CLA DCL functions in Simulink as well? Seems like it would be a more efficient way of running CLA control loops than the examples which use a large number of discrete blocks and don't compile to the DCL functions.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Simulink Coder dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by