Here's an easy way in CRBasic to initialize Public or Dim variables to something other than zero. By default, variables are set equal to zero when the datalogger program compiles.

If the datalogger power cycles, these variables will return to the initialized values, unless the PreserveVariables instruction is used. To take advantage of variable initialization you'll need a recent operating system.

Remember that variables are not constants and therefore can be changed in a number of ways. Most often variables are changed under program control. For example, when taking measurements or doing calculations, the datalogger writes to a variable.

There are times, though, when you'd like to change a value on the fly (manually) such as resetting a counter or changing a multiplier or offset. As long as that value is declared as a variable, you can change it manually in several ways. The most common ways are via your software's Connect screen, and by using the keyboard display. RTMC also contains graphical components that allow you to toggle Boolean variables and set others.

Always a constant—never a variable,

We're active on social media!
Stay informed with our latest updates by following us on these platforms: