About S12ZVL Time Output Compare

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

About S12ZVL Time Output Compare

1,620 次查看
jx1207
Contributor I

I wang to make an interrupt ever 200Hz, so I write the code as the follows. But the interrupt is not right, I didn't find the problem,I think set the TIM0TC2 register can change the output time,but it didn't work.Why?

0 项奖励
回复
2 回复数

1,536 次查看
jx1207
Contributor I

I try to add "TIM0TC2=TIM0TC2+OC_Time" in the interrupt. It works right. But why add this command? I have configure the TIM0TC2  register in the Timer_OC().

(ps: the bus clock=16MHz,OC_Time=5000)

0 项奖励
回复

1,536 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi jx1207@126.com,

Because the OC match does not reset the counter.

Your solution is correct, you need to update the TIM0TC2 register with the counter value of the next OC match.

Example S12ZVL ADC0 triggered by TIM0 OC updates PWM duty cycle 

BR, Daniel

0 项奖励
回复