Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

Implement custom code in C2000 code generation

0 votes
512 views
Hello,

I am trying to implement the EMIF interface of the F28379D in Plecs for C-code-generation to communicate with an FPGA. There is no suitable block in the library browser.

Also, the C script block does not seem to be suitable for including custom C code in the code generation, but is only intended for the Plecs simulation.

Is there any way to include custom code or write a custom library for this purpose?

Thank you,
André
asked Nov 5, 2021 by AndreThoennessen (14 points)

1 Answer

0 votes
André,

The EMIF interface is not supported by the C2000 target support package.  As you suggested, the C-Script block is not a means to implement this functionality.

Creating a component to support this or any other peripheral is not trivial. Therefore we do not support users in creating their own custom blocks.

Regards,

Bryan
answered Nov 5, 2021 by Bryan Lieblick (1,905 points)
edited Nov 5, 2021 by Bryan Lieblick
It would be nice if there was a generic interface to custom C code.

In the generated C-code I have the possibility to include further C-files. But I don't see any other way to call the C-files in the Plecs tasks without manually changing the generated code after each build.
Thanks for the feedback.  The PLECS Coder works based on the functionality you're looking for, in that it inserts C snippets into the generated code.  I'll send a private email generally describing how it works.
...