This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with arrays (atmel 8052)

I've been trying to initialize a pretty big array, but I'm encountering some problems.

My first attempt looked like this:

const unsigned char font[] = {
{0x22,0x3c,0x1c,0x3c,0x3c,0x20,0x1c,0x22,0x1c,0x1c,0x22,0x3c,0x22,0x22,0x1c,0x20,0x1c,0x22,0x1c,0x08,0x1c,0x08,0x22,0x22,0x08,0x3e},
{0x22,0x22,0x22,0x22,0x20,0x20,0x22,0x22,0x08,0x22,0x24,0x20,0x22,0x22,0x22,0x20,0x26,0x22,0x22,0x08,0x22,0x14,0x36,0x22,0x08,0x20},
{0x3e,0x22,0x20,0x22,0x20,0x20,0x2e,0x22,0x08,0x22,0x28,0x20,0x22,0x26,0x22,0x3c,0x2a,0x3c,0x02,0x08,0x22,0x22,0x2a,0x14,0x08,0x10},
{0x22,0x3c,0x20,0x22,0x3c,0x3c,0x20,0x3c,0x08,0x02,0x30,0x20,0x22,0x2a,0x22,0x22,0x22,0x22,0xac,0x08,0x22,0x22,0x22,0x08,0x14,0x08},
{0x22,0x22,0x20,0x22,0x20,0x20,0x20,0x22,0x08,0x02,0x28,0x20,0x2a,0x32,0x22,0x22,0x22,0x22,0x20,0x08,0x22,0x22,0x22,0x14,0x22,0x04},
{0x22,0x22,0x22,0x22,0x20,0x20,0x22,0x22,0x08,0x02,0x24,0x20,0x36,0x22,0x22,0x22,0x22,0x22,0x22,0x08,0x22,0x22,0x22,0x22,0x22,0x02},
{0x1c,0x3c,0x3c,0x3c,0x3e,0x3e,0x1c,0x22,0x1c,0x02,0x22,0x20,0x22,0x22,0x1c,0x3c,0x1c,0x3c,0x1c,0x3e,0x22,0x22,0x22,0x22,0x22,0x3e}
};

After I tried compiling this code I got the following error:
FUNCTIONS.C(9): error C242: 'scalar': too many initializers

I've looked up the problem in google and found out that I need to change the syntax of my array a bit, and so I did, this is my second attempt:

const unsigned char font[] = {
{"\x22" "\x3c" "\x1c" "\x3c" "\x3c" "\x20" "\x1c" "\x22" "\x1c" "\x1c" "\x22" "\x3c" "\x22" "\x22" "\x1c" "\x20" "\x1c" "\x22" "\x1c" "\x08" "\x1c" "\x08" "\x22" "\x22" "\x08" "\x3e"},
{"\x22" "\x22" "\x22" "\x22" "\x20" "\x20" "\x22" "\x22" "\x08" "\x22" "\x24" "\x20" "\x22" "\x22" "\x22" "\x20" "\x26" "\x22" "\x22" "\x08" "\x22" "\x14" "\x36" "\x22" "\x08" "\x20"},
{"\x3e" "\x22" "\x20" "\x22" "\x20" "\x20" "\x2e" "\x22" "\x08" "\x22" "\x28" "\x20" "\x22" "\x26" "\x22" "\x3c" "\x2a" "\x3c" "\x02" "\x08" "\x22" "\x22" "\x2a" "\x14" "\x08" "\x10"},
{"\x22" "\x3c" "\x20" "\x22" "\x3c" "\x3c" "\x20" "\x3c" "\x08" "\x02" "\x30" "\x20" "\x22" "\x2a" "\x22" "\x22" "\x22" "\x22" "\xac" "\x08" "\x22" "\x22" "\x22" "\x08" "\x14" "\x08"},
{"\x22" "\x22" "\x20" "\x22" "\x20" "\x20" "\x20" "\x22" "\x08" "\x02" "\x28" "\x20" "\x2a" "\x32" "\x22" "\x22" "\x22" "\x22" "\x20" "\x08" "\x22" "\x22" "\x22" "\x14" "\x22" "\x04"},
{"\x22" "\x22" "\x22" "\x22" "\x20" "\x20" "\x22" "\x22" "\x08" "\x02" "\x24" "\x20" "\x36" "\x22" "\x22" "\x22" "\x22" "\x22" "\x22" "\x08" "\x22" "\x22" "\x22" "\x22" "\x22" "\x02"},
{"\x1c" "\x3c" "\x3c" "\x3c" "\x3e" "\x3e" "\x1c" "\x22" "\x1c" "\x02" "\x22" "\x20" "\x22" "\x22" "\x1c" "\x3c" "\x1c" "\x3c" "\x1c" "\x3e" "\x22" "\x22" "\x22" "\x22" "\x22" "\x3e"}
};

this time I'm getting this error:
FUNCTIONS.C(10): error C243: 'array[]': string out of bounds

I really have no idea how to deal with this.
Any idea anyone? help will be greatly appreciated!