lpc1769 - timer match register

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

lpc1769 - timer match register

675件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by inspire on Sun Jan 13 05:11:24 MST 2013
Hi,

in the LPCXpresso examples for the timer the MR0 register is set to the value where the timer interrupt occurs:

#define TIME_INTERVALmS    1000
...
LPC_TIM0->MR0 = TIME_INTERVALmS * 10; /* Set up 10 mS interval */


But now I wonder if this is absolutely right this way? When the interrupt occurs the TC value is reset. So TC moves between 0 and TIME_INTERVALmS * 10 = 10000. But this means that 10000+1 ticks have to pass until the interrupt occurs, right? So shouldn't MR0 be (TIME_INTERVALmS * 10) - 1?

Have a nice sunday!
inspire
0 件の賞賛
返信
2 返答(返信)

540件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by inspire on Sun Jan 13 05:31:52 MST 2013
okay thanks! :)
0 件の賞賛
返信

540件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gbm on Sun Jan 13 05:23:43 MST 2013
You are right of course - to get N ticks you should load N-1 to MR.
0 件の賞賛
返信