|
|
View previous topic :: View next topic |
Author |
Message |
pmurphy Guest
|
data table |
Posted: Sat Jul 12, 2003 4:31 am |
|
|
i have a message table of 20 messages 4 characters each. I am Converting code from HI-TECH to CCS. I used a pointer into the table of the form:
const char messages [][4]={"xxxx","yyyy",.....}; the table
char *mess_pointer; the pointer
.
.
mess_pointer=messages[mode]+i; the access
this works fine with HI-TECH. No go with CCS. What am I doing wrong here?
Thanks,
Pat
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515904 |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
Re: data table |
Posted: Sat Jul 12, 2003 9:50 am |
|
|
CCS doesn't allow pointers to strings! (or functions either)
Regards
Mark
:=i have a message table of 20 messages 4 characters each. I am Converting code from HI-TECH to CCS. I used a pointer into the table of the form:
:=
:=const char messages [][4]={"xxxx","yyyy",.....}; the table
:=
:=
:=char *mess_pointer; the pointer
:=.
:=.
:=mess_pointer=messages[mode]+i; the access
:=
:=this works fine with HI-TECH. No go with CCS. What am I doing wrong here?
:=
:=Thanks,
:=Pat
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515908 |
|
|
R.J.Hamlett Guest
|
Re: data table |
Posted: Sat Jul 12, 2003 10:02 am |
|
|
:=CCS doesn't allow pointers to strings! (or functions either)
:=
:=Regards
:=Mark
Not quite true. It allows pointers to strings, but _only_ if they are in RAM.
The 'key' is that the architecture of the PIC (seperate ROM, and RAM address spaces), means that if you are going to support pointers in both, a 'pointer' would have to be very large (remember that the potential ROM space, plus RAM space of the 18F series, would require a 25bit pointer size). Also on the smaller chips (16 family), accessing a byte at an address in the ROM is very difficult. CCS decided that it was more code efficient, not to implement this (Hi-Tech do, but at a significant overhead - it is worth looking at the code/RAM size this generates).
Basically, you can just use array accesses, or copy the string to RAM, where pointers are allowed.
:=:=i have a message table of 20 messages 4 characters each. I am Converting code from HI-TECH to CCS. I used a pointer into the table of the form:
:=:=
:=:=const char messages [][4]={"xxxx","yyyy",.....}; the table
:=:=
:=:=
:=:=char *mess_pointer; the pointer
:=:=.
:=:=.
:=:=mess_pointer=messages[mode]+i; the access
:=:=
:=:=this works fine with HI-TECH. No go with CCS. What am I doing wrong here?
:=:=
:=:=Thanks,
:=:=Pat
I'd suggest reading the manual, this restriction is well documented...
Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515909 |
|
|
Dave Yeatman Guest
|
Re: data table |
Posted: Sat Jul 12, 2003 7:53 pm |
|
|
<font face="Courier New" size=-1>One bright side..CCS has announced that, because of the survey, they pointers issue is at the top of the list of upcoming features they are working on. "BUT" the down side as mentioned by Rich, the resource overhead is likely to be pretty big when they do..
Dave
:=i have a message table of 20 messages 4 characters each. I am Converting code from HI-TECH to CCS. I used a pointer into the table of the form:
:=
:=const char messages [][4]={"xxxx","yyyy",.....}; the table
:=
:=
:=char *mess_pointer; the pointer
:=.
:=.
:=mess_pointer=messages[mode]+i; the access
:=
:=this works fine with HI-TECH. No go with CCS. What am I doing wrong here?
:=
:=Thanks,
:=Pat</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515915 |
|
|
|
|
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
|