| ??? 10/01/01 18:14 Read: times |
#15325 - RE: Confusion on register addressing |
Mohammad,
I was waiting for more replies as i am not sure of the exact question you raise but let's see if i bring more light or more confusion. 8051 has internal ram. The locations from 0 to 1FH can be used as both as memory store and named registers. Since there are only 8 registers these 32 memory locations "swap in" 8 at a time. You select these banks using 2 bits in the PSW (RS1-RS0) rule is: RS1-0= "00" r0-r7 = 00H-07H (BANK 0). RS1-0= "01" r0-r7 = 08H-0FH (BANK 1). RS1-0= "10" r0-r7 = 10H-17H.(BANK 2). RS1-0= "11" r0-r7 = 18H-1FH.(BANK 3). After CPU RESET the PSW has RS1-0=0 thus Bank0 is in place. If you do not want to "swap in" other banks then use locations 8-1FH as general ram. It is common to "swap in" new regs for interrupt or other "context changes" as it can allow fast event processing and less "house-keeping". Note that no matter which reg bank is in place you place your current reg onto the stack using "PUSH ARx" i.e. PUSH AR7. You can still access these locations normally allowing communication between background and foreground to occur. One last, since the PSW has the reg bank select bits you can determine which bank is currently executing so you can switch and restore easily. (a godsend for folks who prog'd the old Z80 which could switch regs but you couldn't know which were in place). sorry for the length. regards, p |
| Topic | Author | Date |
| Confusion on register addressing | 01/01/70 00:00 | |
| RE: Confusion on register addressing | 01/01/70 00:00 | |
| RE: Confusion on register addressing | 01/01/70 00:00 | |
| RE: Confusion on register addressing | 01/01/70 00:00 | |
RE: Confusion on register addressing | 01/01/70 00:00 |



