To detect a stroke reliably at the time of the start of the engine when a stroke
cannot be detected based on crank pulses alone.
A stroke is detected based on a difference N between the engine rotational
speeds at top and bottom dead centers and a flag FN is changed depending
upon whether a temporary stroke set before a stroke has been detected and the detected
stroke coincide with each other or not. Simultaneously, a stroke is detected based
on a difference P between the intake air pressures at two bottom dead centers
and a flag Fp is changed depending upon whether a temporary stroke set
before a stroke has been detected and the detected stroke coincide with each other
or not. Then, when the flags FN and Fp coincide with each
other, the stroke detection is completed. When the detected stroke differs from
the temporary stroke, the stroke is shifted by a phase of 360 and the crank
pulses are renumbered.