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 support@ccsinfo.com

please help!!!

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



Joined: 14 Feb 2007
Posts: 46
Location: Greece & Cyprus

View user's profile Send private message

please help!!!
PostPosted: Sun Feb 18, 2007 11:57 am     Reply with quote

hi
i got the follow table..error!!!!! Confused
_________________
---- GREECE ----


Last edited by E_KARVELAs on Sun Feb 18, 2007 6:05 pm; edited 2 times in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Feb 18, 2007 12:20 pm     Reply with quote

For the 16F PICs (with the PCM compiler), const arrays are limited to
256 ROM words. See this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=25483&highlight=const+array+256

You need to break up the large array into two or more smaller arrays,
which have only 256 elements in each array. Then write some code
to check the index value, and use the correct array based upon the
index value.

Also, when you start a new topic, you should use a better title than
"please help". Almost all posts are asking for help. We know that.
Use a descriptive title such as "Problem with size of const array".
E_KARVELAs



Joined: 14 Feb 2007
Posts: 46
Location: Greece & Cyprus

View user's profile Send private message

PostPosted: Sun Feb 18, 2007 2:48 pm     Reply with quote

hi
i been change the code as follow:

i want to change the 6 byte of table every time the ch change

but i have a error:
why???

Code:
*** Error 51 "C:\Documents and Settings\Evagoras.EVAGORASHP\Desktop\mplab_C_TO_hex\matrix.c" Line 19(7,12): A numeric expression must appear here


 ch=getch();

switch( ch)

 
  {
   case 'A':
      const int  DIG[6]={0x7e,0x88,0x88,0x88,0x7e,0x00,};          //A    <--here is the error
      break;

   case 'B':
      const int  DIG[6]={0xfe,0x92,0x92,0x92,0x6c,0x00,};       //B  <--and here
 break;


      .
      .
      .



  case 'Z':
       const intDIG[6]={................................}
      break;
   }

_________________
---- GREECE ----


Last edited by E_KARVELAs on Sun Feb 18, 2007 6:08 pm; edited 2 times in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Feb 18, 2007 4:05 pm     Reply with quote

You can't stick declarations in the middle of a switch() statement like that.
Also, in my post I said to break up the large array into smaller arrays
that have at most, 256 elements. I didn't say to break them up into
one million little arrays. I meant for you to do something like the code
shown below. The test program has the following output, which shows
that the segment data is correctly accessed from the two arrays:
Quote:

00 00 00 00 00 00
04 08 10 20 40 00
7C 8A 92 A2 7C 00
40 80 8A 90 60 00

Code:

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

const int8 DIG_0[16][6] = {
0x00,0x00,0x00,0x00,0x00,0x00, // space
0x00,0x00,0xfa,0x00,0x00,0x00, // !
0x00,0xe0,0x00,0xe0,0x00,0x00, // "
0x28,0xfe,0x28,0xfe,0x28,0x00, // #
0x24,0x54,0xfe,0x54,0x48,0x00, // $
0xc4,0xc8,0x10,0x26,0x46,0x00, // %
0x6c,0x92,0xaa,0x44,0x0a,0x00, // &
0x00,0xa0,0xc0,0x00,0x00,0x00, // '
0x00,0x38,0x44,0x82,0x00,0x00, // (
0x00,0x82,0x44,0x38,0x00,0x00, // )
0x28,0x10,0x7c,0x10,0x28,0x00, // *
0x10,0x10,0x7c,0x10,0x10,0x00, // +
0x00,0x0a,0x0c,0x00,0x00,0x00, // ,
0x10,0x10,0x10,0x10,0x10,0x00, // -
0x00,0x06,0x06,0x00,0x00,0x00, // .
0x04,0x08,0x10,0x20,0x40,0x00, // /
};

const int8 DIG_1[16][6] = {
0x7c,0x8a,0x92,0xa2,0x7c,0x00, // 0
0x00,0x42,0xfe,0x02,0x00,0x00, // 1
0x42,0x86,0x8a,0x92,0x62,0x00, // 2
0x84,0x82,0xa2,0xd2,0x8c,0x00, // 3
0x18,0x28,0x48,0xfe,0x08,0x00, // 4
0xe5,0xa2,0xa2,0xa2,0x9c,0x00, // 5
0x3c,0x52,0x92,0x92,0x0c,0x00, // 6
0x80,0x8e,0x90,0xa0,0xc0,0x00, // 7
0x6c,0x92,0x92,0x92,0x6c,0x00, // 8
0x60,0x92,0x92,0x94,0x78,0x00  // 9
0x00,0x6c,0x6c,0x00,0x00,0x00, // :
0x00,0x6a,0x6c,0x00,0x00,0x00, // ;
0x10,0x28,0x44,0x82,0x00,0x00, // <
0x00,0x6a,0x6c,0x00,0x00,0x00, // =
0x10,0x28,0x44,0x82,0x00,0x00, // >
0x40,0x80,0x8a,0x90,0x60,0x00  // ?
};

void display_data(int8 c)
{
int8 i;
int8 digit_data[6];


if((c < ' ') || (c > '?'))
   return;

if(c < '0')
   memcpy(digit_data, Dig_0[c - ' '], 6);
else if (c < '@')
   memcpy(digit_data, Dig_1[c - '0'], 6);

 
for(i = 0; i < 6; i++)
    printf("%X " , digit_data[i]);

printf("\n");
}


//=======================
void main()
{
char c;

c = ' ';
display_data(c);
c = '/';
display_data(c);


c = '0';
display_data(c);
c = '?';
display_data(c);


while(1);
}



One more thing. When you post code, make sure that you disable HTML.
There is a tickbox below the posting window to do this. It looks like this:
Quote:
x Disable HTML in this post
E_KARVELAs



Joined: 14 Feb 2007
Posts: 46
Location: Greece & Cyprus

View user's profile Send private message

PostPosted: Sun Feb 18, 2007 5:29 pm     Reply with quote

,,,,

Last edited by E_KARVELAs on Sun Feb 18, 2007 6:10 pm; edited 4 times in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Feb 18, 2007 5:45 pm     Reply with quote

I've done enough on this thread.
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