Patent ID: 8006051

Claim:
A data processing device comprising: a volatile memory for storing a maintenance counter value; an EEPROM comprising a nonvolatile maintenance counter area and a temporary nonvolatile maintenance counter storage area; and a CPU for updating the maintenance counter value in the volatile memory based on detection of a state change in the data processing device; wherein: the CPU writes the maintenance counter value from volatile memory to the temporary nonvolatile maintenance counter storage area at a first predetermined timing, and writes the maintenance counter value stored in the temporary nonvolatile maintenance counter storage area to the nonvolatile maintenance counter area at a second predetermined timing; the volatile memory has a first volatile maintenance counter area for storing the maintenance counter value, and a second volatile maintenance counter area for storing the maintenance counter value; the maintenance counter value stored to the second volatile maintenance counter area when data processing device power turns on is identical to the maintenance counter value stored in the first volatile maintenance counter area; the maintenance counter value in the first volatile maintenance counter area is updated based on detection of a state change in the data processing device; the CPU compares the content of the first volatile maintenance counter area and the content of the second volatile maintenance counter area at a third predetermined timing, and writes the updated maintenance counter value to the temporary maintenance counter storage area; and after the CPU compares the content of the first volatile maintenance counter area and the content of the second volatile maintenance counter area at the third predetermined timing, and writes the updated maintenance counter value to the temporary maintenance counter storage area, the CPU then copies the maintenance counter value from the first volatile maintenance counter area to the second volatile maintenance counter area.