View previous topic :: View next topic |
Author |
Message |
Predator_MF
Joined: 26 Mar 2005 Posts: 10
|
Got the "Out of ROM.." while writing interrupt |
Posted: Thu May 26, 2005 3:31 am |
|
|
Hi.
My problem is when I write smt into INT_RB interrupt, I get "Out of ROM" message. When I try to write Scan_Keys() function, I get the error, when I try to write anything else (like printf("bla bla") for example) everything works fine. I defined Scan_Keys() with a #separate, but no results? Any ideas? |
|
|
Ttelmah Guest
|
|
Posted: Thu May 26, 2005 7:07 am |
|
|
Without knowing what is 'in' the Scan_Keys function, it is not possible to answer.
The normal reason is that the function is too large to fit in a page bank, and needs to be split up. If this is the case, you need to seriously be considering doing the solution a different way, since a function this large, implies a significant time involved, and as such the code should not be in an interrupt. Normally a simple matrix keyscanner, should only be a few lines of code, so post it, and somebody may be able to see what is making it so large.
Best Wishes |
|
|
valemike Guest
|
|
Posted: Thu May 26, 2005 7:20 am |
|
|
i don't have this problem while working with 18Fs, but encountered this a lot with 16F devices. Like Ttelmah said, you have to break up your functions into smaller functions.
And when doing so, i'd then have to use the #separate directive a lot, as well as declare 16-bit pointers.
e.g.
//prototype
#separate
void my_fxn(void);
...
#separate
void my_fxn(void)
{
...
}
Doing so will help alleviate your out-of-rom errors. It becomes a pain after a while. |
|
|
Guest
|
|
Posted: Sat May 28, 2005 10:35 am |
|
|
I've never had this problem with 18Fs too... My KeyScan() code is extremely small...
Code: |
void Scan_Keys()
{If (!(KEYL&KEYR&KEYOK&KEYC))
{keyholdcnt = 0;
keyhold = 0;
keyup = 0;
Enable_Interrupts(INT_Timer2);
while ((!(KEYL&KEYR&KEYOK&KEYC))&(~keyhold));
Disable_Interrupts(INT_Timer2);
If (keyhold) RLED = 1;
if (keyup) GLED = 1;
delay_ms(1000);
GLED = 0;
GLED = 0;
RLED = 0;
RLED = 0;
}
} |
There is no way this could not fit into a hardware page... it's smaller than 100 bytes |
|
|
Predator_MF
Joined: 26 Mar 2005 Posts: 10
|
|
Posted: Sat May 28, 2005 10:42 am |
|
|
I forgot to login, this post above is mine |
|
|
Darren Rook
Joined: 06 Sep 2003 Posts: 287 Location: Milwaukee, WI
|
|
Posted: Sat May 28, 2005 11:52 am |
|
|
Anonymous wrote: | There is no way this could not fit into a hardware page... it's smaller than 100 bytes |
Unless all of your pages are allready filled, no space for 100 more bytes.
Also, check your stack space. If you run out of stack the compiler will start inlining some functions.
Also, if this scan_keys() is inside of an interrupt it will not work. |
|
|
|