Retain values for AC800F Controller
How I can declare variable or some variables in CBF as retain values to be stable and not effected with power failure
I need to calculate the operation hours of machine and when power is off orhe supply voltage to controller switched off the system should be add to last perion not to begin again
Voted best answer
No need to declare anything. All variables in the Controller are retained as long as there is a battery in the Ethernet module, because the complete RAM is buffered via battery.
For PM 802F the battery life time is about 1.5 years, for PM 803F it is 10 days only, but can be doubled by using either 2 Ethernet modules with battery or a battery backup module.
One thing you need to consider. When power comes back, the controller by default does a warmstart. If the time without power was to long for the process to continue you would usually do a coldstart by executing the "Force Cold Start" system function (FCS). In that case, or when you download whole station, or download the program that contains your lifetime variable the value will be replaced by the initial value (usually 0.0) .