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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

2,284 Views
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 Kudos
Reply
3 Replies

2,266 Views
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 Kudos
Reply

2,260 Views
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 Kudos
Reply

2,228 Views
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