Please help me !

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

Please help me !

1,916 次查看
baonguyen
Contributor I
Dear everybody,
 
       When I set the register T1SC ( TIM1 status and control register of MC68HC908GZ60 ) the value 0x30, the Metrowerk's CodeWarrior 5.0 does not set bit T1SC_TRST to the value 1 ( I want to reset TIM1 counter register). I tried to use the operator "~" ( bitwise NOT ) for bit T1SC_TRST but nothing happenned, even CodeWarrior 5.0 ignored this command ( I see this problem when I debug my program ). What's problem ? How can I set the bit T1SC_TRST ?
 
Thanks a lot
Best regards 
标签 (1)
0 项奖励
回复
2 回复数

425 次查看
rocco
Senior Contributor II
Hi, Baonguyen:

Even after you have written a one to TRST, it will always read back as zero. It does not hold the timer reset, but simply clears the timer instantaneously. If you need to, the TSTOP bit can hold the timer at reset until you clear TSTOP. This appears to be what you are doing by writing 0x30 to T1SC.

edit:
(: Oops, peg beat me to the post again :smileyhappy:

Message Edited by rocco on 05-23-200612:20 AM

0 项奖励
回复

425 次查看
peg
Senior Contributor IV

Hi baonguyen,

If you consult the datasheet you will find that TRST is "write only". It always reads as zero.

Is the reset occuring?

From the Datasheet:

TRST — TIM1 Reset Bit

Setting this write-only bit resets the TIM1 counter and the TIM1 prescaler. Setting TRST has no effect on any other registers. Counting resumes from $0000. TRST is cleared automatically after the TIM1 counter is reset and always reads as 0. Reset clears the TRST bit.

1 = Prescaler and TIM1 counter cleared

0 = No effect

NOTE

Setting the TSTOP and TRST bits simultaneously stops the TIM1 counter

at a value of $0000.

Hope this helps

Regards David

0 项奖励
回复