Question on passing Modules, Constants and Persistent Vars
AlexArtist
Posts: 51
Regarding Persistent Vars not working with modules. The compiler allows persistent vars to be passed to a module. Does this mean that the persistent vars passed will not be accesible by the module? or maybe persistent vars work with modules, but can't be declared inside the body of a module.
Does anyone know the answer to the above question?
Does anyone know the answer to the above question?
0
Comments
1) Declare a presistent variable in your main program and pass it as a parameter to your module.
2) Save and load the variable to the Disc On Chip. The code to do this should be inside the module. What I mostly do is, create a filename based on the virtual device number and the variable name. So when you use multiple instances of the same module the file name is different for each module.
Hope this helps.
No, that works and is solution 1) in Leon's anser.
Exactly.
To be a little bit more specific: Persistent variables can be declared in a module however they are not persistent. IMHO the compiler should flag this, but it doesnt.
Fred