Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:30 02 Aug 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 : VAR CLEAR

     Page 3 of 7    
Author Message
PeterB
Guru

Joined: 05/02/2015
Location: Australia
Posts: 655
Posted: 07:07am 08 Jan 2019
Copy link to clipboard 
Print this post

Very funny

The problem is that once VAR CLEAR has been used the thing is OK so you only get one chance to see the fault. I still have 2 unused chips if anybody would like to have a go.
On the subject of making it shorter. I rather like 1 line programs. Any more and I get confused
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 07:10am 08 Jan 2019
Copy link to clipboard 
Print this post

I might as well add my contribution since I got curious.
  Quote   VAR RESTORE
PRINT MM.VER
PRINT "num1 = ",num1
PRINT "num2 = ",num2

INPUT "Input two numbers?";num1,num2

PRINT num1
PRINT num2
VAR SAVE num1,num2
PRINT "Saved! Now restart the program."


Fist run with micromite 28pin running V 5.04.09
and then running V 5.05.02

> RUN
5.0409
num1 = 0
num2 = 0
Input two numbers?? 155,487
155
487
Saved! Now restart the program.
> RUN
5.0409
num1 = 155
num2 = 487
Input two numbers??



> RUN
5.0502
num1 = 0
num2 = 0
Input two numbers?? 123,456
123
456
Saved! Now restart the program.
> RUN
5.0502
num1 = 123
num2 = 456
Input two numbers??


I also confirmed that it survived a power outage.
and I haven't gone anywhere near VAR CLEAR

JimEdited by TassyJim 2019-01-09
VK7JH
MMedit
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 07:14am 08 Jan 2019
Copy link to clipboard 
Print this post

I'm using VAR RESTORE and VAR SAVE in a project at the moment, and I am not EVER seeing any of these errors.

I am using the current firmware version.

Not saying you aren't, I am just saying that I also am using a code that uses VAR SAVE and VAR RESTORE, and it always works. Any time I change anything in the menus(via an IR remote control), the VAR SAVE command is run to update the saved variables, and VAR RESTORE always works to restore them when I next power-up.

I know you are a fan of the cheap switch-mode PSU modules, but perhaps you could just bypass the SMPSU you are using on your board, for a good old linear regulator(you will have to hack the PCB a little), and see if this problem goes away.

The only reason I mention this, is that I have had nothing but problems with switching PSU modules when combined with the Micromite, which is why I still prefer good old linear regulators or LDO CMOS regulator chips with the standard decoupling caps. You probably can use a SMPSU module as a pre-regulator, but use a linear or LDO CMOS regulator with all the associated caps as a final regulator for the system voltage. Some of what you are seeing, could be a result of SMPSU modules often horrible ripple, as they are notorious for having a 'Dirty' output.

When it comes to saving to the flash, that dirty supply could(read: might) be stuffing you around. If you temporarily bypass the SMPSU module with a good old linear, and the problem goes away, then you know where the problem is. If it doesn't, then OK, but at least we know where we are at.
Smoke makes things work. When the smoke gets out, it stops!
 
PeterB
Guru

Joined: 05/02/2015
Location: Australia
Posts: 655
Posted: 07:32am 08 Jan 2019
Copy link to clipboard 
Print this post

G'Day Grogster

One of my boards does use linear regulators 7805 & 1117V33?? so I don't think that is a problem. I also have used VAR SAVE & VAR RESTORE but on your E64 boards. This is the first time I have used the 28 pin device and not MMplus.

Jim.

Can you be sure that VAR CLEAR or anything else that clears the problem has never been used?
I have the (dare I say it?) dog eared chip from Grogster and that has never been a problem but its history is not well known.

Peter
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1642
Posted: 07:58am 08 Jan 2019
Copy link to clipboard 
Print this post

Peter,

You mentioned that these are new chips from Arrow. Is it possible that they are the wrong chip? I don't know if it's possible to program the wrong chip with MMBasic but maybe it's worth a check?

You do have the 47uF or equivalent tantalum in circuit?

Bill
Keep safe. Live long and prosper.
 
PeterB
Guru

