Any idea about this ??
microchip78
Posts: 25
Hi Experts,
I really need your help in this one ...
I have created a module and it has a persistence string array. In mainline I have created two instance of same module. But It doesnt create two separate instance of a persistence string array. When one instance modify that array it also affect array in another instance.
I hope you guys understand from this what I mean to say.
What I want to do is when I create two instance of a module I must have two sets of variable which doesnt clash with each other. And that value has to be persistence ...
Anyone did this before?
Thanks in advance.
I really need your help in this one ...
I have created a module and it has a persistence string array. In mainline I have created two instance of same module. But It doesnt create two separate instance of a persistence string array. When one instance modify that array it also affect array in another instance.
I hope you guys understand from this what I mean to say.
What I want to do is when I create two instance of a module I must have two sets of variable which doesnt clash with each other. And that value has to be persistence ...
Anyone did this before?
Thanks in advance.
0
Comments
If you started with
Persistent Char sVar[1][2]
make it
Persistent Char sVar[3][1][2]
When you call the module pass along the reference for which array you want to update. Fill in the size of each dimension to what you need.
I beg to differ. I just changed a value of persistent Variable in one of my modules and rebooted my chassis and that value was still in there.
At least that is how I understand it.
I took off the persistence in the module and now when I load the code the value goes to 0.
I've not had the need to keep variable values after a recompile.
Can we pass custom type in to Module ...
I have designed this structure and want to pass it in to Module but It is giving me an error saying that invalid syntax and pointing it to module definition.
How can I do this ?? Structure is defined in mainline source file ...
http://amxforums.com/showpost.php?p=23920&postcount=21
You can per se. There's a way to do it. However, here's the prescribed one. the other is just fine.
Here's what it would probably look like.
main program
and then over in the top of the module file...
In the module, you use the 'From_Main_abc' variables as they will hold the values from the main program.
Hope that helps.
That is the defined difference. Non-volatile persist after a reboot, persistent persists after a reload. The time you want a full persistent variable is when it is storing user settings (like thermostat setbacks) that you don't want lost every time the master gets an update.