so I've got the code done on mine; I was able to get this done with the uno, the trick for me was to use progmem.
I filled a vector full of unsigned ints representing the time to delay coil charge. This array is stored to progmem, the trick is like what you'd do to create a high resolution waveform: the array is pre-calculated so that when an overflow count of timer 1 (ctc for the hall effect pickup rising edge, 256 pre-scaler) is sent to the array's index, the array returns the correct number of ticks for the desired advance curve.
So, yeah well it works and the cool thing is you can have a very high resolution, complicated piece-wise or (initially) continuous advance curve and not need to do any costly math to get the correct delay time. This is the table I am using now, not necessarily ideal but gets the idea across:
Now since we only have a maximum of 31k or so bits, or 15k long ints to describe how to delay for the real number line of rpm b/w 0 and 16k rpm or so, the graph of expected rpm ends up looking like this:
Now an example 100hz (6000rpm) signal generator sent to the uC's ctc counter 1. Here's the logic analyzer output of the signal generator and the logic level charge pulse:
The mS delay between rising edge and falling edge = 9.18 ms (n.b. that's inclusive of the 2 mS dwell). The desired degree advance at 6000 rpm was 30 degrees btdc (using a pickup location of tdc), if you do the math:
mS per rev = 1 / (hz = 100) * 1000 = 10
and so actual degrees advance = (1 - mS Delay / mS per rev) * (360 - pickup Location) = (1-9.18/10) * (360 - 0) = 29.268 degrees
As was seen in the expected curve, the higher the engine speed, the more we see expected timing deviate from selected due to a lack of floating point accuracy.
So let's see this with a plot of the digital logic analyzer output at 200 hz, i.e. 12k rpm when the expected degree advance was 8.05ish:
The math for the 2.912 mS + 2ms dwell = 4.912 mS delay:
mS per rev = 1 / (hz = 200) * 1000 = 20
and so actual degrees advance = (1 - mS Delay / mS per rev) * (360 - pickup Location) = (1-4.912/20) * (360 - 0)
= 6.336 degrees and error = 1.6 ish degrees
is that ok guys? lol
now, to make: some clamping circuits so this can be triggered by points or pickup coils or whatev, a curve artist interface and/or field adjustable interface (edited)