frequency detection with MSP430

Hi. I'm working with the TI MSP430 and I'm trying to use the Timer_A input to do frequency counting but so far I haven't been able to get it working. I'm pretty sure I just haven't configured things correctly. Does anyone have any sample code that shows the Timer_A input being used to find the frequency of an input? Thanks.

Lee

Reply to
Lee Thalblum
Loading thread data ...

You will need to tell us the frequency range you want to measure. The techniques for determining frequency depend on whether the input is higher or lower than the clock frequencies for your counter/timer.

For lower frequencies:

set up the input pin to do an input capture on one edge or another of your signal. Capture and count as many edges as necessary until the accumulated period counts have enough resolution, then do the math.

For higher frequencies

Put the signal into the clock input of the counter. Then use a lower-frequency clock from the other timer to gate the input. With the input count from timer A and the gating interval from the other timer, you can calculate the frequency.

The details depend a lot on the frequency range and the precision you require, and the time you are willing to spend to collect a single reading.

Mark Borgerson

Reply to
Mark Borgerson

I'm going to be reading a frequency ranging between 500 KHz and 1 MHz. I'll be running off an 8MHz crystal. Everything else is pretty fluid at this point.

Lee

Reply to
Lee Thalblum

Hello Lee,

With respect to Mark's two categories that would qualify as a high frequency range.

Regards, Joerg

formatting link

Reply to
Joerg

I don't know anything about the MSP430, but an AVR can have it's timer run on an external clock of Fclk/2.5. So an AVR running at 8MHz should be capable of measuring 3.2MHz applied to the external timer input.

Meindert

Reply to
Meindert Sprang

Hello Meindert,

Many micros can do that. The MSP430 tops that a bit. For example, timer A on the MSP430F1232 can be externally clocked at a whopping 10MHz when the chips runs at 3V. At 2.2V VCC it still does 8MHz.

Regards, Joerg

formatting link

Reply to
Joerg

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.