S12ZVLA128 Timer module 1ms interrupt

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

S12ZVLA128 Timer module 1ms interrupt

1,850件の閲覧回数
oceansea
Contributor III

hello,

i use the S12ZVLA128 MCU development a product ,now i have a problem.

i set the internal-bus-clock 24MHZ,  CAN bit-rate is 500Kbps.   then i want use the Timer module(TIM16B6CV3),i need a 1ms interrupt ,because i want do someting in the  TIM_interrupt_ISR (for example :switch I/O every 1ms, send a CAN message every 10ms) .  i disable  the precision-timer ,the prescaler maxvalue is bus-clock/128   ,so the Timer frequency is 24000000/128=187500,period is 5.3us  ;this can't meet my requirements ,so,what should i do ? thank you very much!

           haiyang 

           2019-0709

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

1,623件の閲覧回数
oceansea
Contributor III

hello Edward Karpicz,thanks reply.

but i can't understand about:perfectly fit timer period 24E6/(1/0.001) < 2^16?

could you detailed description about this?

thank you very 

haiyang

0 件の賞賛
返信

1,623件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hello,

You can refer to this example:

Example S12ZVL ADC0 triggered by TIM0 OC updates PWM duty cycle 

The OC is 25ms in this case.

BR, Daniel

1,623件の閲覧回数
oceansea
Contributor III

thank you my friend  ,i have solve the problem.

0 件の賞賛
返信

1,623件の閲覧回数
kef2
Senior Contributor V

I meant that you need 1ms interrupt period, right? 1ms perfectly fits into 16bits timer running at 24MHz.

24M / (1/1ms) = 24000, which is much less than you have in 16bits timer, which has pow(2, 16)=65536 of timer ticks overflow period. So just go with this, you don't need prescaler.

0 件の賞賛
返信

1,623件の閲覧回数
oceansea
Contributor III

thank you my friend  ,i have solve the problem.

0 件の賞賛
返信

1,623件の閲覧回数
kef2
Senior Contributor V

Timer prescaler just increases jitter for input capture function and reduces resolution for output compare function. If you need 1ms interrupt then you perfectly fit timer period 24E6/(1/0.001) < 2^16.

0 件の賞賛
返信