After reading through the forums and documentation, I have an unclear understanding of variables so I would appreciate having some questions answered in order to gain clarity:
- The VAR1 to VAR128 variables seem different than local variables
- are the VAR1 to VAR128 considered global variables in the regular programming sense?
- how many local variables can exist?
- are local variables limited in scope to their single program in one of the positions from 1 to 16?
- are local variables scoped to their subroutine called by a gosub?
What is the difference in variables that are flagged as Auto/Manual?
How persistent are the VAR1 to VAR128 variables in term of survival across resets?
- are they stored in flash memory based on some flag like Auto/Manual or are they always persisted?
- if always persisted, what prevents wearing out the flash or equivalent memory?
Is there some way to cut and paste whole variable lines so they can be moved around as a program is developed?
Do tables have any relation to variables or are tables considered static in nature? If related, what is the relation?
VARS 1 through 128 are the global variables which are visible in all the programs, trend logs, displays and so on. The local variables are just visible within a particular program. They will show up in grey in your program, the only way to see what value they’re holding would be to put a line in your program to assign them to one of the global VARS. I don’t know off hand how many local vars can exist but there’s enough memory for ‘a lot of them’.
For variables which are in manual mode, your are in charge of them through the user interface. The variables which are in auto, the T3 controller and its programs are in charge of those. You can temporarily toggle a variable from auto mode into manual mode in order to debug your programs, manually setting the setpoint high or low at the extremes to test your logic. When you are done debugging you should remember to put them back into auto mode so the programs can act on them.
Vars maintain their value after a reset, the values are held in non volatile flash and will pick up where they left off at before the reset. There is a delay of a few seconds and some caching going on internally to the T3 controller to reduce the wear on the flash.
Vars cannot be cut & pasted though that could be an idea for a future update.
Tables are separate from vars, there is no relationship.
Thanks for the response.
As far as the automatic vs manual mode of the variables is concerned, I am still not clear what the mode setting does other than prevent overwrite of manual settings when in automatic mode. Are manual variables write protected from the applications themselves?
What is the relation between the Automatic/Manual setting and the read/write status of variables via Modbus? Is it the same as for the T3000 interface?
So if variables are stored in flash, then I guess they should not be updated with status type values that change regularly. One piece of information that we expose in others parts of our systems is the uptime in minutes. We also expose the current sensor values and status for different pieces of equipment. These would seem to be things to avoid in variables in order to have a good lifespan to the flash.
Automatic: Your program is in charge of the variable.
Manual: You are in charge of the variable, no program can adjust the var.
Flash: You can do what you want with the variables, it will not affect the life of the flash. Flash gets changed mainly when you save a program or load a program. In between that there are very few writes except for the trend logs.