Joined: 05/02/2015
Location: Australia
Posts: 655
Posted: 08:32am 08 Jan 2019
Copy link to clipboard 
Print this post

Bill

The type number is correct and I have a 47uF installed.
I bought the 5 chips from ARROW.
I am going to order some more from them and probably from another.
The fact that other people have seen this problem gives me confidence that I am not going mad. Well perhaps a bit.
The things that stand out in my memory from when I was a professional Engineer are those times when everything was going wrong, your career was shot etc etc and then it all came good usually with the help of good mates.

That's what it's all about.

Peter
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1642
Posted: 09:11am 08 Jan 2019
Copy link to clipboard 
Print this post

Yes I agree,

I find that these problems are usually due to something simple, bad connection, bad power supply, supply bypass capacitors missing/faulty (add some more).

Have you re-checked the circuit against Geoff's basic circuit in the micromite manual? Stripped the circuit down to the bare minimum? Tried running a program without VAR RESTORE etc? Tried running it off two AA cells?

I've bought chips from RS I think they did next day delivery. Maybe your chips from ARROW are RS?

Bill
Keep safe. Live long and prosper.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 09:17am 08 Jan 2019
Copy link to clipboard 
Print this post

  PeterB said   I have reduced my program to :
VAR RESTORE
And I still get the error.

It will have to be something to do with the variables that you have saved. VAR RESTORE recreates the saved variables just like a program does and there must be something strange in the variable names that is causing the syntax error while they are being created.

Can you list the variables already saved?

  PeterB said  VAR CLEAR
VAR RESTORE

This will always work because you have deleted the offending variables from the save area in flash. No surprises here.

Geoff
Geoff Graham - http://geoffg.net
 
PeterB
Guru

Joined: 05/02/2015
Location: Australia
Posts: 655
Posted: 11:22am 08 Jan 2019
Copy link to clipboard 
Print this post

G'Day Geoff and others

This error only occurs the first time the chip is used. Once VAR CLEAR has been used there are no more problems. Does the error "Variable name" (from memory) mean that these ARROW chips arrive full of rubbish which results in that message?
I have ordered more chips from ARROW amd MICROCHIP.
And I'm sitting here naked ready to go to bed.

Peter
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 03:10pm 08 Jan 2019
Copy link to clipboard 
Print this post

  PeterB said   G'Day Geoff and others

This error only occurs the first time the chip is used. Once VAR CLEAR has been used there are no more problems. Does the error "Variable name" (from memory) mean that these ARROW chips arrive full of rubbish which results in that message?
Peter


it is possible. the results of any storage should not be relied upon until it has been "formatted". Try clearing a chip and then reading the image back into MPLAB (or whatever) then burn that image into a new chip and try the same. If variables are stored in the same area of flash as the code, this should provide you with a "gold" image to burn onto chips where you are unable to perform the purge before use.

I use VAR RESTORE etc to store config data on a module I have many of and I never had a problem like this - and it never occurred to me that it might be a problem... guess I was lucky.

  PeterB said  
And I'm sitting here naked


MY EYES! MY EYES! Edited by CaptainBoing 2019-01-10
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 03:25pm 08 Jan 2019
Copy link to clipboard 
Print this post

Brand new chips do not contain "rubbish" data. The entire flash memory is blank with each byte set to FF (hex). Further more, when you program MMBasic into the chip the first thing the programmer will do is erase the flash to FF (hex)... just to be sure.


Geoff Graham - http://geoffg.net
 
PeterB
Guru

Joined: 05/02/2015
Location: Australia
Posts: 655
Posted: 11:32pm 08 Jan 2019
Copy link to clipboard 
Print this post

O.K.
That means my hardware or ?
The errors are too predictable to be noise spikes and they go when VAR CLEAR has been used.
So! What if my copy of MM has been corrupted and that is installing rubbish into the flash?
So! I reinstalled the firmware and the problem seems to have gone but I have now used all my chips so until the new lot arrives I'm stuck.
Geoff, Is this a possible / probable?

It can't be my hardware......it can't.

Peter
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1993
Posted: 12:38am 09 Jan 2019
Copy link to clipboard 
Print this post

  Quote  So! I reinstalled the firmware and the problem seems to have gone but I have now used all my chips so until the new lot arrives I'm stuck.

