RE: CDI gr8flyer55
It's easy enough to include inline assembly in your C code. Advanced programmers often check the assembly that is generated from the C code and redo any parts they don't like with an inline assembly routine.
But the main issue is that Nyemi's code uses polling while mine uses interrupts. Polling repeatedly checks the pin to see if it's changed. With the interrupt it calls the interrupt service code when the hardware finds a falling edge. So I only get one interrupt.
I added an if statement to check if GP2 is low when the interrupt is called. It seems to work fine in the simulator until 81 Hz (about 4800 RPM). I'm not sure what's going on here and will have to do some real world testing. I have no idea if this is just a simulator artifact or if it is a real world problem.
-
I did some more testing with a real spark plug and the CDI seems able to spark continuously at 63 uS between sparks. I used a trigger pulse of 3 uS, then a delay of 63 uS for each spark. That was the fastest it could spark reliably. So about 66 uS between sparks.
So the unit can spark every 5 deg. up to 12,300 RPM!!!
Or every degree up to 2,500 RPM!
This is without the added resistance of cylinder compression, but it bodes well for the multispark idea!
-Jake