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 CCS Technical Support

functions

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



Joined: 15 Jul 2006
Posts: 22

View user's profile Send private message

functions
PostPosted: Sat Jul 15, 2006 12:05 pm     Reply with quote

hi, i have question about functions and multiarray.

for example:

const int image[5] = {1,2,3,4,5};

void funkce(int img)
{
blah blah
}

void Main()
{
funkce(image);

}

there is problem "attempt to create pointner to constant"
How i can get this variable to function ? thank you
wh1sp3r



Joined: 15 Jul 2006
Posts: 22

View user's profile Send private message

PostPosted: Sat Jul 15, 2006 12:36 pm     Reply with quote

there is my program

Code:
#include <16F877>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)

const int image_a[256] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,1,255,255,255,255,255,255,247,252,0,0,0,0,0,
0,0,126,0,0,0,0,0,7,224,0,224,0,0,0,0,
0,15,128,0,0,0,0,0,59,0,0,8,0,0,0,0,
};
const int image_b[256] = {
1,255,255,255,255,255,255,255,200,0,0,12,0,0,0,0,
4,0,0,0,0,0,0,4,16,0,0,48,0,0,0,0,
4,15,3,195,192,62,31,228,16,0,1,138,0,0,0,0,
4,15,3,195,224,126,31,228,23,255,242,0,0,0,0,0,
4,15,3,195,240,126,31,244,16,0,10,5,0,0,0,0,
4,15,3,195,248,254,30,4,20,0,5,1,184,0,0,0,
4,15,3,195,253,254,31,196,16,0,4,7,112,240,0,0,
4,15,3,195,255,254,31,196,20,0,4,144,195,224,64,0,
4,15,3,195,255,254,31,196,4,0,0,2,0,7,48,0,
4,15,3,195,223,222,30,4,11,255,254,7,0,0,38,0,
4,15,243,195,223,158,31,244,27,128,1,8,31,0,22,0,
4,15,243,195,207,30,31,228,18,0,1,0,0,7,6,128,
4,15,243,195,198,30,31,244,24,0,3,96,1,248,140,128,
7,255,255,255,255,255,255,252,120,0,3,128,0,1,206,128,
3,255,255,255,255,255,255,255,184,0,6,0,0,0,172,0,
0,64,0,0,0,0,0,0,88,0,0,0,0,0,11,0,
};
const int image_c[256] = {
0,127,255,255,255,255,255,255,248,0,8,0,0,0,136,0,
0,0,63,248,70,255,255,255,240,0,8,0,0,0,129,0,
0,0,63,159,225,191,255,255,248,0,8,0,127,224,132,0,
0,0,63,127,240,239,255,255,255,255,224,1,255,252,242,0,
0,0,63,255,254,123,255,255,255,255,224,3,255,252,40,0,
0,0,63,243,207,59,255,255,255,255,240,3,201,62,72,192,
0,0,63,238,55,157,255,255,255,255,240,3,184,223,38,64,
0,0,3,209,139,143,254,1,192,32,120,7,104,13,240,128,
0,0,7,209,167,143,249,253,252,0,15,215,112,4,1,0,
0,63,255,246,5,143,255,255,255,255,255,254,89,22,12,0,
0,127,255,247,5,239,255,255,255,255,255,255,120,183,0,0,
7,255,255,211,131,239,255,255,255,255,255,255,127,15,128,0,
7,255,255,236,55,255,255,255,255,255,255,255,184,79,191,0,
7,255,255,247,143,221,255,255,255,255,255,255,205,62,127,128,
15,255,255,252,63,255,255,255,255,255,255,247,248,254,254,0,
31,255,255,255,255,247,255,255,255,255,255,255,255,249,255,0,
};
const int image_d[256] = {
31,255,255,191,255,223,255,255,255,255,255,254,255,255,255,192,
1,255,255,239,254,127,255,255,255,255,255,255,191,223,255,192,
0,63,255,252,31,255,255,255,255,255,255,255,251,255,254,0,
0,1,220,255,255,255,255,255,255,255,255,255,255,255,248,0,
0,0,0,0,3,255,199,255,255,255,255,255,255,255,224,0,
0,0,0,7,255,255,255,255,255,255,255,255,255,240,32,0,
0,0,0,0,15,255,58,255,255,255,255,195,255,224,0,0,
0,0,0,0,7,255,255,255,255,255,240,255,255,128,0,0,
0,0,0,0,0,6,192,15,255,248,31,252,127,0,0,0,
0,0,0,0,0,0,0,0,15,255,254,31,255,128,0,0,
0,0,0,0,0,0,0,0,0,23,131,131,254,0,0,0,
0,0,0,0,0,0,0,0,1,228,0,0,239,0,0,0,
0,0,0,0,0,0,0,0,0,0,59,216,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};

void glcd_image(int *image1,int *image2,int *image3,int *image4)
{

}

void main()
{

  glcd_image(image_a, image_b, image_c, image_d);


 

  while(TRUE)

  {
   
   
   
  }
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jul 15, 2006 12:48 pm     Reply with quote

Look in this thread for some examples:
http://www.ccsinfo.com/forum/viewtopic.php?t=25483
wh1sp3r



Joined: 15 Jul 2006
Posts: 22

View user's profile Send private message

PostPosted: Sat Jul 15, 2006 12:59 pm     Reply with quote

so, if i understand, i have to make temp array ?
if yes, i havent too much RAM .. for 1024 K Smile
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jul 15, 2006 1:03 pm     Reply with quote

Look at the example near the end of that thread.
wh1sp3r



Joined: 15 Jul 2006
Posts: 22

View user's profile Send private message

PostPosted: Sat Jul 15, 2006 1:08 pm     Reply with quote

Code:
#include <16F877>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

const char msg1[] ={"ABCD"};
const char msg2[] ={"Hello World"};
const char msg3[] ={"The quick brown fox jumps over the lazy dogs back"};

void display_msg(int8 index)
{
switch(index)
  {
   case 1:
      printf(msg1);
      break;

   case 2:
      printf(msg2);
      break;

   case 3:
      printf(msg3);
      break;

  }   

printf("\n\r");

}

//=====================================
void main()


display_msg(1);
display_msg(2);
display_msg(3);

while(1);
}


You mean this ? eh
chm.. very uncomfortably and not flexible, but what else i can do Smile
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