The bottom layer of PLC is a single-chip microcomputer, single-chip microcomputer generally saves data through RAM and ROM, RAM is power off and disappears, and ROM can still be maintained under power failure, unless it is an external force to make it change.
Because the data is relatively large, many early PLCs use batteries to maintain RAM, as long as the battery voltage is lower than a certain value, it may cause data loss, when replacing the battery, it needs to be carried out under the premise of power on, otherwise it will also cause data loss.
Now a lot of data is saved by EEPROM or FLASH, both of which will not cause data loss after power failure, if data is lost, it is often broken on the hardware.
There is also an EPROM, which needs ultraviolet light to refresh, covered with a piece of paper on the top, if you tear off this paper, you will see a hole below, at this time, if it is daytime, the sun has ultraviolet rays, it will lose the data, if it is in the dark, there will be no problem.
Although PLC is relatively safe and reliable, but generally to back up the program and data, after all, any electronic product has its own life cycle, once the program or data is lost, through the backup of the program and data, re-flash it, otherwise need to reprogram, that is quite a troublesome thing.