This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TMS320F28377S:将驱动程序库代码与 Simulink 状态流生成的代码相结合。

Guru**** 2439560 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1119206/tms320f28377s-incorporating-driver-library-code-with-simulink-state-flow-generated-code

器件型号:TMS320F28377S

我们正在使用 Simulink 状态流开发项目的状态机。  系统存在初始化、待机、运行和故障等离散状态。 在每种状态下、DSP 都需要执行一些与硬件相关的任务、这些任务需要使用驱动程序库函数。 例如、我们需要检查是否有任何通过 UART/SPI 进行的新通信。 然后、需要读取接收到的数据、处理数据并回复数据。 根据我的理解、状态流允许调用 Matlab 函数和 C 代码、但我不清楚如何合并使用器件驱动程序库函数的 C 代码。  

我想到了以下两种方法:

1-我从 Simulink 状态流中取出一个指示当前状态的状态变量,基于此,我调用在状态机代码之外写入的相应函数。

2 -我在状态流中进行一些空 C 函数调用、然后在这些函数中手动复制驱动程序库代码。

如果有更好的方法来解决此要求、请提供指导。