Using Matlab function in the MBD problems

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Using Matlab function in the MBD problems

2,322件の閲覧回数
haoxue1027
Contributor V

Hello

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.

haoxue1027_0-1600333952722.png

haoxue1027_1-1600333975671.png

Can you give me some advices? 

best regards

hao

 

0 件の賞賛
返信
5 返答(返信)

2,317件の閲覧回数
haoxue1027
Contributor V

@constantinrazva @mariuslucianand @adriantudor 

Razvan,Marius,adrian

I'm sorry to bother you, but could you spare me a moment to help me with this problem?

thank you very much.

best regards

hao

0 件の賞賛
返信

2,308件の閲覧回数
mariuslucianand
NXP Employee
NXP Employee

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,

Marius

0 件の賞賛
返信

2,271件の閲覧回数
haoxue1027
Contributor V

@mariuslucianand Hello,marius

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?

best regards

hao

 

0 件の賞賛
返信

2,293件の閲覧回数
haoxue1027
Contributor V

@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?

best regards

hao

 

0 件の賞賛
返信

2,297件の閲覧回数
haoxue1027
Contributor V

@mariuslucianand Hello,marius

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.

haoxue1027_0-1600345540112.png

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.

best regards

hao

0 件の賞賛
返信