|
|
View previous topic :: View next topic |
Author |
Message |
kenho
Joined: 28 Jun 2013 Posts: 5
|
#ROM |
Posted: Fri Jun 28, 2013 9:54 am |
|
|
Hi Everyone, first time here!
I get a warning after the second #ROM 'Memory not available at the requested location'. Should I just ignore it? Any suggestions?
Code: | #include <24EP512GU810.h>
#include <stdlib.h>
#include <math.h>
#fuses NOWDT,PUT64,NOBROWNOUT,ICSP1,NOJTAG,NODEBUG,NOAWRT,NOAPROTECT
#fuses NOWRT,NOPROTECT,FRC_PLL,PR_PLL,NOIESO,NOPR,NOCKSNOFSM
#use delay(clock=58960000)
void main()
{
int8 ii = 0;
setup_oscillator(OSC_INTERNAL);
if(ii == 0) #ROM char 0x55000 = {'R','C','O'}
else #ROM char 0x55000 = {'r','C','O'}
} |
|
|
|
stinky
Joined: 05 Mar 2012 Posts: 99 Location: Central Illinois
|
|
Posted: Fri Jun 28, 2013 10:26 am |
|
|
I don't have experience with this part, but I'd probably check the data sheet to see if that address is in fact open to use. |
|
|
kenho
Joined: 28 Jun 2013 Posts: 5
|
|
Posted: Fri Jun 28, 2013 10:41 am |
|
|
Thanks Stinky!
It does appear as writable program memory in the data sheet. I do not get the warning if I use the #ROM at that address just once, only when repeated in the code.
It is a warning and not an error so perhaps the warning algorithm only looks for repeats but does not take context into account. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Fri Jun 28, 2013 10:41 am |
|
|
The problem is what you are doing.....
#ROM, is _not_ a program instruction. It can't be executed at run time.
It is a preprocessor directive, executed when the code is compiled.
You can't change #ROM at runtime.
You can have two versions changed when you compile:
Code: |
#define II
#ifdef II
#ROM char 0x55000 = {'R','C','O'}
#else
#ROM char 0x55000 = {'r','C','O'}
#endif
|
If you rem out the define, the second ROM directive will get compiled, but if you leave it defined, then the first will get compiled.
Best Wishes |
|
|
kenho
Joined: 28 Jun 2013 Posts: 5
|
|
Posted: Fri Jun 28, 2013 2:12 pm |
|
|
Thanks Ttelmah!
Understood. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|