S12ZVLA128 Timer module 1ms interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S12ZVLA128 Timer module 1ms interrupt

1,324 Views
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

Labels (1)
0 Kudos
Reply
6 Replies

1,097 Views
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 Kudos
Reply

1,097 Views
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,097 Views
oceansea
Contributor III

thank you my friend  ,i have solve the problem.

0 Kudos
Reply

1,097 Views
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 Kudos
Reply

1,097 Views
oceansea
Contributor III

thank you my friend  ,i have solve the problem.

0 Kudos
Reply

1,097 Views
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 Kudos
Reply