I am using a Temic 80251 which gives me 1K on board RAM. Is there any way that I can tell the compiler that the IDATA class is bigger than 256 bytes.. because I get an error from the compiler that I have exceeded capacity. Or should I just use the edata class and just watch that I don't allocate above the 1K limit??? Any suggestions appreciated. Thank, Jim
The 1K of internal memory is not idata. idata is the same as the standard 8051 definition. Outside of the 1K internal, access is through the edata segment. You can access the internal 1K segment by defining it as xdata, and providing a data range in the linker. We put the following defines in a model.h, and include it in all source. This allows us to select which physical memory segment we want to place the data into.
#define HUGE huge /* 16 Meg indirect addressing, full access */ #define FAR far /* 16 Meg indirect addressing, in page */ #define NEAR near /* 64k direct and indirect addressing */ #define DATA near /* On-chip data */ #define XDATA near /* was far */ #define FXDATA xdata /* */ #define PDATA /* Paged xdata */ #define CODE far /* */ #define IDATA idata /* */ #define BDATA bdata /* Bit addressable memory */ #define EBDATA ebdata /* Extended bit addressable memory */ #define SBIT sbit #define BIT bit
char XDATA value1; // this goes in edata (near) char FXDATA value2; // this goes in 1K segment (xdata)
CL (XDATA (100h-41fh), & EDATA (8000h-0ffffh),hdata(8000h-0ffffh), & ECODE (0fe0000h-0feffffh), & HCONST (0fe0000h-0feffffh), & ECODE (0ff2080h-0ffffffh), & HCONST (0ff2080h-0ffffffh) ) &
Actually, using XDATA on the 251 forced the compiler and linker to use the MOVX instruction and to use the DPTR. These are horribly inefficient on the 251. You can use the on-chip 1K as NEAR (or EDATA) memory by declaring the variables as NEAR or by using the XTINY or the XSMALL memory models. Jon
Thanks Tom Excellent explaination Jim
Is it possible to place some critical variables, as near memory type, in the on-chip 1K memory, yet other non-critical variables, still declared as near memory type, in the external memory? In other words, how do you explicitly place two variables, both declared as near, into two seperate memory spaces - on-chip 1k and external memory?