What I need are the methods to cater for all PICs and all memory sizes.
We have a number of constants like CHIPSHAREDRAM ( and CHIPSHAREDRAM_H) and CHIPRAM ( and CHIPRAM_H), we can test for the various chip families with IF CHIPFAMILY =.
The solution must not require any variables and must leave all the RAM set to ZERO.
Your approach please.
Here is the solution I implemented for the LGT ( aka AVR) chips, as a reference. I uses CHIPSUBFAMILY as CHIPFAMILY 12 was not definitive to the LGT.
Provided that GCBasic startup code initialises RAM then all you should need is a
"GOTO 0x0000" i.e. a soft reset.
You could also use the watchdog timer to force a reset but that would be a lot more complex than a single ASM Instruction.
In both cases, however, RAM and SFR's may be preserved, hence depending on the GCBASIC initialisation to perform the erese when variables are declared.
Cheers
Chris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If any code is run the only way to guarantee a known state is a power on reset and that, whilst doable, would require an external hardware mod to be under software control.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was under the impression that GCBasic already claerd all ram as part of the initialisation process.
I never questioned it as most of the code I wrote in ASM or C did its own initialization.
I suggest you give goto 0x0000 a try and see what happens, I have used it before but not specifically to clear RAM so you would have to verify that though testing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Your solution to clearing all RAM to zero is needed.
The challenge is that I ( we )need an approach that supports all PICs.
Here is a solution for a PIC16F1829.
What I need are the methods to cater for all PICs and all memory sizes.
We have a number of constants like CHIPSHAREDRAM ( and CHIPSHAREDRAM_H) and CHIPRAM ( and CHIPRAM_H), we can test for the various chip families with
IF CHIPFAMILY =
.The solution must not require any variables and must leave all the RAM set to ZERO.
Your approach please.
Here is the solution I implemented for the LGT ( aka AVR) chips, as a reference. I uses CHIPSUBFAMILY as CHIPFAMILY 12 was not definitive to the LGT.
Provided that GCBasic startup code initialises RAM then all you should need is a
"GOTO 0x0000" i.e. a soft reset.
You could also use the watchdog timer to force a reset but that would be a lot more complex than a single ASM Instruction.
In both cases, however, RAM and SFR's may be preserved, hence depending on the GCBASIC initialisation to perform the erese when variables are declared.
Cheers
Chris
The requirement is to set the RAM to zero, a known state.
The RAM must be cleared to a known state.
If any code is run the only way to guarantee a known state is a power on reset and that, whilst doable, would require an external hardware mod to be under software control.
As with the AVR and LGT the compiler sets all RAM to 0x00.
There is a clear rationale for this and this is an ask for help to do this.
We, Clint, Jim and I, are maxed out on building the next release, hence, the ask for help.
OK,
I was under the impression that GCBasic already claerd all ram as part of the initialisation process.
I never questioned it as most of the code I wrote in ASM or C did its own initialization.
I suggest you give goto 0x0000 a try and see what happens, I have used it before but not specifically to clear RAM so you would have to verify that though testing.