How to run a task/function using MBDT on Matlab/Simulink?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to run a task/function using MBDT on Matlab/Simulink?

2,254 次查看
rolo90
Contributor I

Hello everyone,

I wonder how can you allocate a task or function to run in the background loop using NXP MBD toolbox on Matlab/Simulink? Can this functionality be added?

Thanks,

Rolando

 

0 项奖励
回复
3 回复数

2,236 次查看
mariuslucianand
NXP Employee
NXP Employee

Hello @rolo90 ,

MBDT generates bare-metal code so no RTOS is used. If you want to add a function to be executed periodically, you have to use a timer, for example PIT to trigger periodically the code you need.

Hope this helps,

Marius 

0 项奖励
回复

2,230 次查看
rolo90
Contributor I

Hello @mariuslucianand 

I want the function to run on the infinite while loop. I am aiming for something like this: 

int main()

{

      while(1) {

      MyFunction();

      }

}

Is it possible?

Thanks,

 

Rolando

0 项奖励
回复

2,198 次查看
mariuslucianand
NXP Employee
NXP Employee

Hello Rolando,

the only way in which this can be done, is to open the mbdtargetmainlibs32k.tlc attached in the toolbox, look inside that file and add your function name in the following location. Then insert your function with custom code.

mariuslucianand_0-1625054226816.png

Hope this helps,

Marius