フィルターのクリア

Embedded Coder - Sequence of commands

2 ビュー (過去 30 日間)
Tobias Gemaßmer
Tobias Gemaßmer 2011 年 10 月 25 日
We use the Simulink Embedded Coder to generate C-Code for our DSP-System. For the input-signals the Real-Time Interrupt Service Routine needs to read out several signals from a Bus, which is made with self-programmed interface-blocks in the Simulink model. During code generation, the blocks, which finally produce few lines of C-code, are placed in the file model_step.c, which is called from the ert_main.c The order of appearance of the read-out commands depends on the model, i.e. at what time the signals are needed during execution. For example, a value from an analog-digital-converter might be read out right at the beginning of the ISR. This can cause a problem, since the analog-digital-converter needs a short time after the interrupt to update its values. So, is there any possibility to influence the placement of these commands within the ISR? Thank you for your help!

採用された回答

Fangjun Jiang
Fangjun Jiang 2011 年 10 月 25 日
The execution order of a Simulink block diagram is data flow driven. It is unlike the C code, which is procedural. For blocks that are not dependent on data flow, it follows the left-to-right, top-to-bottom order to decide which block executes first, which next. So, technically, you can sometimes move the blocks around and it will change the order of execution. But these change is not supposed to affect the outcome result.
You can view and specify the execution order. Click Format>Block Displays>Sorted Order. It will show the order of the block execution of every block in the whole model. You need to read the related document to understand what those numbers mean.
You can also change the execution order by specifying the "priority" of the block by right clicking the block and selecting "block properties...". However, this approach is problematic. Many times it cause conflict and it is hard to resolve those conflicts manually.
The most effective way to change the execution order is probably using the function-call generator. You can put your block or blocks inside an atomic subsystem and then use function-call to trig them. This is like manually and forcefully specifying the order of execution.
  1 件のコメント
Tobias Gemaßmer
Tobias Gemaßmer 2011 年 10 月 25 日
Thank you for your answer. In the meantime, I detected the possibility to set priorities for the Blocks. I think this will suit my needs best.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTimers and Scheduling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by