Problem writing to the channel counters in TPM

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

Problem writing to the channel counters in TPM

跳至解决方案
1,594 次查看
karthick1987
Contributor II

Hi guys,

 

I was using a GT16A today and I found that when I wrote to the TPM1C0VL and H registers, the values didnt seem to get written the result was rather strange. I monitored the values of the register on the debugger and got '"' 34 . I am not sure why this happens and every time I over write it it still remains the same (the initialised value),

 

What has to be done to change the value every duty cycle?

标签 (1)
0 项奖励
回复
1 解答
1,070 次查看
peg
Senior Contributor IV

Hello Karthick,

 

The only limitation here should be the coherency latch mechanism. You need to read and write BOTH bytes every time.

It is also possible to get this "out of step" if you are not writing to TPMxCnSC in between update pairs i.e. you are writing the second byte then the first each update rather than first/second.

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,070 次查看
karthick1987
Contributor II

in other words

 

how do we over write the counter in PWM mode after every duty cycle?

 

Cheers

Karthick

0 项奖励
回复
1,071 次查看
peg
Senior Contributor IV

Hello Karthick,

 

The only limitation here should be the coherency latch mechanism. You need to read and write BOTH bytes every time.

It is also possible to get this "out of step" if you are not writing to TPMxCnSC in between update pairs i.e. you are writing the second byte then the first each update rather than first/second.

0 项奖励
回复
1,070 次查看
karthick1987
Contributor II

Hi Peg,

 

Thanks but the debugger is bizarre!!! 

 

When you restart code-warrior and try it it works fine! I cannot believe it.

 

So moral of the story, restart the program and try again if you think you have done everything you can and it still dosent work!

 

Cheers

Karthick

0 项奖励
回复