Delay Function in msec

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

Delay Function in msec

1,948件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by superkato on Wed Apr 08 05:25:05 MST 2015
Hi,

does someone has a example for a simple delay function in milliseconds?

like:
Delay(1000); //1sec delay


void Delay(uint32_t msecs)
{
  while (msecs != 0)   
  {
    //do something with the systicktimer;
  }

}



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

1,354件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Apr 08 09:24:24 MST 2015
http://www.lpcware.com/content/forum/what-do-you-use-to-delay
0 件の賞賛
返信

1,354件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nerd herd on Wed Apr 08 07:28:55 MST 2015
Hi superkato,

Just to get your thought process going, a basic delay function can be implemented by using a timer interrupt (Systick works fine) and sleep mode. The idea is that you start a timer that will count for the desired delay duration. While it is counting, the MCU can be put into Sleep mode ensuring no code is being executed. Once the timer goes off, the interrupt will wake up the MCU and resume code execution. You can then disable the timer and exit the delay function.
0 件の賞賛
返信