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.
Jon, I tried that example you gave me, and it didn't seem to work. I think there may be problems with the development kit. David
Opps, I gave the wrong page size before, It should be should be 16k. #define PAGESZ 0x4000 Another idea: You can use plain old "xdata variables", if you do not need "xdata mapped IO" or more than 64k of RAM. Just use:
PageType = 0; //all page banks are ram PageFor4000 = 0x1; // 0_4000 to 0_7FFF PageFor8000 = 0x2; // 0_8000 to 0_BFFF PageForC000 = 0x3; // 0_C000 to 0_FFFF
I did try this: PAGETYP = 0x14; PAGEA = 0x01; PAGEB = 0x01; PAGEC = 0x00; Hardcode the pages, but it didn't work, the problem is that the first segment is actually code. So when i used the BL51 locate options and set xdata 0xc000-0xffff it seem to work. However i can't seem to set this in the target section, it complains about it being out of range. The other thing is that i have defined a few larger buffers and now the Error L105 and L107 are appearing. This is with it set to 0xc000-0xffff. Total buffers around 20k. David
I tried that change and it seemed to work. thanks for that code, its a big help. David
Try this for 8k of code and 24k of xdata. Note there are 2 "hidden registers" you can not change:
// "PAGETYP0 = ROM" // "PAGE0 = 0x0"; // 0_0000 to 0_3FFF
PAGETYP = 0x15; //pages A,B,C are ram (not 0x00 or 0x14) PAGEA = 0x1; // 0_4000 to 0_7FFF PAGEB = 0x2; // 0_8000 to 0_BFFF PAGEC = 0x3; // 0_C000 to 0_FFFF
EPROM#1: start 0x0000 size 0x4000 RAM#1: start 0x4000 size 0xC000
I tried 0xefff and it is happy there but for some reason doesn't like 0xffff. 0x14 was from one of there examples i was playing around with. Question: the datasheet says 128k rom and 128 ram. Does this mean that total space is 128k and i'm just breaking it up into segments and defining the types? So i can have 64k ROM and 64k RAM? Also if i'm using only 128k then i really on need one page register? ie PageA and the others are for larger memory spaces. In this case its just memory fold over right? David
Sorry i stand corrected, i can use 0x4000 to 0xc000 ok but i cannot use 0x4000 to efff. For some reason i can put in 0x0000 to efff. Doesn't make sense. This has become quite a difficult exercise, i just want to access 64k of RAM. David
Try 0x0000 to 0xFFFD. The compiler needs a null pointer and a one beyond pointer.
There are 4 memory spaces: Phyical Size Logical Physical Internal RAM: RAM data/idata space = 1024 Bytes 00:FF 0_00:3_FF External ROM: PROGRAM code/xdata(ROM) space = 64/128 kBytes 0000:FFFF 00_0000:1_FFFF External RAM: RAM xdata(RAM) space = 32/128 kBytes 4000:FFFF 00_0000:1_FFFF CGROM xdata(RAM) space = 256 kBytes 4000:FFFF 20_0000:23_FFFF External IO: I/O xdata(I/O) space = 32/128 kBytes 4000:FFFF 00_0000:3F_FFFF //************* //************* //Lets keep thing simple, the only RAM we'll swap are the buffers. //Given: // 128k code, 128k ram, 0 IO, 20k buffers required, memory for the program will fit into data/idata space. //************* //data/idata mapping: // just use 1 bank, program is complicated enough. //************* xdata mapping: 0000:3FFF => Program, 128k = 16 banks of 8k 4000:FFFF => Buffer, 128k = 5 banks of 24k, 1 bank of 8k PAGETYP = 0x15; //Pages A-C are ram //BufId = 0 to 5 #define SETBUFFER(BufId) ( PAGEA = (BufId)*3, PAGEB = (BufId)*3+1, PAGEC = (BufId)*3+21 ) #define BUFFERSIZE = 0xC000; BYTE xdata pBuffer = 0x4000; // No other xdata variables can be used // If you need other xdata variables, you will need to break up the 20k buffers into 16k or 8k chunks.
Hi Jon, Also under the target section i cannot set xdata from 4000-FFFF it complains about it being out of bounds. If i use the BL51 tab i can but there are no options for code banking etc. I don't quite understand what you were trying to do with SETBUFFER in the example. Here is some info on how the creators of the device tend to use it. David ------------------------------------ You would need to set the paging registers manually. Basically, each of the 3 16K segments of the logical address (from 0x4000 to 0xFFFF) can be used to access a corresponding 16K segment of a 128K RAM chip or a 128K ROM chip via the paging method. In most typical applications, what we would suggest is to allocate a fixed section (say page 0) for global variables and the rest to be accessible by paging methods. You would then set one 16K segment, (in our case, we have used C000 to FFFF (Page C)) for xdata and set it to point to page 0 of the RAM chip. Then you might use another 16K segment (say segment B) to access the rest of the RAM chip, using Page 1 to Page 7, since Page 0 is already dedicated to global variables. The last section, segment A can then be used for code banking within the 128K range of the ROM chip. In this case, you would then restrict code banking to the range 0x4000 to 0x7FFF, and tell your compiler to switch banks using this range. In this way, the PAGE_TYPE SFR would be set to: segment C B A 00 01 01 00. where segment C and B is Ram and segment A is Rom. PageC register would be permanently set to 0 for the lowest 16K segment of the RAM chip. PageB would be set in your program to switch between banks 1 to 7. You probably need a memory manager routine to handle this. PageA would be set by your compiler to handle code banking.
Also under the target section i cannot set xdata from 4000-FFFF it complains about it being out of bounds. If i use the BL51 tab i can but there are no options for code banking etc. Note that the second parameter is SIZE and not ENDING address. The size of the XDATA range (from 4000-FFFF) would be 0xC000. Jon