Calculating frequency in BASIC
Moderators: David Barker, Jerry Messina
Calculating frequency in BASIC
I am working on an led shift light project based on a pic18f4550 chip. The basic goal of this project is to light a series of leds depending on a few different rpm ranges, the higher the rpm, the more leds are lit. I am using the tach input signal wire from inside the dash of my car. It is a 12 volt signal, which I have dropped down to 5 volts with a voltage divider, and put in parallel with a 5.1V zener diode incase of any spikes in the signal. What i need help with is using the pic to calculate the frequency of this signal to determine rpm. The accuracy doesnt need to be incredibly close, as a faster refreshing display would be more beneficial than accuracy. I am new to pics, so any advice or sample code would be great. (I am using the internal oscillator if that matters)
Hello hgboy(what is your real name?!?)
A simple method that will work very well is to treat the RPM signal as if it were an AC supply and rectify it then feed it into a C/R filter and voltage divider.
What you will get is a dc voltage that varies with the frequency, measure the voltage and you can flash you leds to your hearts content.
A simple method that will work very well is to treat the RPM signal as if it were an AC supply and rectify it then feed it into a C/R filter and voltage divider.
What you will get is a dc voltage that varies with the frequency, measure the voltage and you can flash you leds to your hearts content.