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.
Cross-posting from http://www.8052.com/forum/read.phtml?id=27259&top=27260 A while back, Jon Ward wrote: "You COULD do this [access a 'C' array in an I2C device] with the Keil tools specifying the I2C EEPROM as RAM in the far memory area. The PK51 kit allows you to create your own assembler code that reads and writes bytes in "special" memory areas. You can declare variables as far and access this memory from C. "Note that this was originally called XDATA banking, but, in fact, you can use this technique to access any memory type." http://www.8052.com/forum/read.phtml?id=24473 My question is: can you implement multiple different sorts of far memory in the same system? eg, could I both use far as above to access 'C' variables in an I2C device and also to provide "conventional" banked access to >64K of parallel SRAM?
I'm sorry about the Thread Title in the Thread list; it was supposed to be Accessing "Special" Memory with 'FAR', but the forum software seems to have been confused by the double-quotes :-(
My question is: can you implement multiple different sorts of far memory in the same system? eg, could I both use far as above to access 'C' variables in an I2C device and also to provide "conventional" banked access to >64K of parallel SRAM? Yes. Think of it this way...the C51 compiler supports a virtual 24-bit address space that is broken down into RAM (000000-7FFFFF) and ROM (800000-FFFFFF). A typical 8051 maps into this virtual space as follows:
000000-00007F DATA/IDATA 000080-0000FF IDATA 000100-00FFFF unavailable 010000-01FFFF XDATA 020000-7FFFFF unused 800000-FDFFFF unused FE0000-FE00FF PDATA FE0100-FEFFFF unavailable FF0000-FFFFFF CODE
000000-00007F DATA/IDATA 000080-0000FF IDATA 000100-00FFFF unavailable 010000-01FFFF XDATA 020000-05FFFF SRAM 060000-7EFFFF unused 7F0000-7FFFFF I2C RAM 800000-FDFFFF unused FE0000-FE00FF PDATA FE0100-FEFFFF unavailable FF0000-FFFFFF CODE
the forum software seems to have been confused by the double-quotes Actually, it was the preview that got confused. It is now fixed. Jon