how to do mdelay on M4

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

how to do mdelay on M4

463件の閲覧回数
run_zhao
Contributor I

Hi,NXP Expert,

    l can not find mdelay function In sample code for i.MX8M Mini 's M4, if we need delay 1ms ,how to implement it ?

as below

void mDelay(iTE_u16 Delay_Count)
{
   uint32_t i;
   while(Delay_Count--)
       {
              for (i = 0; i < 1000; i++) {
                __NOP();
              }
       }
}

but l am not sure how many __NOP() use ? how to compute it ?

thanks

ラベル(1)
0 件の賞賛
返信
1 返信

411件の閲覧回数
b36401
NXP Employee
NXP Employee

Actually it depends on the compiler how it to realize this loop.
I can suggest to set some amount of NOPs measure the delay and then correct it.

0 件の賞賛
返信