|
|
View previous topic :: View next topic |
Author |
Message |
Justo Crespo Guest
|
Rom segment change |
Posted: Wed Sep 12, 2001 11:23 am |
|
|
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 |
Posted: Wed Sep 12, 2001 6:57 pm |
|
|
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 |
Posted: Thu Sep 13, 2001 2:44 am |
|
|
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 |
Posted: Thu Sep 13, 2001 2:48 am |
|
|
<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 |
Posted: Thu Nov 08, 2001 10:41 am |
|
|
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 |
|
|
|
|
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
|