VAR, PERS,and CONST

Dear all,

I’ve been informed that PERS data can be stored unless the controller is shut down, but, in my case, the data using PERS is gone after I turn off the controller. Can anyone know what is the conclusions to make data is kept store unless the controller is shutdown, even if I load a new program?

Thank you

BR,

Try to create your variable, pers, const in different module.

and ensure that before starting new program. r u saving the current program properly.

If any errors, please try to save each module separately.

Dear Lin,

OK, I will try it. So, when I restore my system, I only load the module that contain my datas. Is it right?

BR,

Hi Carmila.

Have you init your PERS with a Value?

PERS Num Name:=0;

BR Klaus

Dear Klaus,

I only write:
PERS num name;

only that. Is any differences with and without a value ( PERS num name : 0)?

Thank you
BR,

Dear Klaus,

I only write:
PERS num name;
only that. Is there any differences with / without a value? ( PERS num name :=0)

Thank you

BR,

Hi Carmila,

Persistent variables must have an initial value. When u change ur variable value, initialisation value of that persistent updated. So when u load module again controller creates persistent with last initialisation value and that keeps it unchanged.

Hi Camaile.

That’s why it don’t work. PERS without init value will do the same as a VAR and not remember the value. Even PP to main will delete the value

BR Klaus

Dear Klaus and Charon,

Thank you for your information.A?:wink:

I will change it.A?

BR,