Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:26 03 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 4 of 7    
Author Message
PeterB
Guru

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

I developed the code using your chip but without using VAR SAVE or VAR RESTORE because I see no point in wearing the chip out.
I then took a new chip, installed V5.0 whatever using my pickit3.
I then added VAR SAVE in 3 places to my code and installed the code using XMODEM.
It worked.
I then added VAR RESTORE and got the error. After a bit of mucking about, VAR SAVE also started to throw up errors. That gradual degradation made me think the memory must be full.
So then after many hours, I found VAR CLEAR fixed the problem.
The fault is fixed permanently by VAR CLEAR
My most recent effort was to reinstall V5.0 whatever but as noted above, the results were inconclusive.
I'm sorry pin 4 has fallen off your chip. It is still a very nice chip and I think it still works. I just can't change the V5.0 whatever.

Peter
 
PeterB
Guru

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

I think I have it.
I wanted to use a 16x2 LCD display via I2C and found just the thing after a bit of a search. So I copied the bits I needed and it worked right up until I added the VAR RESTORE.
So after a process of elimination, I discovered that MMBASIC does not need OPTION AUTORUN ON. Taking it out makes a big difference.
I probably passed on some wrong information. Sorry about that but I did get confused.
I also heat soaked one of my chips by plugging it in back to front. It still works.

Peter

Edit
Perhaps not quite fixed.
I think that VAR RESTORE can modify V5.etc at least in my particular case.
If I change code e.g. VAR RESTORE I have to re-install V5.
I think it is time for a long walk on a short jetty or a glass of red.

PeterEdited by PeterB 2019-01-12
 
palcal

Guru

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

What about a long walk on a short jetty WITH a BOTTLE of red and I will come with you because I am lost too. Edited by palcal 2019-01-12
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2944
Posted: 09:58am 11 Jan 2019
Copy link to clipboard 
Print this post

@Geoff / @PeterM

  PeterB said   . . . it worked right up until I added the VAR RESTORE.
So after a process of elimination, I discovered that MMBASIC does not need OPTION AUTORUN ON. Taking it out makes a big difference.


It sounds like there may possibly be a 'start up' issue when using VAR RESTORE with OPTION AUTORUN ON set.

I also had strange behaviour with the above settings; and thought at the time that it may have been caused by the OLED Driver which was stored in the LIBRARY. I never got to the bottom of it so ended up using external memory to store my few bytes (storing them in a couple of RTC registers).

@PeterM, I remember seeing something about this from you (to Geoff?) but at the time thought it was an extremely unlikely scenario to warrant too much effort (on the assumption it was caused by my use of the Library).

Is anyone else seeing issues related to this and at the time thought nothing of it? If so, we collectively need to look for a pattern of usage that can then be replicated to make it easy for Geoff and/or Peter to address.





Edited by WhiteWizzard 2019-01-12
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 10:25am 11 Jan 2019
Copy link to clipboard 
Print this post

I use the variable flash quite a bit on various modules (one is full to the brim) - all with auto-run enabled. No problems whatsoever... None have a display and memory is not tight.

Here's the start-up pre-amble


Option Autorun On
Option Base 0
Option Baudrate 9600

CPU 40

Const Ver="1.5"
Const TrigLightTimeOut=45'light on time when triggered
Const TrigLogTimeout=30 'time between trigger logs
Const Sensor=2,MainSW=14,DaylightTracker=4
Const SensorActive=1,MainSWActive=0
Const LogTop=272 ' FIFO log size

RTC GetTime

CL VER+" System coming up"

Dim OpLog$(LogTop) LENGTH 6
Dim a$
Dim Integer z
Var Restore

Edited by CaptainBoing 2019-01-12
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2944
Posted: 10:29am 11 Jan 2019
Copy link to clipboard 
Print this post

Hi Andrew,

Thanks for that information. Could you possibly do a test at some stage when you get a spare moment.

If possible; set OPTION LCDPANEL to something (even if you have no physical display attached), then see if everything still works as expected.

Is your VAR RESTORE near the very start of your code?

Cheers for any help . . .

WW
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 10:33am 11 Jan 2019
Copy link to clipboard 
Print this post

@WW crossed in the post - the pre-amble is above

