Glossary · RETAIN

What is Retained variable (RETAIN)?

A variable held in retentive memory, so it keeps its value through a power cut and restart.

Used for totals, running hours and batch numbers. Not used for machine state: after a power cut the process must start from a known safe state, not from the middle of a fill step.

Retained memory is limited on many controllers, so retained variables are chosen deliberately rather than by default.

Related terms

Data type
The classification that fixes a variable size, value range and permitted operations: BOOL, INT, DINT, REAL, TIME and the rest.
PROGRAM
The top program organization unit: bound to a task, executed cyclically, and keeping its variables between scans.

All terms