crazypj said:
Pretty sure top end won't survive at 14K.
You'll probably need Carrillo rods over 12.5K unless pistons are a lot lighter than stock
Yeah... I have no plans of going past 11,000 or so and even then, only sparingly. The goal of chasing higher RPMs in code is to help increase the accuracy of the ignition at lower RPMs. The faster I can get the code to execute, the less real-world time will take place between sensor readings and calculations.
[quote author=eyhonda]I'm not using an ICE, debugger or simulator. I just edit, compile & flash. Then, I check the I/O with a scope. I have a function generator as the trigger and some LED's on the outputs. My motor is simpler; being a single and having one pulse every cam rotation (every other crank rotation). I'm running at 8mhz clock and a pre scaler of 8. Then, I use both an external and a timer interrupt. The trigger is on the ext int. The timer sets the base time loop of 255 us (8mhz/8 = 1uS * 255 timer0 loops). The ext trigger measures the rpm based on the period. For my app, 130 ms is 900 rpm and 13 ms is 9000 rpm. There are two loop timers; one for rpm and one for delay (advance). Basically, if the period is 130ms and the advance is 1ms, I fire the output after 129ms. The fire pulse is fixed (5ms for now). The advance is based on 720 due the half speed cam. So at 40 degrees advance, I only need 20. At about 6000 rpm, the period is about 20ms. 40 deg advance is about 5% of the period. I wait 95% of the period (19ms) before firing the ignition. The idea is that I can't fire an output in advance but I can after a delay. So the first two pulses calculate the period (rpm) and the advance fire is ahead of the third pulse. The timers are reset every ext interrupt. So far it's working. It's not very accurate since the smallest/shortest delay is only 255us. I tried a prescaler of 1 that makes a timer loop of 32us but it was intermittent pulsing. I'm thinking some math error or overflow is occurring. I think a 255us resolution is ok for now. Next I will try to make a pulse doubler to trigger the tach I have. It is a 2 stroke twin looking for a pulse every rev. My motor is 1 every 2 so I need a double freq to trigger the tach. Also, I'm using the adc to determine voltage levels with 3 LEDS (low/middle/full).
Just another couple notes for you. You can power the output transistor directly to the coil. The 12v side of coil will only be on the collector when off and won't affect the 5v levels of the micro. You still need the diode. Don't use a relay to fire the coil. At high rpm, it won't keep up. Remember, it's still a mechanical switch and will have a speed limit.
Good ideas for the shift and redline. I will implement those features too. It will be easy now since I have a continuous rpm calculation. For know, I'll just hard code the numbers in. It's easy to flash new software with ICP. Just a 6 pin connection. Also, the advance is also hard coded in (19 steps). I have two other tables to program (a sport and base table of curves). I have the race curves programmed now.[/quote]
I've just upped mine to 20Mhz with a prescaler of 0. We'll see how that works out. I'm running with interrupts on the external (Hall) and on the timer as well. It seems to make the most sense to do it that way.
I've done a few things differently though... I'm running everything in µs rather than ms and calculating out the µs per degree which, of course, changes as a function of RPM. What's really killing me is the programmable dwell, though. I'm having to ground the coil in advance of the advance, if that makes sense.
It just occurred to me, in the typing of this, that I should probably do it a bit differently. I'm hardcoding all the "advance steps" in µs breakpoints with a large conditional statement to jump between them. I suppose I should just be hard coding the µs of advance rather than the degrees of advance. That will save more calculations...
As for the relay, I cut that from the plan a while ago. I ran across the same problem you mention. It's just not fast enough to keep up. Instead, I'm going solid state and I found a transistor I quite like for the task: IRGB14C40L
I don't think switching the coil from most standard transistors will be a good idea. There's A LOT of flyback coming from the coil when you unground it. Several hundred volts, usually.
Anyway... if you wanna look at what I have for code so far, lemme know. I'll email it over. I don't making this a joint project.
