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

array with pdata

hello,
i'm using AT80C31X2 uC. Keil V3.33
i've declared an array as follows:

unsigned char pdata array_1[8][16];


i got an error code "error C241: 'main': auto segment too large"
I've tried to work in compact rom code size and declarde the arrat as follows:

unsigned char pdata array_1[8][16];
unsigned char data *p1;
p1 = &array_1[0][0];

unsigned char code numerics[] = {
0x00,0x00,0x3c,0x7e,0x66,0x66,0x66,0x66,0x66,0x66,0x7e,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x7e,0x66,0x66,0x7e,0x7c,0x60,0x60,0x7c,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x7e,0x66,0x66,0x3c,0x7c,0x66,0x66,0x7e,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x7e,0x60,0x60,0x60,0x60,0x30,0x18,0x0c,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x7e,0x46,0x06,0x3e,0x7e,0x66,0x66,0x7e,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x7e,0x06,0x06,0x7e,0x7e,0x60,0x62,0x7e,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x7e,0x7e,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x7e,0x42,0x60,0x78,0x38,0x60,0x66,0x7e,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x7e,0x42,0x60,0x30,0x18,0x0c,0x06,0x7e,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x38,0x3c,0x34,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x7e,0x66,0x66,0x66,0x66,0x66,0x66,0x7e,0x3c,0x00,0x00,0x00,0x00
};

for (z = 0; z < 16; z++) {           // scan all rows
        *(p1 + z) = numerics[z + sd0];
        *(p1 + 16 + z) = numerics[z + sd1];
        *(p1 + 32 + z) = numerics[z + md0];
        *(p1 + 48 + z) = numerics[z + md1];
        *(p1 + 64 + z) = numerics[z + hd0];
        *(p1 + 80 + z) = numerics[z + hd1];
        }

for (z = 0; z < 16; z++) {
P1 = *(p1 + 16 + z);
}


Only in simulation the values in the array are passed to P1 correctly.
I read all the manuals of Keil and search the forum but still can't figure why it doesn't work.
in real i recieve an address from 9 to F.
any suggesion please.

Parents
  • I'm very familiar with the 'C' textbook.
    that wasn't the issue , i found the problem eventually.
    first of all i'll describe the issue:
    i need to use a dynamic 3D array: (global of course)

    unsigned char disp[15][25];
    


    Only the array takes about 375 Byte's, i think, and if i'm wrong i'll be very happy, which is definitely way over my primitive hardware limitation,
    So, do i have to use a flash memory along with my current EPROM M27C256B to populate the program variable's and surely the large array i'm using.
    and if so any suggestion please ?

Reply
  • I'm very familiar with the 'C' textbook.
    that wasn't the issue , i found the problem eventually.
    first of all i'll describe the issue:
    i need to use a dynamic 3D array: (global of course)

    unsigned char disp[15][25];
    


    Only the array takes about 375 Byte's, i think, and if i'm wrong i'll be very happy, which is definitely way over my primitive hardware limitation,
    So, do i have to use a flash memory along with my current EPROM M27C256B to populate the program variable's and surely the large array i'm using.
    and if so any suggestion please ?

Children