Message Edited by rocco on 05-23-200612:20 AM
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