ECU Input: Time
One of the most basic inputs to the ECU is 'time'. This is not a time-of-day like you get from your watch, but simply the ability of a computer to measure the time between events.
The ECU generates its notion of time internally to the processor itself. The processor uses a quartz crystal to generate its timing signals, in the exact same fashion as a digital watch bases its notion of time on the beating of a quartz crystal. The processor crystal beats much faster than a watch crystal though. Most watch crystals vibrate at 32,768 Hz (cycles per second). The crystal in the Aprilia ECU runs at 8,000,000 Hz, or 8 megaHertz (8 MHz for short). Since the 68HC11 divides the crystal frequency by 4 to get the CPU clock, it means that the actual internal CPU clock frequency is only 2 megahertz, or more than 1000 times slower than a typical PC. Even at this slow frequency, the processor has enough horsepower to get the job done.
Inside the processor, the 2 Megahertz clock is used to drive all of its timebase counters and timers. The 68HC11 timers are programmable, but an examination of the firmware reveals that they are programmed to divide down the 2 MHz clock so that they only count at 500,000 ticks per second, or half a megahertz. While this seems slow by PC clock standards, it actually means that the processor is capable of timing events down to a resolution of 2 microseconds (2 millionths of a second). For the ECU's purposes, this is plenty of accuracy.
Consider that if the Aprilia Rotax engine is spinning at its redline, the crank is turning at 10,500 revolutions per minute. This would be 10500/60 or 175 revolutions per second. Each revolution would take 1/175 of a second, or 5714 microseconds for a full 360 degrees of crankshaft rotation. Since the processor can time events to an accuracy of 2 microseconds, this means that the processor is theoretically capable of resolving the position of the crank down to 360/(5714/2) or 0.126 degree of a rotation, even at the redline.
To help track the passage of time, the processor has some special registers inside it that continually count elapsed time. Every 2 millionths of a second, the counter increments, which is to say that the value inside the counter gets one larger. When the count gets to the maximum value that the counter can hold, the next tick causes the counter to 'roll over' back to zero, just like the odometer on older cars would when they hit 100,000 miles. The processor can easily determine an elapsed time between two events that it is interested in. When the first event occurs, the processor makes a note of the current count in the timer register. When the second event occurs, the processor again reads the current count in timer register. By subtracting the reading taken at the first event from the reading taken at the second event, the processor can determine the number of times that the timer 'ticked' between the two events. Since each timer tick represents 2 microseconds, the processor can easily determine exactly how much time occurred between the two events.
Uses of Time
The processor uses time to calculate the ignition dwell (the period of time that the coil charges), and the exact instant when to fire the coil (which determines the ignition advance). It also uses timing information to determine when and for how long to squirt the fuel injectors. The processor also uses time to calculate engine RPM information. The RPM information is used to for a variety of things, one of them being to sense when the rider is trying to run the engine past the redline. When the ECU detects an over-speed condition, it quits generating sparks and stops injecting fuel until the engine comes back down to a safe operating speed. This is definitely an improvement from the old days when an engine would warn you of an over-speed condition by firing a connecting rod out of the engine cases.
By combining the crankshaft position detection mechanism with the ability to accurately measure time, the ECU is easily able to determine engine RPM. To review, the Rotax V60 engine is designed to emit six evenly-spaced electrical pulses per rotation of the crankshaft. These pulses are called Crankshaft Reference (CR) pulses since they tell the ECU when the crankshaft passes one of the six reference locations. By measuring the time between CR events, the ECU can calculate an 'instantaneous' RPM six times per revolution of the crankshaft. This means that the 'instantaneous' RPM is the RPM as calculated over the last 1/6 of a rotation of the crankshaft. The firmware filters this information a bit by calculating a rolling average of the three most recent CR periods. A rolling average just means that as each new CR period gets measured, the oldest of the three periods is thrown out, and the new one is added in. The net result is that most of the RPM calculations that the ECU uses are based on the time it took the crank to do its last half a rotation (three CR periods).
At this point, you might have noticed that ECU makes all its RPM-related decisions based on 'old' information. Since the computer cannot actually predict the future, it makes a simplifying assumption that whatever the rotational period was for the last 1/2 of a rotation will be the same as the rotational period for the next 1/2 of a rotation. This is actually a pretty accurate assumption, even if you consider situations where you might whack the throttle open in neutral. Even under full throttle and no load, the engine rotation speed doesn't increase much from one 1/2 of a rotation to the next 1/2 of a rotation.
By assuming that the upcoming 1/2 of a rotation will be the same as the one the ECU just measured, the ECU effectively can predict the future. By measuring the elapsed time during a CR period, it can calculate an appropriate timing delay from the start of the subsequent CR period. This means that the computer can program things to occur like spark events anywhere it wants in an upcoming CR period.
Obviously, the simplifying assumption is not completely accurate. It is important to notice that the errors that arise from the assumption do not accumulate. Since the 1/2 rotation period is made up from the most recent three 1/6 rotation periods, the ECU adjusts its opinion on the rotation speed six times per revolution. Unlike your mutual fund manager, the ECU's predictions will always be quite accurate.
Ignoring the situation while the engine is turning very slowly during starting, all ignition events occur during CR4 (front cyl) and CR9 (rear cyl). Since each CR period is 60 degrees, the start of CR4 would occur 60 degrees BTDC and the end of CR4 (start of CR5) would occur at TDC. By calculating an appropriate time delay from the start of CR4, the processor can generate any spark advance it wants on the front cyclinder between 0 and 60 degrees BTDC.
Once the ECU has computed where it wants the coil to fire, it needs to know when to start charging the coil. In principle, this is a simple calculation. If you know the time when the spark should occur, you subtract off the amount of time that you want to coil to charge, and arrange to start charging it at that point. Now normally, you don't get to do things backwards in time. As pointed out earlier, the ECU simplifies its life by assuming that things don't change much between crank rotations. This means that the ECU calculates where it wants the dwell to start for the next rotation based on where it would have wanted it on the current rotation.
Fuel Injector Timing
The fuel injector timing can be thought of in the same terms as the ignition coil timing. Making the same assumption that the engine speed changes slowly (in computer terms, at least), the computer calculates where it would like the fuel squirt start and stop events to occur for the next crank rotation.
Calculating the duration of the squirt is where most of the mystery resides in a fuel injection system, and will be covered in its own section.