An ECU calculates an engine speed for calculating a camshaft phase based
on a time period T.theta. in which a crankshaft rotates a sampling angle
.theta.. The camshaft phase is derived from a time difference between
output timing of a cam angle signal and output timing of a crank angle
signal based on the engine speed. According as the engine speed is lower,
the sampling angle .theta. becomes small, so that the engine speed and
the camshaft phase are precisely calculated.