The SFR area is between 0x80 and 0xFF, also the Upper RAM area is between 0x80 and 0xFF. I can access the SFR using direct addressing and the Upper RAM using indirect addressing. My question: are the SFR and Upper RAM physically 2 different memorys? If I use all of the SFR registers can I also use the Upper RAM memory (both have the same address area)? (overwrite data) data crash? Thanks
Memory areas are different. You can use all SFR's as well as the complete area in the address range from 0x80 to 0xff. However, access to the data memory is possible only if it is declared as IDATA. In ASM you have to use indirect addressing modes using r0 or r1 as a pointer to the data memory (i.e. mov a,@r0; ...). HHK
My question: are the SFR and Upper RAM physically 2 different memories? Yes. If I use all of the SFR registers can I also use the Upper RAM memory (both have the same address area)? (overwrite data) data crash? No, you will not crash. Just like when you do a movc from address 0x4000 you get what's in CODE (PROM) space not what's in XDATA space (SDRAM). MOV direct above address 0x7F selects the SFR memory map and since there are no SFR's below 0x80 Intel was nice enough to allow this access method to give us fast access to internal RAM. MOV indirect from 0 - 0xFF wil select the IDATA memory. MOVX selects XDATA memory from address 0 to 0xFFFF MOVC selects CODE memory from address 0 to 0xFFFF - Mark
MOVX selects XDATA memory from address 0 to 0xFFFF ... and just in case you were wondering where PDATA fits into all this: MOVX @DPTR gets its 16-bit (0..FFFF) XDATA address from the DPTR; MOVX @R0 or MOVX @R1 gets the low 8-bits (0..FF) R0 (or R1), and the high 8-bits from P2 - this is known as PDATA ('P' for "Paged") Thus PDATA and XDATA are not inherently separate memory spaces.
Shh. Don't bring up pdata. That's our little secret :-). - Mark
The next thing I know, you guys will be talking about SMALL memory model and moving big variables and buffers into XDATA. Jon