Exploring persistent variables
Compared to many of the other concepts, such as enums and structs, that have been explored, persistent values are most similar to constants. However, there is a difference between constant and persistent variables. A persistent variable will hold its value in case of a cold system reset, a warm reset, or a repeated download. In other words, the value in the variable won’t be lost during a hard shutdown, but the value can still be changed during runtime. According to the documentation, applications for persistent variables range from counters to hour meters. Essentially, use persistent variables for values that must be preserved in case of things such as power failures.
Declaring a persistent variable is quite easy. You can manually insert the following code in any file in which you want to create a persistent variable:
VAR PERSISTENT END_VAR
You can also declare a persistent variable using the tool and check the PERSISTENT box. Once the...