Yes. Mine is just for fun too.
I started with a basic stamp and realized I was losing miles because of the time it takes to do the maths.
I decided to use 2 pics to bypass the problem and I am getting on just fine.
Basically I run the counter pic at 20 mhz. At 100 mph I figure that 1 pulse comes in every 8.52 ms. I am not sure how long the Pic takes between finishing the count and starting the new one but basically what I do is this:
Pic 1:
Count for 852 ms (1 pulse = 1 mph at this count time with my tyre size and speed sensor pulses per revolution)
Send the result out to porta (Actually it is a 14 pin pic so I only have 6 bits per port so I have to send the 7th bit to portc.0...i guess I am limited to 126 mph!)
toggle portc.1 to show that a new count has taken place.
Pic 2:
Running at 8 mhz I poll the input port (again 14 pin device so I have to split the byte between two ports). When the toggle pin has changed I simply read the byte into my mph variable and then do the maths.
The way I figured it is this:
There is a new count every 852 ms
The second pic is running at 8 mhz and so 852 ms must be more than enough for it to do everything (just a guess..but surely!).
So all the first pic has to do is latch the result on it's output port and leave it there for the second pic to pick up when it is ready.
The second pic finishes doing its thing way before the new count so it is always ready to pick up the new byte. That way neither pic has to care what the other one is up to.
I am hoping that the first pic can latch it's output, toggle the status change pin and then get back to counting before a new pulse has come in.
When the speed is 0 mph I write the distance to eeprom. I keep forgetting to wait till the speed is zero before writing and so I have lost a few KM. If I could just keep the pic running for a few seconds after the ignition is off then that would do it. Perhaps I need a really big capacitor in there but this does seem a little bit mad. I quite like the idea of a write button...but then I would have to remember to do that wouldn't I! I guess I shouldn't live life in such a hurry.
I'll post my code if you want.
Matt
Bookmarks