Hi Folks, It looks like I may just have found the perfect excuse to get a PIC into my car :) The speedometer died the other day, investigation revealed the cause was the failure of a drive gear deep in the gearbox that will take lots of cash to get replaced, a fair fraction of the car's worth in fact :( It's an electronic speedo drive so I need to synthesise a signal to feed it. One source of speed related information would be the anti lock brake system wheel sensors which are of the magnet, coil and toothed wheel variety, outputting 46 pulses per revolution at 0.5 - 0.7V (so I'm told). The speedo wants 2,458 pulses per kilometre. This works out at dividing the wheel sensor frequency by about 2.367 with a maximum frequency from the wheels of 320Hz at 150MPH (no I don't plan to go that fast! Might as well design to the max speed though). So I was thinking that for this purpose I could do this with a small pic: Take 1000 "1" bits and distribute them evenly over a 2367 bit string with everything else being "0", (so we're looking at a 296 byte table) every time a pulse comes in from the ABS, read the next bit in this string and set an output pin appropriately. End result should be a signal that is (on average) the input divided by 2.367 . Can anyone see any problem with this algorithm in this application? I daresay I could happily cut down the table length too, I only need a maximum error of 5% or so I guess. All thoughts welcome! Cheers, Robin. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist