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.
This is standard terminology of the 'C' programming language - so the place to look is a 'C' textbook.
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 ?
What is dynamic about this variable?
Get a chip with a lot of RAM, or check if your algorithm needs this amount.
80c31 where did you find that anachronism?
how much XDATA (external RAM) do you have?
Erik
My project is a dot matrix display 16(rows)x192(bit's wide) (8x8 dot), and i need this array for shifting the bits all together in a loop. i don't have any XDATA at all. does external RAM is necessary for this kind of job ? or can you recommend another uC with 40DIP socket to hold this amount of data ?
Only the array takes about 375 Byte's, ... i don't have any XDATA at all. so where do you propose to put the 375 bytes, can you put them in codespace i.e. will they ever change?
can you recommend another uC with 40DIP socket to hold this amount of data
find it in "the Keil device database"
http://www.keil.com/dd/parm_search.asp
That is neither dynamic nor 3D!
And why global "of course" ?
you right. 2D. it needs to be global type variable. still not enough room.
You didn't answer the question: can it go into CODE space?
If not, you'll just have to provide more RAM - either a different chip with (more) internal RAM, or add external RAM.
i'm sorry i didn't see the question.
it can go into CODE space only if i can modify the values there (by tricks or something), if not then i'm guessing external RAM is the only way.
i thank you very much for your help forum. still i have much to learn...
CODE space is read-only
"if not then i'm guessing external RAM is the only way"
Unless you get a processor with sufficient internal RAM...
Start with the so-called "bible" for the 8051:
Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf
Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf
Chapter 3 - 80C51 Family Hardware Description: www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf
Here are some other introductory & reference materials: http://www.keil.com/books/8051books.asp www.8052.com/books.phtml www.8052.com/tutorial.phtml
You will need to read the Data Sheet for your particular processor