Question:
Is it possible to store code values of user-defined parameters (code area C3000 and above) non-volatile without giving the command C0002 = 11 ('save start parameters')?
Answer:
Yes, but only if the code number has been created as a user-defined parameter. The function block connection has to be extended as follows:
1. Create a RETAIN variable of the same type as the user-defined code which should be stored non-volatile (in the example below this is the variable
dnRetainStartValue). Insert this variable twice in the function block editor - once with an input and once with an output.
2. Insert the user-defined code number twice in the function block editor - once with an input and once with an output (in the example below this is the code number C3000).
3. Insert a function block
L_TbTransition and call it at the beginning of the task cycle (sorting index 1). As the trigger edge select the positive edge. The switching time must be set to 1[ms]. The input of the positive edge trigger has to be put to a static TRUE level (
bTRUE_b =>
L_TbTransition.bIn). The
L_TbTransition will then output a TRUE pulse only during the first task cycle.
4. Insert a function block
L_TbSelect and interconnect it with the other items as shown below.
L_TbSelect will restore the code value during the first task cycle after mains-on.
Note:
When applying this procedure to several code numbers a memory module MM330 might be required because of its bigger RETAIN memory.
