So for my project 'measure acceleration due to Gravity' I need to write code for a clock that will calculate the exact time between two switches being pressed. Im wondering what clock would i need to use. Working with the MSP430G2553.
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.
So for my project 'measure acceleration due to Gravity' I need to write code for a clock that will calculate the exact time between two switches being pressed. Im wondering what clock would i need to use. Working with the MSP430G2553.
user4205678 said:exact time
What is the definition of "exact time"? Because to be exact requires infinite resolution which translates to infinite frequency.
Ok, so being practical and using the definition "as best as the MSP can do" the recommended solution would be to set the SMCLK at the highest possible for your part (see datasheet for spec, user's guide for registers) and use the Timer module in capture mode. You can find examples in MSP430Ware of clock setting, Timer use, etc.
Spoiler alert: It's about 9.79 m/s2.
Well im expecting the time between presses to be less than a second maybe two seconds so an accurate clock in that range is what im looking for.
user4205678 said:Well im expecting the time between presses to be less than a second maybe two seconds
To measure up-to two seconds you could possibly use 16-bit timer running from LFXT, 32KHz resonator. This will give you 0.03msec granularity thus 0.003% measurement precision.
**Attention** This is a public forum