Clever use of the internal power-loss retention register of the PLC system
2026-04-06 09:05:46··#1
When designing small PLC control systems, we often need to externally modify internal PLC data, such as Counter, Timer, or Data values, to adapt to the needs of the production process. Furthermore, it's required that this data be retained internally after the system is shut down, so that it can be retrieved and used again upon the next power-on. Many small PLCs now offer power-off retention registers to preserve user-defined data during power outages. However, in most cases, PLC manufacturers, in order to save costs, cannot provide a sufficient number of power-off retention registers for system designers. Therefore, when the number of data items to be adjusted exceeds the number of internal power-off retention registers, we have to reduce the number of data items to be adjusted (fixed or unused) or purchase a PLC with more power-off retention registers. This results in a lack of flexibility and adaptability in the production machinery, thereby lowering product quality or increasing costs. The PLC used is a Panasonic FP0-C16T. The number of adjustable data items is 16. The PLC has 10 internal power-down retention registers: 8 data registers (DT1652-DT1659: 8 each with 16 bits) and 2 internal relays (WR61, WR62: 2 each with 16 bits). If we use the conventional method of one adjustable data item occupying one data register, it's clear that this cannot adjust all 16 data items; only 10 can be adjusted. Therefore, I specifically analyzed the adjustment range of the 16 adjustable data items and found that most data only need to be adjusted from 0 to 255, i.e., 0 to 28-1; while the internal data size of the power-down retention registers such as DT1652 is 216-1, i.e., 256 × 256-1. Therefore, we can use only the lower 8 bits of the data register for one adjusted data item, and then the higher 8 bits of the same data register can be used to store another adjusted data item. The following is a list of the procedures for this part: 1. Upon power-on, separate the high 8 bits and low 8 bits of the power-down holding register into two other data registers: R9013 is a pulse relay specified internally by the Panasonic FP0 series PLC, which operates for only one PLC scan cycle when the PLC transitions from program state to run state. Instruction F65 is a word AND instruction, which performs a word AND operation between the data in the power-down holding data register DT1655 and the hexadecimal number FF, and then sends the result to the general data register DT0. This separates the low 8 bits of the data in the power-down holding data register DT1655; similarly, the word AND instruction in the second line separates the high 8 bits of the data in the power-down holding data register DT1655. Instruction F120 is a right shift instruction without carry, that is, when shifting the data word to the right, the high bits are padded with zeros. K8 indicates a right shift of 8 bits. Instruction F0 is a word transfer instruction, which transfers the data in the general data register DT10 to the general data register DT1. The purpose of the above program segment is to split the data in the power-down retention register DT1655 into two adjustable data sets upon power-on. 2. After power-on, the data from the other two data registers are merged into the high 8 bits and low 8 bits of the power-down retention register: R9014 is a pulse relay specified internally by the Panasonic FP0 series PLC, activated at the start of the second PLC scan cycle when the PLC transitions from program state to run state. Instruction F121 is a left shift instruction without carry; K8 represents a left shift of 8 bits. Instruction F66 is a word OR instruction, performing a word OR operation between the data in general data register DT20 and the data in general data register DT0, and sending the result to the power-down retention register DT1655. As can be seen, during PLC operation, the data in general data registers DT0 and DT1 can be arbitrarily changed, and these changes are simultaneously sent to the power-down retention register DT1655. Thus, when the PLC loses power, the adjusted data is preserved. Using the same method, we can flexibly use each bit of the power-down holding register depending on the size of the data being adjusted, thereby improving the performance of a small PLC control system without increasing costs.