CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Error in Program Memory 0800h

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Nwurma
Guest







Error in Program Memory 0800h
PostPosted: Tue Jun 14, 2005 2:34 am     Reply with quote

Hello,
I'm from Switzerland and my English isn't very well, so sorry about that Shocked

I think i have a problem with a function which is too big for the program memory of the 16F877.
When i program the pic using IC-Prog 1.05D, it gives me always a error (when i test the code on the pic) at the program memory address 0800h, this is the first address of the 2nd Page of the program memory.

I've read in the forum that its helpful to use the #SEPARATE command, but for me it doesn't work better with this command..

So,have someone a hint for me?

Greetings

Nwurma

p.s.

maybe the absolute listing is helpful:

CCS PCM C Compiler, Version 3.045, 7671

Filename: C:\C\IPA\IPA.LST

ROM used: 5108 (62%)
Largest free fragment is 2048
RAM used: 78 (45%) at main() level
109 (62%) worst case
Stack: 12 worst case (6 in main + 6 for interrupts)
valemike
Guest







PostPosted: Tue Jun 14, 2005 5:42 am     Reply with quote

Did you also add on the top of your .c file:

#device *=16 Question

These 16F devices seem to need the above statement as well as

#separate
my_fxn(void); // function prototype

....

#separate
my_fxn(void)
{
// function implementation
}
nwurma
Guest







PostPosted: Tue Jun 14, 2005 7:32 am     Reply with quote

thanks for the fast answer,
but it doesnt help..i have always a bug in the 1stor sometime in the 2nd memory Page (0800h odr 1000h), have you any idea what this could be?

greetings
Guest








Re: Error in Programm Memory 0800h
PostPosted: Tue Jun 14, 2005 7:45 am     Reply with quote

Nwurma wrote:

Stack: 12 worst case (6 in main + 6 for interrupts)


Hey wait, i'm looking at the 16F87xA datasheet, and it says that the stack is only 8-deep.

Maybe i'm interpreting it wrong. What problem are you having? Does the program just seem to get 'lost' ?
Nwurma
Guest







PostPosted: Tue Jun 14, 2005 8:04 am     Reply with quote

hmmm somewhere i've read that its no problem to need 12 stacks if they are distributed in normal and interrupt stack. Maybe this information was wrong Embarassed

For the 2nd part, not the program get lost, normaly its 1 Byte who is wrong (when i read it out with ic prog) but at times its that after this point ( 0800h or 1000h ) there is also no more text in the Memory Page..
valemike
Guest







PostPosted: Tue Jun 14, 2005 8:46 am     Reply with quote

Go grab an 18F442 (or 452 or 4525 or 4520).

Then all you have to worry about now is just your program's functionality. Wink

Also, you should upgrade your compiler version to the most current one, and see what happens.
Ttelmah
Guest







PostPosted: Tue Jun 14, 2005 9:49 am     Reply with quote

Seperate 'interrupt' stacks exist on some processors, but not on the PIC. Going beyond 8 deep, will stop the program working.
Seperately, your problem sounds like either a faulty chip, or a problem with the programmer. I have seen similar faults with some devices in the past.

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jun 14, 2005 11:42 am     Reply with quote

Quote:
I've read in the forum that its helpful to use the #SEPARATE
command, but for me it doesnt work better with this command.

The people that tell you to use #separate are only telling you part of
the story. Normally, the compiler automatically checks the number
of stack levels that it uses, and it takes care so that it doesn't exceed
the permissable number of hardware stack levels available in your PIC.
In the case of the 16F877 there are only 8 stack levels available.

Here is the part they didn't tell you:
If you use #separate, the compiler will not check if the program
uses more than the allowable stack levels. You have to check it
yourself, every time you compile the program. You have to look
at the top of the .LST file and make sure the program only uses a
maximum of 8 levels (for the 16F877). If it uses more than 8 levels,
then you have to modify your program so it doesn't do that.
Look at your .LST file, below. You program uses 12 stack levels, and
that's more than the maximum allowable level of 8. This means your
program will crash at some point. It won't work.
Quote:
ROM used: 5108 (62%)
Largest free fragment is 2048
RAM used: 78 (45%) at main() level
109 (62%) worst case
Stack: 12 worst case (6 in main + 6 for interrupts)


To fix your program, I would get rid of all the #separate statements.
I suspect that you have some very large functions. You may be using
floating point, which uses a lot of ROM. You need to break up your
large functions into several smaller functions. Then the compiler can
more easily place the functions into the 2 KB ROM segments in the
16F877.
nwurma
Guest







PostPosted: Tue Jun 21, 2005 1:40 am     Reply with quote

Thank you for the good answers..i've minimized my funktions..some were big ( those for the menu ) and so, know I have 8 stack levels and it works fine on the 16F877, but i've already ordered the 18F452 and for the rest of the project i will work with this microcontroller, although thanks for the good tipps and interesting answers!

Best wishes

nwurma
nwurma
Guest







PostPosted: Tue Jun 21, 2005 3:48 am     Reply with quote

ehm a new question..for the pic18f452 i need a new compiler? or is it an entry which i have to do..for changing from the 16f877 to the 18f452?

greetings
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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