I am currently in the process of building an ignition control module for both a three cylinder and a four cylinder engine and I am using a atmega128. I am having some difficulty getting the output to be consistent. I think I may have some kind of interrupt issue. I am reading the signal from the cam sensor, I have converted it to a digital pulse and there are six periods for each revolution of the cam (3 per revolution of the crank, note: this is for 3 cylinder engine). one of the teeth is longer so I get five short pulses an one long. the long pulse tells me where top dead center is for the number 1 cylinder. i can detect this pulse, but I am having trouble getting the correct output based on this pulse. What I mean is that I want output to the 1st cylinder on this tooth. so I detect this tooth grab the index for it, calculate the index for the proceeding tooth (ie long_tooth_index-1) and then on the next cycle where the tooth_index = long_tooth_index-1. I want to count for a time period(this delay is the count to degrees before top dead center which the ignition is fired) and then fire for a time period to an output. I can also do this but for some reason it doesnt stay consistent. I can provide more details if necessary.
thanks
thanks