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

조회 수: 9 (최근 30일)
Ruben Galvez
Ruben Galvez 2022년 7월 27일
답변: Benjamin Thompson 2022년 7월 29일
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
Ruben Galvez
Ruben Galvez 2022년 7월 29일
I've also tried adding the SRC PATH and even adding extern GPIO_set..., but without success

댓글을 달려면 로그인하십시오.

답변 (1개)

Benjamin Thompson
Benjamin Thompson 2022년 7월 29일
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.

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by