PURPOSE: To protect once programmed data by restraining a program operation.
CONSTITUTION: The memory is provided with such restraining means as an optical sensor 11, a package 3 having a transparent section b5 so as to expose the exposed part of the optical sensor 11 to an outside light, a memory section 10 capable of electric erasure so as to restrain the operation of an electric program when the transparent section b5 is covered and an outside light is not detected by the optical sensor 11 and an AND gate 12. When the transparent section b5 is not covered and an outside light is detected by the optical sensor 11, a logic '1' is outputted, when it is covered and an outside light is not detected, a logic '0' is outputted and when the transparent section b5 is covered, the program instruction (the logic '1') of a program mode 40 is made invalid by an AND gate 2 and the program operation is restrained.