To precisely detect the cylinder pressure even if the output characteristic of a cylinder pressure sensor is changed according to the temperature.
When the engine is stopped and the temperature of the cooling water of the engine is within a prescribed temperature range, the output of the cylinder pressure sensor of a cylinder in which at least one of an intake valve or an exhaust valve is opened is sampled as the sensor output equivalent to the atmospheric pressure. On the other hand, the output of the cylinder pressure sensor is sampled just before the opening timing of the intake valve in the exhaust process or during the valve overlap. The deviation between the sensor output equivalent to the atmospheric pressure and the sensor output sampled in the exhaust process is operated as the change of the output characteristic depending on the temperature of the cylinder pressure sensor, and the cylinder pressure is detected based on the sensor output corrected with the operated deviation of the output.