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 support@ccsinfo.com

Re: Rom segment change

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







Rom segment change
PostPosted: Wed Sep 12, 2001 11:23 am     Reply with quote

Hello again.

I'm trying to program a PIC 16F873, and the problem is the next:
When the program is bigger than one segment (until 0x07FF), and main() function pass to then next segment, the program hangs up. I thought the compiler could manage this segment changes, but it appears not actually Are there any solution?

Thank you

Justo Crespo
___________________________
This message was ported from CCS's old forum
Original Post ID: 255
Dale B.
Guest







Re: Rom segment change
PostPosted: Wed Sep 12, 2001 6:57 pm     Reply with quote

Hmm. What error text or code do you get? If your main() function is larger than one page, you will have problems. The compiler will relocate functions from page to page, but the function must be able to fit completely in one page. You may need to separate main() into several smaller functions and call them from a smaller main(). For example, instead of:

main() {
thing1;
thing2;
thing3;
thing4;
}

you may need to do this:

void thing1() {
thing1;
}

void thing2() {
thing2;
}

main() {
thing1();
thing2();
}

Hope this helps.

Dale

:=I'm trying to program a PIC 16F873, and the problem is the next:
:=When the program is bigger than one segment (until 0x07FF), and main() function pass to then next segment, the program hangs up. I thought the compiler could manage this segment changes, but it appears not actually Are there any solution?
___________________________
This message was ported from CCS's old forum
Original Post ID: 257
Justo Crespo
Guest







Re: Rom segment change
PostPosted: Thu Sep 13, 2001 2:44 am     Reply with quote

Really, compiler doesn't give any error. Simply, device doesnīt work properly: self-resets and hangs up. When the program is too small for to locate main() in the first segment, it runs well, but when main() begin at 0x800, problems appear. Main() itself is 0x1DE long (from 0x800 to 0x9DE). My real problem is that I need to use several floatig point multiplications. These are in a separate function, but use most of the first ROM bank, and force to main() to the next page.
By the way, in the .lst file says max stack use is 7, so I think there isnīt any problem of stack overflow.

Thank you




:=Hmm. What error text or code do you get? If your main() function is larger than one page, you will have problems. The compiler will relocate functions from page to page, but the function must be able to fit completely in one page. You may need to separate main() into several smaller functions and call them from a smaller main(). For example, instead of:
:=
:=main() {
:= thing1;
:= thing2;
:= thing3;
:= thing4;
:=}
:=
:=you may need to do this:
:=
:=void thing1() {
:= thing1;
:=}
:=
:=void thing2() {
:= thing2;
:=}
:=
:=main() {
:= thing1();
:= thing2();
:=}
:=
:=Hope this helps.
:=
:=Dale
:=
:=:=I'm trying to program a PIC 16F873, and the problem is the next:
:=:=When the program is bigger than one segment (until 0x07FF), and main() function pass to then next segment, the program hangs up. I thought the compiler could manage this segment changes, but it appears not actually Are there any solution?
___________________________
This message was ported from CCS's old forum
Original Post ID: 262
Justo Crespo
Guest







Re: Rom segment change
PostPosted: Thu Sep 13, 2001 2:48 am     Reply with quote

<font face="Courier New" size=-1>I think iīve captured the problem, but not the answer:
When the main() function is above 0x800, interrupts donīt return to the right point, but at any other point (I'm not sure exactly what point). I've checked the .lst file and aparently, the pclath is OK when RETFIE.

Have anybody any solution?

Thank you



:=Hmm. What error text or code do you get? If your main() function is larger than one page, you will have problems. The compiler will relocate functions from page to page, but the function must be able to fit completely in one page. You may need to separate main() into several smaller functions and call them from a smaller main(). For example, instead of:
:=
:=main() {
:= thing1;
:= thing2;
:= thing3;
:= thing4;
:=}
:=
:=you may need to do this:
:=
:=void thing1() {
:= thing1;
:=}
:=
:=void thing2() {
:= thing2;
:=}
:=
:=main() {
:= thing1();
:= thing2();
:=}
:=
:=Hope this helps.
:=
:=Dale
:=
:=:=I'm trying to program a PIC 16F873, and the problem is the next:
:=:=When the program is bigger than one segment (until 0x07FF), and main() function pass to then next segment, the program hangs up. I thought the compiler could manage this segment changes, but it appears not actually Are there any solution?</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 263
Dan Minarik
Guest







Re: Rom segment change
PostPosted: Thu Nov 08, 2001 10:41 am     Reply with quote

I'm having the same problem: If the program won't fit into page 0, interrupts don't return to the right place. Did you ever find a solution to this problem?

Thank you.


:=<font face="Courier New" size=-1>I think iīve captured the problem, but not the answer:
:=When the main() function is above 0x800, interrupts donīt return to the right point, but at any other point (I'm not sure exactly what point). I've checked the .lst file and aparently, the pclath is OK when RETFIE.
:=
:=Have anybody any solution?
:=
:=Thank you
:=
:=
:=
:=:=Hmm. What error text or code do you get? If your main() function is larger than one page, you will have problems. The compiler will relocate functions from page to page, but the function must be able to fit completely in one page. You may need to separate main() into several smaller functions and call them from a smaller main(). For example, instead of:
:=:=
:=:=main() {
:=:= thing1;
:=:= thing2;
:=:= thing3;
:=:= thing4;
:=:=}
:=:=
:=:=you may need to do this:
:=:=
:=:=void thing1() {
:=:= thing1;
:=:=}
:=:=
:=:=void thing2() {
:=:= thing2;
:=:=}
:=:=
:=:=main() {
:=:= thing1();
:=:= thing2();
:=:=}
:=:=
:=:=Hope this helps.
:=:=
:=:=Dale
:=:=
:=:=:=I'm trying to program a PIC 16F873, and the problem is the next:
:=:=:=When the program is bigger than one segment (until 0x07FF), and main() function pass to then next segment, the program hangs up. I thought the compiler could manage this segment changes, but it appears not actually Are there any solution?</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 1016
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