There is a need to use some port timing config in my MBD simulink（devkit MPC5744P).
So I want to use matlab function. But I don't know how to config the time accurately,for example ,the t1 in the following picture.
I have used the nop() in my matlab function , but it seems not work.
Can you give me some advices?
Hello @haoxue1027 ,
I think you can achieve this exact timing using a PIT timer, channel 1.
Please have a look at one of our PIT examples. Basically you need to use a volatile declared flag, and inside your program, whenever you want to toggle the CLK pin you modify that flag.
This is one way of doing it!
Hope this helps,
I have tried to use matlab function to do the port timing.
But it seemed not work.
In the matlab function ,The actual hardware pin voltage level does not change with the code.
If I used the PIT,how to realize it ?
Can you explain it a little bit more?
@mariuslucianand Hello marius
Can I used a C code “for loop” to implement that?
For example, If I want to have a time delay 500ns, I can use the for( i=0:i<10:i++)(MPC5744 one step 50ns).
Whether this method can be implemented for time dely?
Thank you very much for replying.
What I want to know is that if have a C code(like _nop() or dely function) can be used in the matlab function to make a accurate time dely.
Beacuse I want to config a port timing like following.
If there is no such C code , can you tell me further how to implement it by the MBD.
I have used the stateflow to test it.
It seemed that the timing is not accurate.
Thank you very much.