This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Speed Measurement for Cars

Hi Folks!
I'm working in a digital panel for rally cars, with some pressure, temperature, engine and car speed and other things. My problem is: I need to measure car speed with a sensor plugged into the gearbox (it gives me 4000 pulses on each kilometer). If I do a measure every 1 second I can get the car speed with some calculus. But how I can do a 1 second interrupt using timer 0 or 2 (I'm using C517 from infineon and timer 1 is measuring engine speed). My program is written in C. Any suggestion will be extremelly apreciated.
Thanks !!
Luis

Parents Reply Children
  • Maybe you can measure time between pulses. At 200km/h you get about 222 pulses/second which should not be a heavy load for CPU.Use FF to divide pulse train from gearbox and connect output as a gate for timer 0 or 1 and use falling edge of that signal as interrupt for CPU (measurement done).Also use timer overflow int. for extending counter range at lower speeds.You can even combine this method with the previously suggested one - for high speeds use period measurement method and for lower speeds use frequency measurement method.

    regards

    Dejan

  • You are right. I can measure period instead of frequency. In a 16 bit counter is ok to measure down to 15 pulses/second that gives me about 15 km/h. Some of our cars originally can measure only from 20km/h. And for sure my car cannot run at 921600km/h that corresponds to a 1 machine cycle. I think it's more clear now to me and I can figure out a routine to do that.
    Thank you a lot for now!!!!
    Luis