In an electronic control unit for a vehicle, control data is stored in a volatile
memory until a predetermined time passes after an ignition switch is turned off.
This makes it possible to greatly reduce the frequency at which data is written
into a nonvolatile memory. When the predetermined time has passed after the ignition
switch is turned off, the control data stored in the volatile memory is written
into the nonvolatile memory. Thereafter, the power supply from a power supply circuit
to the volatile memory is stopped. Consequently, it is possible to store the control
data reliably in either the volatile memory or the nonvolatile memory. It is also
possible to reduce the dark current in the volatile memory.