2011-10-18 11:16 PM
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 You2011-10-19 06:46 AM
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.