S12ZVLA128 Timer module 1ms interrupt

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S12ZVLA128 Timer module 1ms interrupt

869 次查看
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 回复数

642 次查看
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 项奖励

642 次查看
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

642 次查看
oceansea
Contributor III

thank you my friend  ,i have solve the problem.

0 项奖励

642 次查看
kef2
Senior Contributor IV

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 项奖励

642 次查看
oceansea
Contributor III

thank you my friend  ,i have solve the problem.

0 项奖励

642 次查看
kef2
Senior Contributor IV

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 项奖励