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.
i got an error code "error C241: 'main': auto segment too large"
That's not nearly sufficient info. You have to show an actual, complete example case that exhibits the problem. You haven't even told us whether that variable has static or automatic storage duration!
Furthermore this
unsigned char pdata array_1[8][16]; unsigned char data *p1; p1 = &array_1[0][0];
makes no sense whatsoever. How do you expect a memory-class specific pointer (p1 points to data) to be able to point at data of a different memory class (pdata)?
excuse me for my ignorance but how can i tell if a variable has static or automatic storage duration. i dont expect nothing, what wrong with the pointer , please advice me what to do.
an ex
normally, if you see the specifier "static" along with the definition of a variable, it is static, like this:
static int x ;
whether you make the variable static in a function or file scope is your business. But if the "static" keyword is missing and the variable is in function scope, it is an automatic.
View all questions in Keil forum