Page 1 of 1

Accurate timing under rapidly changing RPM? Algorithm Q

Posted: Thu Mar 13, 2014 1:51 pm
by Adnan
Hi,

I haven't determined how exactly MSII determines when to fire spark but from a programming point of view, there are at least two ways to do it.

One is to measure RPM and rate of change of RPM and set an Output Compare timer for the necessary dwell and advance and then let it execute independent of the CPU. This is a predictive "fire and forget" method that, under steady-state conditions, will be perfectly accurate. If things are changing, such as rapid acceleration or deceleration, there will be some error.

Another approach is to set the output compare as before but at the last crank tooth encountered before spark, re-compute advance and adjust the value in the Output Compare timer. This, in theory, would provide more accurate timing, given that it was updated as late as possible.

What method does MSII use? The first is simpler, akin to how injectors are fired. Given that the input used in the first method is only one revolution "old", is timing plenty accurate? Am I over-thinking this?

Thanks!

Re: Accurate timing under rapidly changing RPM? Algorithm Q

Posted: Fri Mar 14, 2014 5:00 am
by Matt Cramer
Does this help explain it?

http://www.megamanual.com/ms2/wheel.htm

Re: Accurate timing under rapidly changing RPM? Algorithm Q

Posted: Fri Mar 14, 2014 8:33 am
by Adnan
Hi Matt,

Thanks, this does help.

Is the source code for this section available or is it proprietary? I understand what it's doing from the link you sent, in that it counts physical teeth to get as close as possible to the firing point and then estimates only the last portion prior to the next physical tooth. What I'd like to determine is how it is implemented with the output compare modules. My guess is that it sets up the output compare for a delayed start (thereby estimating the point at which to start charging the coil), puts in a spark time and updates this spark time as it gets to the last tooth. Would be nice to see the details.

Regards,
Adnan