Eclipsed said:
The counting part really isn't a problem, scaling it down in a timely fashion is.And how to implement the scaling.BTW its to adapt a hotwire mass airflow sensor to be used in place of a karman vortex airflow sensor.
Right, although I don't have a clue what they are - at least I know why it needs to be done :lol:
From your previous figures, presumably 2000Hz in should give nothing out, and 15000Hz in should give 2400Hz out, and it should be linear inbetween?. So the first thing to do is subtract 2000 from the incoming frequency - so that gives 0-13000 that needs changing to 0-2400. If you divide 13000 by 2400 you get 5.42 - so by dividing 13000 by 5.42 you get the required frequency.
Now PIC's don't like floating point numbers, so it's a good idea not to use them if you can - there are various ways of avoiding this, but it really depends on your requirements.
You mentioned it doesn't need to be particularly accurate - in that case would dividing by 5 be near enough?.
Do you have a figure for how accurate it has to be?, also how many levels of output do you need? - do you need as much resolution as possible, or would 20-30 discrete frequencies be enough - if so you could divide 13000 by 542, to get a value from 0-24, giving 100Hz output resolution.
You could scale it up, divide 1,300,000 by 542 to get the right answer, but that means going above 16 bit maths.
You also mentioned it has to be fast - how fast?. I'm presuming the sensors aren't particularly fast them selves?.