??? 02/08/05 10:28 Read: times Msg Score: +1 +1 Good Question |
#86878 - P2:R0 as memory pointer |
Using P2:R0 as external memory pointer.
The system is a 89S8252 with 32k external RAM. PSEN and RD are combined so the RAM is CODE and DATA. The problem is with a program in external RAM. I use P2 as a 'page pointer' (high byte RAM) and R0 as index register(low byte RAM). BUFFERS EQU 7F00h SENDBUF EQU 7F40h RECVBUF EQU 7F80H MOV P2,#(HIGH BUFFERS) MOV R0,#(LOW SENDBUF) MOVX A,@DPTR ; DPTR ^Source LOOP: MOVX @R0,A INC R0 INC DPTR DJNZ R2,LOOP ; R2 Number of bytes RET There is no problem with this routine. Sometimes I want to use another Page (7E00h) I tried the following routine: ORG 6B00h PUSH P2 MOV P2,#7Eh ... ... POP P2 RET The value of P2 (7Fh) is not pushed but instead 6Bh is pushed. (This is the high byte of the programcounter). At the end of the routine P2 contains 6Bh. This could be a way to load a register with the high byte of PC PCh2A: PUSH P2 POP ACC but that's something completely different I solved the problem the following way: ORG 1C00h P2toA: MOV A,P2 ; In Flash RET ORG 6B00h LCALL P2toA PUSH ACC MOV P2,#7Eh ... ... POP P2 RET My question to the members of this forum is: Do you have any experience with problems like this. The use of external RAM as Code and DATA. The role of P2 als high byte of DATA (MOVX) and CODE. Have a nice day Robert |
Topic | Author | Date |
P2:R0 as memory pointer | 01/01/70 00:00 | |
Read the cpu data! | 01/01/70 00:00 | |
P2 readback | 01/01/70 00:00 | |
Re | 01/01/70 00:00 | |
Thank you all | 01/01/70 00:00 | |
Interesting | 01/01/70 00:00 | |
very well described | 01/01/70 00:00 | |
This is NOT in the | 01/01/70 00:00 | |
ch3 pg 6 | 01/01/70 00:00 | |
none of them | 01/01/70 00:00 | |
more | 01/01/70 00:00 | |
An experiment - AT89C8252 | 01/01/70 00:00 | |
not necessarily | 01/01/70 00:00 | |
sure not necessarily | 01/01/70 00:00 | |
talking about memory | 01/01/70 00:00 | |
MOVX multiplexed with P2 SFR data | 01/01/70 00:00 | |
Now I say: HUH | 01/01/70 00:00 | |
huh | 01/01/70 00:00 | |
Thank you | 01/01/70 00:00 | |
what datasheet says | 01/01/70 00:00 | |
I should've RTFM... :-) | 01/01/70 00:00 | |
not too much logic | 01/01/70 00:00 | |
sure | 01/01/70 00:00 | |
The horses mouth | 01/01/70 00:00 | |
horse is plural | 01/01/70 00:00 | |
I'd be happy to ... | 01/01/70 00:00 | |
can't find them | 01/01/70 00:00 | |
As you use to say :)![]() | 01/01/70 00:00 | |
another note | 01/01/70 00:00 |