Jump to content

Recommended Posts

Hi,

 

I am trying to port nokia 3310 LCD driving routines written in Hi-Tech C to BoostC

and I am stuck in place named data lookup table:

 

// ASCII lookup table
static const byte FontLookup [][5] =
{
   { 0x00, 0x00, 0x00, 0x00, 0x00 },  // sp
   { 0x00, 0x00, 0x2f, 0x00, 0x00 },   // !
   { 0x00, 0x07, 0x00, 0x07, 0x00 },   // "
   { 0x14, 0x7f, 0x14, 0x7f, 0x14 },   // #
   // Lots more characters between here
   { 0x3C, 0x40, 0x40, 0x20, 0x7C },   // u
   { 0x1C, 0x20, 0x40, 0x20, 0x1C },   // v
   { 0x3C, 0x40, 0x30, 0x40, 0x3C },   // w
   { 0x44, 0x28, 0x10, 0x28, 0x44 },   // x
   { 0x0C, 0x50, 0x50, 0x50, 0x3C },   // y
   { 0x44, 0x64, 0x54, 0x4C, 0x44 }    // z
};

 

I know rom is the keyword here but I tried in many ways without success.

Is there some way to accomplish this in BoostC?

Link to post
Share on other sites
Hi,

 

I am trying to port nokia 3310 LCD driving routines written in Hi-Tech C to BoostC

and I am stuck in place named data lookup table:

 

I know rom is the keyword here but I tried in many ways without success.

Is there some way to accomplish this in BoostC?

 

 

This is from a snippet on a thread in the BUGs section that should work for you

with minimal adjustments.

rom char* initRegVal1 =
{
179, 128, 30, 93, 16,
7, 51, 128, 16, 128,
30, 93, 85, 42, 26,
0, 0, 0, 0, 60,
128, 170, 135, 163, 231,
98, 98, 98, 173, 46,
172, 128, 30, 93, 50,
167, 50, 39
};


char const initRegVal2[38] =
{
179, 128, 30, 93, 16,
7, 51, 128, 16, 128,
30, 93, 85, 42, 26,
0, 0, 0, 0, 60,
128, 170, 135, 163, 231,
98, 98, 98, 173, 46,
172, 128, 30, 93, 50,
167, 50, 39
};

Link to post
Share on other sites

These examples are for one dimensional array but I need two dimensional array.

 

I have tried with the following methods but none of them worked:

char const data[2][5] = {{1,3,5,7,9}, { 0, 2, 4, 6, 8}};

char const *data[5] = {{1,3,5,7,9}, { 0, 2, 4, 6, 8}};

const char **data =  {{1,3,5,7,9}, { 0, 2, 4, 6, 8}};

 

Neither with 'rom' keyword:

rom char data[2][5] =  {{1,3,5,7,9}, { 0, 2, 4, 6, 8}};

rom char *data[5] =  {{1,3,5,7,9}, { 0, 2, 4, 6, 8}};

rom char **data =  {{1,3,5,7,9}, { 0, 2, 4, 6, 8}};

 

Compiler output:

error : missing semicolon (sometimes says this, actually isn't missing)

error : failure

Link to post
Share on other sites
BoostC does not support multi-dimensional arrays.

That's strange because in the BoostC Reference Manual (page 42) it says: "Arrays can have any number dimensions" :huh:

 

So there's no way to do such lookup table in BoostC :blink: ?

Anyone some ideas ?

 

Sorry, my partial mistake

 

the exact quote from the manual is

 

Arrays can have any number of dimensions. The only constraint is that an array

must fit into a single RAM bank.

 

ie , ok for arrays of variables but not for arrays of rom data.

 

Maybe Dave or Pavel could confirm this.

Link to post
Share on other sites
BoostC does not support multi-dimensional arrays.

That's strange because in the BoostC Reference Manual (page 42) it says: "Arrays can have any number dimensions" :huh:

 

So there's no way to do such lookup table in BoostC :blink: ?

Anyone some ideas ?

 

Sorry, my partial mistake

 

the exact quote from the manual is

 

Arrays can have any number of dimensions. The only constraint is that an array

must fit into a single RAM bank.

 

ie , ok for arrays of variables but not for arrays of rom data.

 

Maybe Dave or Pavel could confirm this.

 

Yes this is a correct statement:

 

- array must fit inside one memory bank;

- array can not be longet than 256 bytes;

- arrays can have multiple dimensions with the exception of rom array

that can have only one dimension.

 

Regards,

Pavel

Link to post
Share on other sites
Hi,

 

I am trying to port nokia 3310 LCD driving routines written in Hi-Tech C to BoostC

and I am stuck in place named data lookup table:

 

// ASCII lookup table
static const byte FontLookup [][5] =
{
   { 0x00, 0x00, 0x00, 0x00, 0x00 },  // sp
   { 0x00, 0x00, 0x2f, 0x00, 0x00 },   // !
   { 0x00, 0x07, 0x00, 0x07, 0x00 },   // "
   { 0x14, 0x7f, 0x14, 0x7f, 0x14 },   // #
   // Lots more characters between here
   { 0x3C, 0x40, 0x40, 0x20, 0x7C },   // u
   { 0x1C, 0x20, 0x40, 0x20, 0x1C },   // v
   { 0x3C, 0x40, 0x30, 0x40, 0x3C },   // w
   { 0x44, 0x28, 0x10, 0x28, 0x44 },   // x
   { 0x0C, 0x50, 0x50, 0x50, 0x3C },   // y
   { 0x44, 0x64, 0x54, 0x4C, 0x44 }    // z
};

 

I know rom is the keyword here but I tried in many ways without success.

Is there some way to accomplish this in BoostC?

 

Take a look here http://www.lika.be/content/view/21/30/

Link to post
Share on other sites
Thanks for clearing things up and thanks for the last link.

 

Pls, and what about using of multi-dimensions array in BoostC ? Pavel wrote, there is no problem to use i.e. 2D array in RAM, but this definition doesn't work :

 UCHAR test[][2] = { {1,2} , {1,2} };

C:\Dokumenty\RJ\wastegate regulace\boost\boost_control.c(17): error: missing semicolon

C:\Dokumenty\RJ\wastegate regulace\boost\boost_control.c(17): error: failure

 

What Am I doing wrong ?? ;)

 

Thanks for a reply.

Petr

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...