![]() |
Forum Index : Microcontroller and PC projects : Micromite VAR SAVE & VAR RESTORE commands
Author | Message | ||||
Juri74![]() Senior Member ![]() Joined: 06/02/2012 Location: ItalyPosts: 162 |
Hello all again :P so my program is about ended and i decided to put a setting page where i can modify some settings of my hardware, to store these settings i used VAR SAVE command i save 6 variables, now come the troubles i placed VAR RESTORE at the beginning of the program but since i have OPTION EXPLICIT under mm.startup the program was able to "RUN" but after power cycle i got black screen, after some investigation i found that the program didn't started and the error "variable not declared" shoved up at the line of VAR RESTORE. then i placed VAR RESTORE afted declaring the variables: Dim var1,var2,var3,var4,var5,var6
VAR restore and now the funny thing.. after power cycle i got the error "variable already declared" could someone help me with this? what's the correct use of VAR SAVE/RESTORE? i noticed that saved variables are wiped out after some "EDIT" use. this is not a problem for me, but could this cause the errors above? thanks Juri |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10400 |
Juri It isn't really possible to help from your description, can you post code? Are you using the library? why are you using mm.startup? I would never put OPTION EXPLICIT anywhere but the main program. There is confusion between mm.startup and OPTION AUTORUN. mm.startup is really of use to set up hardware see the manual for details of the use of mm.startup around page 46 |
||||
Juri74![]() Senior Member ![]() Joined: 06/02/2012 Location: ItalyPosts: 162 |
hello matherp i put option explicit in mm.startup because it doesn't survive the power-cycle mm.startup is executed automatically even with option autorun disabled. i agree that when program is finished i could remove option explicit from mm.startup and even remove the mm.startup subroutine completely. i actually switched to internal rtc ram to store settings this is the start of program where var restore was: ' Termostato Termocaminetto creato da Juri Fossaroli
SetPin 9,din 'termosifoni SetPin 4,din 'caminetto SetPin 5,din 'puffer SetPin 26,dout 'allarme Pin(26)=0 SetPin 10,dout Pin(10)=0 SetPin 16,dout Pin(16)=0 SetPin 21,dout Pin(21)=0 SetTick 1000,leggitemp Dim valori(300) ' variabile gestione grafico Dim displ(900) ' variabile ultimi 300 minuti Dim tempcam,tempterm,tempturno,str,media 'variabili sub lettura temperature Dim pompac,pompat,pompap,alarm,vai,t2,auto *** Dim partenzacam,partenzaterm,offall,pufferon,puffer,altro,scala 'settaggi utente partenzacam = 35 partenzaterm = 40 pufferon=45 offall = 30 puffer = 0 altro = 0 scala = 3 VAR restore 'ripristina i valori salvati auto=0:If scala=0 Then auto=1 at the end of config subroutine there is the line: VAR save partenzacam,partenzaterm,pufferon,offall,puffer,altro,scala
if i remove the line with "***" variables i get the error "variable not declared" at "var restore" line if i leave the "Dim" line i get "variable already declared" at "var restore" line i added the three *** here to mark the line, there aren't any *** in the program ofcourse |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10400 |
Juri I think this may be the same issue as per this thread . We will have to wait to see what Geoff says on this one Have a look at the workround I found in my last post on that thread and see if you can make any sort of similar changes in mm.startup. The problem seems to be an interaction between constants defined in mm.startup, option explicit and option autorun on. All three are needed to generate the problem. Sorry I can't be of more help Also see this thread |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |