Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 22:13 18 May 2024 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 : Losing saved array data

Author Message
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 529
Posted: 09:02pm 16 May 2017
Copy link to clipboard 
Print this post

I am losing the last few parts of the array
The 1st run fills dummy data then saves
the 2nd run shows data is missing
it does this on a 170 backpack, Micks backpack
and a breadboard setup.


Print MM.Ver,MM.Device$
Print " very basic pump house var test"

Option base 1

'VAR restore ' gives error if used

Dim pump$(2,7,2) length 5

Input "1st run y/n ";k$
If k$="n" Then GoTo here
blank

show

fill

show

here:
Print " restored "
VAR restore

show

Print " run a 2nd time"


Sub blank
Print "fill blank enteries"
For p=1 To 2
For d=1 To 7
pump$(p,d,1)="--:--"
pump$(p,d,2)="---"
Next d
Next p
End Sub

Sub fill
Print "fill with data"
For p=1 To 2
For d=1 To 7
pt=Int(Rnd*1440)
ph=Int(pt\60)
pm=pt-(ph*60)
pump$(p,d,1)=Str$(ph,2)+":"+Str$(pm,2)
pump$(p,d,2)=Str$(Int(Rnd*720),3)
Next d
Next p
VAR save pump$()
End Sub

Sub show
Print
For d=1 To 7
Print pump$(1,d,1);" ";pump$(1,d,2);" | ";
Print pump$(2,d,1);" ";pump$(2,d,2)
Next d
Print
End Sub



 
GoodToGo!

Senior Member

Joined: 23/04/2017
Location: Australia
Posts: 188
Posted: 10:58pm 16 May 2017
Copy link to clipboard 
Print this post

Interesting.....

I could get it to reliably work but I had to extend the array LENGTH to 31.

Anything less and it would drop some of the variables.

I don't understand that one.

Bug perhaps?

GTG!
...... Don't worry mate, it'll be GoodToGo!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3167
Posted: 01:12am 17 May 2017
Copy link to clipboard 
Print this post

Thanks for the demo. It is a bug and I have found it, the fix will be in the next version due in a few weeks.

BTW. The following will give an error because the array must be declared before VAR RESTORE.
VAR restore ' gives error if used
Dim pump$(2,7,2) length 5

The following will work OK:
Dim pump$(2,7,2) length 5
VAR restore ' will not give an error


Geoff
Geoff Graham - http://geoffg.net
 
GoodToGo!

Senior Member

Joined: 23/04/2017
Location: Australia
Posts: 188
Posted: 02:31am 17 May 2017
Copy link to clipboard 
Print this post

Nice work once again Geoff

GTG!
...... Don't worry mate, it'll be GoodToGo!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3167
Posted: 12:08pm 17 May 2017
Copy link to clipboard 
Print this post

BTW the workaround is to make the array slightly larger but not use the extra elements. Ie:

Dim pump$(2,10,2) length 5

Geoff
Geoff Graham - http://geoffg.net
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 529
Posted: 02:12am 18 May 2017
Copy link to clipboard 
Print this post

Thank You So Very Much.Now I can keep working on this. I have 5 of the new backpacks coming. I can use one to reprogram the 15 chips I have here.

I had miss pasted the var restore. LOL

Funny I had the array larger but cut the code down to simplify
the output to the LCD.

These are replacing very old water treatment controllers.
Thanks You! With MMBasic I have done 8 so far. And in much less time.
I started over a year ago with PIC's trying c and forth but the pin
settings was always a bugger to get right. I have plans for 6 different
versions even going to try ladder logic PLC with one of the bigger chips.
I never would have tried that before MMBasic and the backpacks.

Thanks Again

 
Print this page


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

© JAQ Software 2024