News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Clear

Started by John Drew, Mar 29, 2022, 09:10 PM

Previous topic - Next topic

John Drew

G'day Les,
I notice in another thread you mention the new operation of "clear".
I'm not in a position to check the manual for the moment so forgive me if the answer is there.
Sometimes I need to Clear All RAM.
Does the command have a switch attached so I can clear all RAM including the variables like the old version?
John

Yasin

Dear @John Drew
If the "Clear" Command is used alone, the command that clears all ram is added to the first of the compiled code.
If there is a default variable in the code.
E.g; Expression like
Dim TestByte As byte = $C0Before the user codes start, these values are loaded to the relevant ram address.
Best regards.

John Drew

Thanks for the reply Yasin.
That is how it once worked but Les has changed it to clear only the RAM not used by variables.
But the manual describes it as you say.
Unless I've misunderstood, which is quite likely, I need both the old way and the new way.
Best wishes
John

top204

#3
I updated the compiler's manual for the last free compiler update, to explain the operation of the Clear command. See page 319:

"Clear has another purpose... If no variable is present after the command, all user RAM within
the device is cleared when the device first powers up, or a reset is implemented. Variables that
are created with assignments, and Static variables will still hold their values because the Clear
command becomes a directive, and signals to the compiler to add a block of code at the beginning of the user's program, to clear the RAM before the variables are created."

I also added the change made to the "Whats New.htm" file for update version 4.0.1.4, in January:

"Altered the way the Clear command works when clearing all RAM. It now clears the user RAM before the user's program starts, so the pre-assigned global and Static variables are not effected."

John Drew

Thanks Les, it's the predeclared and static variables that are not cleared. All other variables are cleared. So all is well.
The 81 yr old grey  cells aren't what they used to be :)
All the best
John

top204

#5
You are very welcome John

I just hope I keep my intelligence as you, definately, have when, or if, I am that age. I'm now 60 years old, but in my mind i'm still 20 years old and still full of curiosity and the need for learning, so let's hope it stays like that for all of us. :-) Where has the time gone John??? It is supposes to be a constant, but it certainly is not in our minds. It only seems a few years ago I was still in my 30s and full of adventure. :-(

Some of my grey cells died a few years back, but I was detertmined to get on with things, so I have done so.

Kindest regards
Les

keytapper

BTW, where to find the latest manual?
Ignorance comes with a cost

GDeSantis

Click on the link below to download the Postron8 or Positron16 manual.

https://sites.google.com/view/rosetta-tech/hom

top204

#8
They are not the latest manuals, they are earlier manuals.

The latest manuals come with the free updates:

Positron Corrections Update 4.0.1.5 - 1.1.0.8

Hopefully, I will be updating the web site this weekend, and the next manuals updates will have versions in them.

keytapper

Thanks for letting me know, I didn't notice that I downloaded it with the update.
Always a great masterpiece, Mr Les.
Ignorance comes with a cost