Create a persistent variable named PersistentVars.
Adapt PersistentVars as follows:
|
Adapt the POU PLC_PRG as follows:
|
|
Then adapt the function as follows:
|
|
Start the project and set the variable xReset to TRUE in order to index it.
The variable PersistantVars.udiCnt is incremented from the application with each restart. |