cancel
Showing results for 
Search instead for 
Did you mean: 

Measure frequency using STM32F100C4

michaelko
Associate
Posted on October 19, 2011 at 08:16

Hi , i am using STM32F100C4 and a 8 Mhz quartz.I want to measure frequencies in range of 48 Hz - 1 Khz on some input pin.What is the easiest way to do that ? ( I am using Keil uVision 4 IDE),is it using timer capture and compare ( no idea how to do that ? :)   ) or is it possible using external event ( interrupt) ? 

Thank You
1 REPLY 1
Posted on October 19, 2011 at 15:46

capture compare is one method that will work, encoder/counter will also work, as will interrupting and time stamping edges.

capture compare is used to measure the period of a single cycle, you might want to average/filter that before extrapolating it to cycles per second. You basically read the register at each interrupt and compute a delta in TIMCLK/prescale ticks. Remember also that the register is only 16-bit wide.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..