View previous topic :: View next topic |
Author |
Message |
jaikumar
Joined: 15 Dec 2006 Posts: 109
|
How to fill with goto statement ? |
Posted: Tue Dec 06, 2011 10:52 pm |
|
|
Hi all,
I want to fill with GOTO 0x0000 statement after the end of program till the end of program memory.
How can I do this?
thanks and regards,
Jai. |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Dec 07, 2011 6:31 am |
|
|
Back in the stone age we used to fill unused ROM with No-Ops so if the PC got there it would just run through them till it hit the reset vector at the top of memory.
I have not heard of anyone doing that in the last 25 years. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Wed Dec 07, 2011 7:15 am |
|
|
SherpaDoug wrote: | ...we used to fill unused ROM with No-Ops so if the PC got there it would just run through them
|
It still does, but now by design. Unused flash reads, just like most ROM, as all 1s. PICs interpret all 1s, 0xFFFF on an 18F, as a NOP. Of course on PICs the reset vector is at the bottom of memory, so it'll get there after the PC (Program Counter, not Personal Computer) wraps round.
In short PICs will end up resetting (a warm start of course) if they try to execute unprogrammed code memory. You don't have to force them to do it by doing something special.
RF Developer |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19546
|
|
Posted: Wed Dec 07, 2011 9:17 am |
|
|
The problem is that a goto, in PIC coding, is not a single word instruction.
CCS provides the instruction #FILL_ROM to put any single instruction into unused memory space if required. By default they put a sleep instruction as the word after the end of memory, and as RF_Developer says, unprogrammed cells will contain a NOP, so if the watchdog is enabled, the sleep will give a reset if you run out of the end of memory, and the NOP's will force a loop back to the bottom of memory if you end up anywhere else.
Best Wishes |
|
|
jaikumar
Joined: 15 Dec 2006 Posts: 109
|
|
Posted: Thu Dec 08, 2011 5:04 am |
|
|
Thanks all for the info.
regards,
jai. |
|
|
|