View previous topic :: View next topic |
Author |
Message |
henry Guest
|
function pointers across page boundaries |
Posted: Wed Jan 14, 2004 6:05 am |
|
|
I have an array of function pointers with 19 items. I call them from main based on a flag. the lower six (members 0 thru 5) do not work. The processor goes off to who knows where. In the list file it shows that these six funcs reside in page 0 and the rest are in page 1. main is in page 1. Obviously the page select bits aren't correct. Interesting side note, when compiled for use with icd it works just fine. Any way what is the solution here? the preprocessor #type *=16 is included. Can i use #org statements
to force the functions into a specific page or is it better to manually set up the page select bits before each call.
Thanks |
|
|
henry Guest
|
|
Posted: Thu Jan 15, 2004 6:10 am |
|
|
Since I got no responses i think maybe I didn't make myself clear.
If I understand the PIC data sheet. When a call is made the Program counter provides the lower 11 bits(2K) of the destination address. The upper 2 bits come from PCLATH(4:3). these 2 bits determine wich page to call to. My problem is that these two bits aren't being properly set.
So, My question is: Am i doing something wrong to prevent the compiler(PCM 3.169) from handling this automatically or is this a shortcoming of the compiler when using pointers to functions?
Please help if you can
tahnks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Guest
|
|
Posted: Thu Jan 15, 2004 10:16 am |
|
|
according to ccs after ver 3.160 function pointers are fully supported.
thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 15, 2004 10:43 am |
|
|
Well, Darren works for CCS, so he should know.
I believe him regardless of what the Versions page says.
He made that post on Sept. 6, 2003. By looking in my
download directory, I can see that on that date, CCS
was at about vs. 3.176. So Darren thought they were
still beta at that version. And, they're still not documented.
Look in the current Readme.txt file, or the current manual.
They're not listed. |
|
|
|