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.

Frequency counter, crystal, resonator, oscillator

I am enjoying experimenting with my Launchpad and am encouraged to build a frequency counter. If I clock the MSP430 quickly enough then I can count the number of clock cycles between each rising edge of the signal to be measured. Say I wanted to measure a frequency up 10 MHZ then whaich MSP430 would be best and how fast should I clock it. SHould I use a crystal or a resonator or another device to clock the MSP ?

  • You can use any MSP430G2xxx chip that came with your LaunchPad Kit to do that. They all have a TimerA.

    That Kit also includes a 32.786 kHz crystal. And you need to solder that crystal on the board to be used as your time/frequency reference. Connect the ~10 MHz signal to P1.0/TACLK in order to measure its frequency.

    Your code should use the LF crystal oscillator divide by 8 to source the ACLK. Set up the TimerA to count TACLK (i.e., the signal you connected to P1.0/TACLK) in continuously up mode. Set up TACCTL1 to capture the edges of ACLK (which is precisely 32.768 / 8 = 4.096 kHz).

    The frequency of your ~10 MHz can be measured from the difference between two consecutive captured TACCR1.

    F = ( [previous CR1] – [current CR1] ) * 4.096 kHz

**Attention** This is a public forum