How to call c2000 library functions with the S-Function builder?

7 vues (au cours des 30 derniers jours)
Ruben Galvez
Ruben Galvez le 27 Juil 2022
Hello everyone:
I need to communicate with a device via SPI which needs a special communications structure. For that I need to change some registers such us the transmit delay of the SPI.
To learn how to use the sfunctions. I start with something easier which is just to call the function GPIO_setPinConfig(). I included all the necessary headers but unfortunatly It gives me the following errors:
warning: implicit declaration of function 'GPIO_setPinConfig'
'GPIO_16_SPIA_SIMO' undeclared
I don't know how to solve that.
Here is the code I wrote so far.
Pls, could you give some advice about how to get this external functions to work?
Thanks in advance. I am looking forward to your reply.
  1 commentaire
Ruben Galvez
Ruben Galvez le 29 Juil 2022
I've also tried adding the SRC PATH and even adding extern GPIO_set..., but without success

Connectez-vous pour commenter.

Réponses (1)

Benjamin Thompson
Benjamin Thompson le 29 Juil 2022
If you are using mex to compile this C code into a binary for Simulink to use as an S-Function block, you probably need to use the -l and -L switches to include an external C2000 library or object file or something like that. Type "help mex" to get more information. If this is not helpful please attach some sample files of your work.

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by