John Pearson wrote: > I am thinking of ways to control the ignition timing advance curve of > a car. I was thinking that I might time the amount of time between > cylinder firings and divide that number by 360. Then I would know when > to fire the next cylinder after checking with a lookup table for the > programmed curve. > > Is there a better or easier way? John: Why divide by 360 at all? I don't see what purpose that would serve... Anyway, it's harder than it appears; if you only have a low- resolution source of engine-position information (like the distributor), you'll probably find that your PIC will retard the timing whenever the engine's accelerated. You can get better engine- position resolution if your car has a crank sensor on the flywheel or something... But if you use that instead of the signal from the distributor, you'll no longer get free information from the distributor's vacuum sensor, which is sorta important if this is for a street-driven car, since you won't get real good drivability if you just use a hardwired curve. On the other hand, using the distributor signal (after it's been affected by the vacuum sensor) means that you might have to modify your curve to compensate for a non-optimal vacuum-advance. And... Since your engine presumably revs over a large range, you have to make sure that you're measuring time with high-enough resolution for accurate operation at redline, but not so finely that you overflow your counters at idle. There are LOTS of other software issues (and a fair number of hardware issues, as well), but those are the main ones. Ignition controllers are kinda complicated; the ones I did for Jacobs Electronics ran to over 10,000 lines of code. My personal inclination, if I were just doing this for my own car, would be to forget about putting a PIC in there and just take the distributor to a race shop and get it re-curved to my specs (or, if the car didn't HAVE a distributor, take the existing EPROM out of the ECU and have IT modified). If you DO decide to do this project, though, I can offer a bit of advice: Do all your testing on the bench, with a function generator replacing the car's distributor. Spark timing that's bad enough to cause detonation will kill an engine fast, and timing that's GROSSLY wrong will kill an engine REAL fast. Good luck... -Andy === Andrew Warren - fastfwd@ix.netcom.com === Fast Forward Engineering - San Diego, California === http://www.geocities.com/SiliconValley/2499