Check my website below. The first project listed is called 'Super Probe' it does 16 functions including frequency counting, and event counting. The full source listing is included.
By the way, are you looking for frequency or pulse width? Pulse width is much easier to handle.
--
Luhan Monat (luhanis \'at\' yahoo \'dot\' com)
"The future is not what it used to be..."
http://members.cox.net/berniekm
You can use Timer0 as a free-running, async clock on many of the PICs. The claim is that you can measure up to 50MHz with it. Start a different clock, clear the timer register, and then start Timer0. When it overflows, you have 256 ticks, so the clock >> 8 is the period. If it's too fast, count some number of overflow interrupts. Use a crystal, since the RC clock is pretty inaccurate.
There are fixed point routines available for divides, which will allow you to output a frequency.
There is also a tech note on the microchip site that describes all of this.
I don't know if this is the right forum. If it doesn't go, please, find out the correct for my questions.
I am developing system to measure frequencies with PIC and I am with difficulty in programming the capture of the information (pulses) and to record in a variable. If somebody can help myself, I thank. TIA
Near the bottom of the are text links to source and object codes.
An LCD would be easier, the LED's I have need to run constantly.
If you have questions on the code, you can email me directly - just be sure to put something specific in the subject line so you wont 'get thrown out with the spam'.
--
Luhan Monat (luhanis \'at\' yahoo \'dot\' com)
"The future is not what it used to be..."
http://members.cox.net/berniekm
I thank for you to be interested in helping me. If I do Timer1 to begin in the ascent of a pulse present square in the pin RA2 (for example) and in the descent of this same pulse, to stop Timer1 I have the half of the period of this square wave. Am I right? Tks Fernando
"Luhan M> > I don't know if this is the right forum. If it doesn't go, please, find
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.