The array OpLog$ is the variable stashed in the flash

can post the entire code if you want to try it

Just for completeness, I just furkled around in some paid for code (can't post it all) where I set a small amount of info as config data the first time a device is used, and retrieve it each time it powers up. Again, no memory constraints or display of any kind. All works fine... I am a bit worried


still in the pre-amble:



OPTION AUTORUN ON

PRINT "Node boot"
timer=0

OPTION BASE 0


<snip>


VAR RESTORE

FlagSet 3 ' just booted

IF MyAddr=0 THEN
DO
DO
INPUT "Enter Node address (1-998) >", a$
MyAddr=int(val("0"+a$))
LOOP UNTIL MyAddr >0 AND MyAddr<999

DO
INPUT "Enter Node Task Name >", a$
MyJob=a$
LOOP UNTIL MyJob<>""

PRINT "Is this correct? (Y/N)";
DO:INPUT a$:a$=UCASE$(a$):LOOP UNTIL a$="Y" OR a$="N"
LOOP WHILE a$="N"

VAR SAVE MyAddr,MyJob

FlagSet 6 ' Just completed setup - need INIT
END IF


so with the above, the module wakes up and checks to see if it has data about itself, if not it prompts through the console, stores it and never asks again. I have dozens of these nodes in various installations and no worries. Still might be a combination with a display defined or something but I am not able to test that right now.

It would make the remainder of my hair fall out if it started playing up with the numbers involved.


Edited by CaptainBoing 2019-01-13
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 05:45pm 11 Jan 2019
Copy link to clipboard 
Print this post

update on the above post.


[code]
> ? mm.ver,mm.device$
5.0408 Micromite MkII
>
[/code]


fresh load of the code, prior to configuration
[code]
> OPTION LCDPANEL ILI9341, L, 2, 23, 3
> RUN
Node boot
Enter Node address (1-998) >22
Enter Node Task Name >TBL
Is this correct? (Y/N)? y
Node 22 up in 34251mS Name TBL
[/code]
all good - this includes the "empty" VAR RESTORE and then a VAR SAVE


Stop and restart - this executes the VAR RESTORE with something to come back
[code]
>
> RUN
Node boot
Node 22 up in 13mS Name TBL
^C
> ? MyJob$ <-- did the VAR RESTORE do it's job?
TBL <-- yep
>
> option list
OPTION AUTORUN ON
OPTION BAUDRATE 9600
OPTION LCDPANEL ILI9341, LANDSCAPE, 2, 23, 3
>

[/code]

no problems even with LCD panel configured. VAR SAVE & VAR RESTORE working well (phew!).

So the image that you are burning, my feeling is it is corrupt somehow.


Edited by CaptainBoing 2019-01-13
 
Turbo46

Guru

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

PeterB,

I have a few programs that use:

OPTION AUTORUN ON
VAR SAVE
VAR RESTORE

and some use I2C, Geoff's Superclock is one of them!

There must be hundreds of different programs using that combination of commands. Maybe you've hit on a sequence of instructions (or timing) that brings on the fault? Is it possible to post your code or a subset of it that will demonstrate the fault? I'm happy to test it if that helps.

Maybe you are filling the flash if you are saving strings, remember it is only 2K.

Bill
Keep safe. Live long and prosper.
 
PeterB
Guru

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

Take 2 or is it more?
I have used MMplus V5.04.08 and used VAR RESTORE and OPTION AUTORUN ON with no problems.
My latest project is my first with the 32MX170F and MM V5.05.01 and right up to VAR RESTORE, no problems.
I have now reduced it to:

install fresh copy of V5.05.01 (PICKIT 3)
install the following (XMODEM)

VAR RESTORE
DO
PRINT "QQQ"
LOOP

run with no problem

edit

add OPTION AUTORUN ON

run

[1] VAR RESTORE
Error: Variable name

edit

add VAR CLEAR

run with no problem

edit

remove VAR CLEAR

run with no problem

That indicates to me that OPTION AUTORUN ON with VAR RESTORE does something to V5.05.01.

The Cab. Sav. was very nice but it didn't help me sleep.

Peter

 
Turbo46

Guru

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

I have beta V5.05.02 in at the moment. Running the code

VAR RESTORE
DO
PRINT "QQQ"
LOOP


Runs OK. Then tried:

option autorun on
VAR RESTORE
DO
PRINT "QQQ"
LOOP


Ran OK. Is that right?

Bill

Edit: Noticed your error was in line 1 so I tried:

VAR RESTORE
DO
PRINT "QQQ"
LOOP
OPTION AUTORUN ON


Ran OK.Edited by Turbo46 2019-01-13
Keep safe. Live long and prosper.
 
PeterB
Guru

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

One very big difference
You have V5.05.02

I'm cooking a roast at the moment but will give it a try.
If it works, what do you want for Christmas?

Peter
 
Turbo46

Guru

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

My two front teeth.

I don't think it will. I try V5.05.01 Shortly

Bill

Edit: I tried V5.05.01 freshly programmed.

VAR RESTORE
DO
PRINT "QQQ"
LOOP


then

VAR RESTORE
DO
PRINT "QQQ"
LOOP
OPTION AUTORUN ON


All OK. There must be more to it than that? Did you do something before that may have corrupted/filled the flash?

BillEdited by Turbo46 2019-01-13
Keep safe. Live long and prosper.
 
PeterB
Guru

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

I am still waiting for my new chips. Perhaps if the wind changes direction.
We are going to have the roast and some more Cab. Sav.
Thanks for trying.

Peter
 
Turbo46

Guru

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

@ Someone who might know:

I use pic32prog and although I have a Pickit 3 clone I have never bothered to use it.

When using the Pickit, is it possible to accidentally use a setting that will write some strange data into the flash area used for the VAR SAVE data?

I just can't believe that there is something strange about PeterB's 5 chips.

Bill
Keep safe. Live long and prosper.
 
PeterB
Guru

Joined: 05/02/2015
Location: Australia
Posts: 655
Posted: 10:57pm 12 Jan 2019
Copy link to clipboard 
Print this post

By the process of elimination it must be my chips or my PICKIT 3 system or my luck.
To that end, I have deleted MPLAB x etc. However, when I follow the manual to reinstall I get stuck on an "oops, cant find it" sort of thing.
What am I doing wrong this time?

Peter

Edit

I have found it and installed V3.5 and still get the error!!!!!!!!!!!!!!!!

PeterEdited by PeterB 2019-01-14
 
Turbo46

Guru

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

Hi Peter,

Is it possible to solder a wire onto pin 4 of Grogster's chip and try that? I presume that it was supplied already programmed? If you get the same problem then it surely must be something that you are doing wrong and not the chip.

From Geoff's site:
  Quote  To tell the PICkit 3 to provide the power you need to select Settings --> Advanced Mode. You are then required to put in a password ("Microchip") to enter Advanced Mode. Finally select the Power tab and tick "Power Target Circuit from Tool". The PICkit 3 will then supply power out of pin 2 (Vdd) rather than just measuring the voltage on that pin (which is what it normally does).


I think I read somewhere that you should use 'Advance Mode' anyway?

I've only used PIC32Prog and the Microbridge.

Bill
Keep safe. Live long and prosper.
 
PeterB
Guru

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

Pin 4 was stuck at HI or LO I can't remember so it means I can't change the operating system.
It is set up with V something and it still worked the last time I tried it.
The new chips MICROCHIP & ARROW arrived today and the 1 chip I tried failed.
I am now building a pic32prog thing. Another steep learning curve.
The new PICKIT 3 should arrive in the next day or so and if that doen't shed some light I'm going to replace my desk, there is nothing else. I have tried 3 programmers.

Peter
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 10:55am 14 Jan 2019
Copy link to clipboard 
Print this post

hi,
there are three different pairs of pins that can be used for ICSP programming of the MX170:
pins 4 (PGD) and 5 (PGC),
pins 14 (PGD) and 15 (PGC),
pins 21 (PGD) and 22 (PGC).

you can use any pair, but must use two pins in the same pair.

also, you are aware an arduino nano can be used as a programmer?


cheers,
rob :-)
 
PeterB
Guru

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

G'Day Rob.

I didn't know that, thanks.
I'm making your NANO thing and need to engrave a small board. The temperature is heading for 43 today so I want to get out in the shed ASAP.

Peter
 
     Page 4 of 7    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025