Retentive memory: what survives a power cycle
Which values come back after a restart is a design decision, and treating it as an accident causes machines to start on their own.
By the LADX engineering team
Short answer
Retentive memory keeps its value through a power cycle; non-retentive memory is cleared on restart. Which is which varies by platform and is often configurable per tag. The decision matters most for anything that drives an output, because a retentive bit holding a motor command can energise it the moment power returns.
What survives a restart is a design decision. Left as a default, it produces the least safe behaviour at the worst moment.
The distinction
Retentive values are written to non-volatile storage and restored on power-up. Non-retentive values start at zero.
Which is which depends on the platform and is usually configurable, sometimes per tag and sometimes per memory area.
What should be retentive
- Production counts and totals.
- Recipe and setpoint values somebody entered.
- Fault history that must survive for investigation.
- Machine position, where losing it means a re-home.
What should not
Anything that commands motion. A retentive bit holding a run command energises the output as soon as the processor reaches RUN.
This is the single most dangerous default in the trade, and the reason a seal-in is preferred over a latch for anything that moves.
Decide it explicitly
Write down, per value, what should happen on restart. Most programs have never had this conversation, and the answer is whatever the platform happened to do.
Sources and further reading
- CODESYS: data persistence with RETAIN and PERSISTENTcontent.helpme-codesys.com
- Rockwell Logix 5000 General Instructions referenceliterature.rockwellautomation.com
Common questions
- Which PLC memory is retentive by default?
- It varies. Siemens marks retentive areas explicitly in the hardware configuration. Rockwell ControlLogix tags are retentive unless the program clears them at startup. Because it varies, never assume: check the platform and, more importantly, decide what each value should do rather than accepting the default.
- Can a PLC restart a motor by itself after a power cut?
- Yes, if the command bit is retentive and nothing clears it at startup. This is why seal-in circuits are preferred over latches for motors: a seal-in depends on the rung conducting, so power loss drops it and it stays off until somebody presses start.
Keep reading
- Fundamentals
Seal-in or latch: two ways to hold a motor on
Both keep an output energised after the button is released. They fail differently, and that difference is the whole reason to choose.
- Fundamentals
How a virtual PLC works: inside one scan
The mechanism of a software PLC, from the input image to the watchdog: the scan clock, catch-up in a throttled browser tab, tasks, RETAIN, warm and cold restart, and fault codes, with the real numbers from the LADV runtime.
- Fundamentals
PLC tasks and the watchdog: cyclic, event and continuous, and what a fault does
How PLC tasks start (cyclic, event, continuous), how one CPU shares its time between them, and what a watchdog fault is, with a two-task program and the LADV behaviour as a worked example.