![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
J1M
Joined: 15 Feb 2005 Posts: 21
|
ccs doesnt support this??? pointers... |
Posted: Fri Mar 11, 2005 5:56 am |
|
|
Hi, im trying to make a pointer to a vector in rom memory...
function:
void gclcd_img(unsigned int16 *imgn, unsigned int8 pixl)
{
for(i=0; i<pixl; i++)
{
gclcd_data(imgn[i]);
}
}
call:
gclcd_img(img16, sizeof img16);
where img16 is:
STATIC CONST UNSIGNED INT16 img16 [12100]={0x4943,0x4123,0x4943,0x4943,0x4923,0x4923,0x4942,0x4943,0x4943,0x4943,0x4943,0x4943,0x4943..........}
How can i do that??
thanks for your replies
Jaime |
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Mar 11, 2005 7:33 am |
|
|
No, read the manual. Pointers to constants are not allowed. Search the board for alternatives.
Here is an example where I used "Melody Pointer" as a global indicator to which constant struct I was using.
http://www.ccsinfo.com/forum/viewtopic.php?t=22010 |
|
![](templates/subSilver/images/spacer.gif) |
J1M
Joined: 15 Feb 2005 Posts: 21
|
|
Posted: Fri Mar 11, 2005 10:16 am |
|
|
Thanks for your reply, i know that ccs 'DEFECT'... i think that a pointer to a constant should be supported.. its only my opinion of course ;)
ill try with your example, thanks very much
if there is any other suggestion would be very apreciated!
Reggards! |
|
![](templates/subSilver/images/spacer.gif) |
J1M
Joined: 15 Feb 2005 Posts: 21
|
|
Posted: Sun Mar 13, 2005 2:28 pm |
|
|
i cant apply your sample...
ive trying to modify function, but no satisfy results :( ... in pseudocode this is that im trying to do:
img vector:
STATIC CONST UNSIGNED INT8 img [10000]={0x6E,0x6E,0x43,0x23,0x43,0x43,0x23,0x23.....};
call:
gclcd_img(img);
Code: |
void gclcd_img()
{
for(i=0; i<10000; i++)
{
gclcd_send(img[i]);
}
}
|
i think that its very simple... im only have to read 10000 position of a vector in ROM memory! .......... could i do this in assembler???
thanks for your support
Jaime |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Mar 13, 2005 2:40 pm |
|
|
Don't post pseudo-code. Post a real test program, with all the
CCS directives and include statements. Then we know the PIC
that you're using and the #fuses settings, etc., and we can easily
point out any errors. |
|
![](templates/subSilver/images/spacer.gif) |
dyeatman
Joined: 06 Sep 2003 Posts: 1924 Location: Norman, OK
|
|
Posted: Sun Mar 13, 2005 3:04 pm |
|
|
I am sorry, but I have to jump in here...I strongly object to calling it a DEFECT just because CCS doesn't support pointers to ROM. If that's the case then every compiler in the world has defects! Rather it is simply something not supported by this compiler. This (BTW) is true in some respect for every compiler in existance as far as I know, but especially true for embedded compilers due to the nature of the devices.
If you want this FEATURE then pay a lot more and get HiTech C. However, be warned, if a missing capability is a defect, there are a bunch of capabilities CCS has that Hi Tech doesn't and vice-versa. Read the compiler comparisons sometime!
Don't down CCS just because you want everything for a cheap price, but who doesn't! If that's the case I especially want my $100 Turbocad to have all the FEATURES of the $3000 Autocad I use at the office without me paying for them!!!
To everyone else, sorry for the rant...but I feel better now.
Have a nice (non-defective) day!
![Smile](images/smiles/icon_smile.gif) |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Sun Mar 13, 2005 4:57 pm |
|
|
bravo! dyeatman...................
ill try to explain that i wanna do, i have two images in rom memory, i havent no problem to send 1 image to the display cause i use this code..
main.c
Code: |
#include <18F2520.h>
#fuses NOWDT, WDT128, H4, NOPROTECT, BROWNOUT, BORV45, NOPUT, NOCPD
#fuses NOSTVREN, NODEBUG, NOLVP, NOWRT, NOWRTD, NOIESO, NOFCMEN, NOPBADEN
#fuses NOWRTC, NOWRTB, NOEBTR, NOEBTRB, NOCPB, NOLPT1OSC, MCLR, NOXINST
#use delay(clock=40000000)
#include <img.c>
#include <gclcd.h>
void main(void)
{
setup_adc_ports(NO_ANALOGS);
gclcd_init();
gclcd_img(); // send image1
while(true){}
}
|
the necesary extract of gclcd.h
Code: |
void gclcd_img()
{
for(i=0; i<16900; i++)
{
gclcd_data(img1[i]);
}
}
|
my problem is that.... this way i can only send one image... and one function for image doesnt be rigth.
my initial idea was refer the image to the gclcd_img function... this way:
gclcd_img(img1);
modifing gclcd_img of course...
now i could send any image in rom memory... but ... compiler tell me an error
then, the real cuestion is... how could i do this with CCS ... im sure that there is a way...
thanks for your support and sorry for my fantastic english xDD
Jaime |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Sun Mar 13, 2005 4:59 pm |
|
|
bravo! dyeatman...................
ill try to explain that i wanna do, i have two images in rom memory, i havent no problem to send 1 image to the display cause i use this code..
main.c
Code: |
#include <18F2520.h>
#fuses NOWDT, WDT128, H4, NOPROTECT, BROWNOUT, BORV45, NOPUT, NOCPD
#fuses NOSTVREN, NODEBUG, NOLVP, NOWRT, NOWRTD, NOIESO, NOFCMEN, NOPBADEN
#fuses NOWRTC, NOWRTB, NOEBTR, NOEBTRB, NOCPB, NOLPT1OSC, MCLR, NOXINST
#use delay(clock=40000000)
#include <img.c>
#include <gclcd.h>
void main(void)
{
setup_adc_ports(NO_ANALOGS);
gclcd_init();
gclcd_img(); // send image1
while(true){}
}
|
the necesary extract of gclcd.h
Code: |
void gclcd_img()
{
for(i=0; i<16900; i++)
{
gclcd_data(img1[i]);
}
}
|
my problem is that.... this way i can only send one image... and one function for image doesnt be rigth.
my initial idea was refer the image to the gclcd_img function... this way:
gclcd_img(img1);
modifing gclcd_img of course...
now i could send any image in rom memory... but ... compiler tell me an error
then, the real cuestion is... how could i do this with CCS ... im sure that there is a way...
thanks for your support and sorry for my fantastic english xDD
Jaime |
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sun Mar 13, 2005 7:03 pm |
|
|
What you mean it doesn't apply? The link for a program that plays tunes. The tunes are in memory (ROM) and I can play different tunes. Now in your case, you have an image instead of a tune. Instead of playing, you are displaying. Sounds like you should have been able to get something out of it.
Code: |
void gclcd_img(int8 whichimage)
{
long i;
switch (whichimage)
{
case 1:
for(i=0; i<16900; i++)
{
gclcd_data(img1[i]);
}
break;
case 2:
for(i=0; i<16900; i++)
{
gclcd_data(img2[i]);
}
break;
case 3:
for(i=0; i<16900; i++)
{
gclcd_data(img3[i]);
}
break;
}
}
|
|
|
![](templates/subSilver/images/spacer.gif) |
J1M
Joined: 15 Feb 2005 Posts: 21
|
|
Posted: Sun Mar 13, 2005 8:12 pm |
|
|
hi Mark, thanks for your reply, and yes, this would be a solution to my problem thanks!
but really my gclcd_img function is like this:
Code: |
void gclcd_img(unsigned int8 x, unsigned int8 y)
{
unsigned int16 IMGENDX, IMGENDY, i;
IMGENDX = img[0];
IMGENDY = img[1];
gclcd_setarea(x,IMGENDX-1+x,y,IMGENDY-1+y);
gclcd_cmd(MEMWRITE);
for(i=0; i<((IMGENDX*IMGENDY)+2); i++)
{
#ifdef HIGH_COLOR
gclcd_data(img[i+2] >> 8);
gclcd_data(img[i+2]);
#else
gclcd_data(img[i+2]);
#endif
}
}
|
although ... now i have your solution, it would generate a lot of code... for this reason i was trying to use a pointer to access to the rom...
but... if there isnt any other solution... ill use it!
thanks! ![Smile](images/smiles/icon_smile.gif) |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|