How to set a 5ms delay using TIMER in MSP430G2553 ??
how to do timer calculation in msp ??
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
How to set a 5ms delay using TIMER in MSP430G2553 ??
how to do timer calculation in msp ??
Haresh:
Check out chapter 5 of http://processors.wiki.ti.com/index.php/Getting_Started_with_the_MSP430G2553_Value-Line_LaunchPad_Workshop
It should get you started on setting up the timer to do the 5 msec delay that you need.
(Frequency of Timer Clock in Hertz) * (Desired Delay in seconds) = (Required Timer Count)
Note that you can scale this equation (ie use frequency in Kilo-Hertz and delay in milli-seconds).
Timer can be configured to use one of a few different clocks, so you have to know how you are setting it up (and the rest of your clock tree as well) to know what to use for frequency.
You also have to make sure that the number output of the equation doesn't exceed 65535, as the capture/compare registers in the timer are only 16-bits.
Timers are actually counters. They count clock pulses. How many clock pulses are 5ms depends on the clock frequency (including any dividers). If you feed the timer with 1MHz from ACLK, then 5000 clock pulses are 5ms. You configure the timer to up mode, ACLK, and set the compare register 0 (TAxCCR0) to 4999 (0 counts too) and you’ll get a timer overflow interrupt every 5ms.
I second the recommendation to read the timer chapter in the users guide.
**Attention** This is a public forum