in order to wait for a rising edge next time then the time tdown of the occurrence of the falling edge is stored in a memory region mtdown of the ram 30c and the count ndown of the falling edge is incremented by one ndown u2190 ndown 1 at step 104 and the routine ends if it is determined at step 102 that the flag fup is set at 1 the routine is waiting for a rising edge this time and the flag fup is reset at 0 at step 105 in order to wait for a falling edge next time then the time tup of the occurrence of the rising edge is stored in a memory region mtup of the ram 30c and the count nup of the rising edge is incremented by one nup u2190 nup 1 at step 106 and the routine ends namely while the flag feg1 is set at 1 only step 104 is executed in which only a falling edge is treated this corresponds to the period between t5 to t7 of fig5 this is hereinafter referred to as 34 fixed edge calculation 34 or 34 fixed edge processing 34 as mentioned above the falling edge from an eccentric rotor yields less deviation from a normal falling edge in this embodiment when on the other hand the flag feg1 is reset at 0 both the rising edge and the falling edge are treated alternately at steps 104 and 106 this corresponds to the periods between t0 to t4 and t8 and after this is hereinafter referred to as 34 unfixed edge calculation 34 or 34 unfixed edge processing 34 flowchart of fig4 shows a routine for a speed calculation which is started when the ignition switch 10.