Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:30 21 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Help with Micromite VAR SAVE and VAR RESTORE functions

Author Message
Bob339
Newbie

Joined: 28/02/2021
Location: United States
Posts: 4
Posted: 06:18pm 03 Sep 2022
Copy link to clipboard 
Print this post

I have been trying to save some variables to the Micromite flash memory, but cannot get it to work.

I am using the following two  programs.

[code}
A$ = "Hello World"
VAR Save A$
{/code}

I save the above code, power off the Micromite, turrn it back on and run the following code:

[code]
VAR RESTORE
PRINT A$
[/code]

The second program outputs nothing. Can someone tell me why this doesn't work.
 
circuit
Senior Member

Joined: 10/01/2016
Location: United Kingdom
Posts: 293
Posted: 07:06pm 03 Sep 2022
Copy link to clipboard 
Print this post

Should work okay; it works for me.  Just to make sure that I had not missed something I just quickly typed it in, powered down, powered up and there it was.  

Please tell us which Micromite you are using and which MMBasic version?
 
circuit
Senior Member

Joined: 10/01/2016
Location: United Kingdom
Posts: 293
Posted: 07:09pm 03 Sep 2022
Copy link to clipboard 
Print this post

Just a further thought; when you said "I save the above code..." I presume that you did RUN the code after saving it before you powered down?

p.s. As this is your first post (I have just noticed) a warm welcome to the forum.  This is one of the most helpful and polite places to get help on your projects.  I have gained enormously from consulting the many knowledgeable contributors around the globe.
Edited 2022-09-04 05:32 by circuit
 
Bob339
Newbie

Joined: 28/02/2021
Location: United States
Posts: 4
Posted: 09:31pm 03 Sep 2022
Copy link to clipboard 
Print this post

Hello circuit

Sorry for the delay getting back. Had some problems logging back in.

I am using the Micromite MX170F2568 chip and MMBasic version 5.05.03.

Yes, I did RUN the code after saving it, but just to be sure I ran and saved it again, but still no response.

I also tried using a different MX170 chip, but still no resonse.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10628
Posted: 09:35pm 03 Sep 2022
Copy link to clipboard 
Print this post

Can't remember exactly but I think loading a new program erases the saved variables. The intention is that a single program can save data for the next time it is run without re-loading.

Try your commands at the command line to start with.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2832
Posted: 09:58pm 03 Sep 2022
Copy link to clipboard 
Print this post

Hi Bob,
At the console:-

> ? mm.ver
5.0505
> ? mm.device$
Micromite MkII
> a$="Hello World"
> ? a$
Hello World
> var save a$

Power off, wait 30s power on.

> Micromite MKII MMBasic Ver 5.05.05
Copyright 2011-2021 Geoff Graham

> var restore
> ?a$
Hello World
> a$ = "Deleted"
> ? a$
Deleted
> var restore
> ? a$
Hello World
>

NEW deletes everything belonging to the previous program including VARs.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3308
Posted: 10:07pm 03 Sep 2022
Copy link to clipboard 
Print this post

Saved variables are indeed cleared by the NEW command or when a new program is loaded via AUTOSAVE, XMODEM, etc.  This is because the VAR SAVE command is intended for saving data that will be used later by the same program.

Try running this program twice:
VAR RESTORE
PRINT A$
A$ = "Hello World"
VAR Save A$

The first time that you run it, nothing will be printed on the console.  The second time that you run it you should see "Hello World".

Geoff
Edited 2022-09-04 08:09 by Geoffg
Geoff Graham - http://geoffg.net
 
Bob339
Newbie

Joined: 28/02/2021
Location: United States
Posts: 4
Posted: 01:26am 04 Sep 2022
Copy link to clipboard 
Print this post

Hello Geoff,

I tried your suggestion of running the program twice, but get no resonse

I tried matherp's suggestion and got   error cant find A

I tried phil99's suggestion and got   error flash write

I am using MMEdit.  Should that make any difference.
 
Bob339
Newbie

Joined: 28/02/2021
Location: United States
Posts: 4
Posted: 01:47am 04 Sep 2022
Copy link to clipboard 
Print this post

Sorry Guys

I had not used the Micromite for a while and forgot some things.

I tried Geoff's suggestion again and hit the run button. It Worked.

The problem was that I was not hitting the run button.

Thanks much, I might have given up without your help.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9757
Posted: 05:02am 04 Sep 2022
Copy link to clipboard 
Print this post

Glad you got it sorted, and welcome to the forums.
Please do continue to post any questions.
This forum is very welcoming to newbies, and once you get into MMBASIC, I think you will like it quite a lot.

Pardon my presumptuousness.
Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025