We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I've read about XBanking and have some questions. Assume that I have 128MB of XRAM and I want to separate it to 4 pages, 0-0x7FFF,0x8000-0xFFFF,0x10000-0x17FFF and 0x18000-0x1FFFF. I use P1.6 and P1.7 for select pages. - When I declare far variable, how can I choose which page does this variable stored? - How to config the values of P1.6 and P1.7 for select pages? I've tried to read all C51.pdf, A51.pdf, XBanking.A51 files and informations in this site also but I can't find detail about this so I decide to ask in this forum. Thank you very much.
Thank you very much. Sorry for my mistake, I use only P1.7 for select page. A few months ago I use 256KB of XRAM so sometimes I confuse a little. I agree that XDATA is much more faster than far vairiable. But in some cases I think far variable is more convenient and make source code simpler. So I would like to learn it. With your advices, now I can config XBanking.A51 for select page with P1.7. But I still can't fix page of variables. With my example that have 4 pages. If I declare unsigned char far myvar; I can't know which page it will be. In my project, I use some memories for general and some memories for some big databases. And I would like to separate it to many pages but don't like to fix address of each variable. I think that if I have RAM more than 256KB then fixing the page of variable is needed. But now I use only 128KB so I think I can use your method that use xdata for one page and far for another page. Thank you for your help. :)
You may define USERCLASSES for this. In this way you may split variables easily accross various regions. The technique is shown in: http://www.keil.com/support/docs/2670.htm and can be basically used for all types of memory. We also used it in the example under: Keil\c51\Examples\FarMemory\3 XData Areas on T89C51RD2