Does that mean the 5 chips you got from Arrow have all been used in projects and are working OK ?Edited by palcal 2019-01-10
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1642
Posted: 12:48am 09 Jan 2019
Copy link to clipboard 
Print this post

I was about to ask that.

Peter, Earlier Geoff said:

  Quote  I have seen an issue where with a chip programmed with a complete image (interpreter + BASIC program) can generate an error on the first VAR RESTORE. Because it is such a special case and VAR CLEAR permanently fixes the issue it has been languishing at the bottom of my todo list.

This might be the same as the subject of this thread but it is difficult to say without a clear description of the fault and the environment.


Is that what you are doing?

Bill
Keep safe. Live long and prosper.
 
PeterB
Guru

Joined: 05/02/2015
Location: Australia
Posts: 655
Posted: 01:36am 09 Jan 2019
Copy link to clipboard 
Print this post

All 5 ARROW chips are now OK although not soldered into boards. I use a ZIF socket to program them.

Geoff's comment is exactly what I experienced.

After posting my comment above I used the old, suspect, version of firmware and had no problems. So until my new chips arrive, I'm stuck.

Peter
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1642
Posted: 01:52am 09 Jan 2019
Copy link to clipboard 
Print this post

Sorry Peter,

I still don't understand.

Are you loading the complete image (BASIC interpreter + program)? Or just the BASIC interpreter V5.0 whatever?

If you have no problems, why are you stuck?

Why can't you use the chips you have?

From what I understand from Geoff's comment, if you ARE loading the complete image and do a VAR CLEAR that should fix it and you can carry as if nothing happened.

Bill
Keep safe. Live long and prosper.
 
PeterB
Guru

Joined: 05/02/2015
Location: Australia
Posts: 655
Posted: 02:19am 09 Jan 2019
Copy link to clipboard 
Print this post

I started with a new chip. Loaded V5.0 whatever then loaded my program and when I hit RUN I got the error.
I then spent a lot of time discovering that VAR CLEAR fixes the problem.
So, yes, the problem can be fixed. I now have 5 good chips but the question is WHY?
And if it is a chip fault, is there reason to worry?
When the new chips arrive I will know more or be more confused.

Peter
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1642
Posted: 02:48am 09 Jan 2019
Copy link to clipboard 
Print this post

I see, thanks.

Have you tried that again with one of the now 'good' chips?:
Load V5.0 whatever, load the program and RUN?
Load V5.0 whatever, load a different program and RUN?
Maybe just reload the program and RUN if you still have V5.0 whatever loaded? I guess you probably have but I'm not sure.

Bill

PS 'whatever' was one of my daughter's favourite words a long time ago when she was a teenager.

Edit: Or even reload the latest firmware from Geoff's site in case it somehow got corrupted?Edited by Turbo46 2019-01-10
Keep safe. Live long and prosper.
 
PeterB
Guru

Joined: 05/02/2015
Location: Australia
Posts: 655
Posted: 03:14am 09 Jan 2019
Copy link to clipboard 
Print this post

I reinstalled V5.0 whatever and my 1 line program and there was no problem.
However, that was my last virginal chip and I think I may have fumbled a bit so the test was inconclusive and now I have to wait.
But I do have 5 good chips plus Grogster's dog eared chip which sadly lost pin 4 a couple of days ago. It fell off, I said I'm a bit ham fisted.

Peter
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 03:38am 09 Jan 2019
Copy link to clipboard 
Print this post

Just trying to get this clear in my head - are you:

1) Setting up the program the way you want, AND saving the variables with VAR SAVE in one or more places - you are happy with the program at this point.

2) Read the entire chip with a PicKit3 and the Microchip IPE, and export a HEX file of the image read from the chip.

3) Prepare a new blank chip, and use the ASCII on-board programmer to load the new image into the blank chip.(after pressing the SELECT button to enter programmer mode)

4) When the code runs, the first thing it does, is crash with the error message you are getting.

5) If you type VAR CLEAR at this point, then run, it works as expect.

Is that sequence correct?
Smoke makes things work. When the smoke gets out, it stops!
 
     Page 3 of 7    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025