Keil Logo Arm Logo

Discussion Forum

how to enable xdata in P87C51RD+

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Farhan Arshad
Posted
29-Oct-2004 06:51 GMT
Toolset
None
New! how to enable xdata in P87C51RD+
hi
to use on chip xram of my p87c51RD+. I have made following changes in my code which are recomended here.
http://www.keil.com/support/docs/1758.htm
but my code stuck on this loop.
IDATALOOP:	MOV	@R0,A
		DJNZ	R0,IDATALOOP
regards
Farhan
I have also posted this messege on
http://www.8052.com/forum/read.phtml?id=79977&top=79977
Read-Only
Author
Jon Ward
Posted
29-Oct-2004 07:03 GMT
Toolset
None
New! RE: how to enable xdata in P87C51RD+
That is the loop in the startup code that clears memory. Are you sure the program is STUCK in this loop?

IDATALOOP:	MOV	@R0,A
		DJNZ	R0,IDATALOOP

The DJNZ instruction is a decrement and jump it non-zero. So, if the program is actually STUCK in this look, it means that R0 never decrements down to 0.

Jon
Read-Only
Author
Graham Cole
Posted
29-Oct-2004 14:32 GMT
Toolset
None
New! RE: how to enable xdata in P87C51RD+
This bit of code may fail if the selected register bank is not zero. If, for example, register bank 1 is selected then when R0 is equall to 8 the instruction:
    MOV @R0,A
Will clear R0. The following DJNZ instruction will set R0 to 0xFF and the code will loop forever.
Read-Only
Author
Keil Support, Intl.
Posted
2-Nov-2004 12:51 GMT
Toolset
None
New! RE: how to enable xdata in P87C51RD+
But this code runs after Reset. Reset ensures that the register bank 0 is selected.
Read-Only
Author
Oleg Sergeev
Posted
2-Nov-2004 13:16 GMT
Toolset
None
New! RE: how to enable xdata in P87C51RD+
hi,

Maybe you should use MOVX instead MOV and DPTR instead R0.
http://www.8052.com/forum/read.phtml?id=80001


Regards,
Oleg
Read-Only
Author
mark hickman
Posted
3-Nov-2004 01:24 GMT
Toolset
C51
New! RE: how to enable xdata in P87C51RD+
Hi Farhan,

I am a little unclear as to what your problem(s) is/are.

If you know that you are getting stuck on the loop to clear IDATA, I am suprised as this is tried and tested code and you will not get stuck in an infinite loop even if you start with R0 set to 00h, then why not just set :-
IDATALEN EQU 00H
so this code is not included so you can see if your code gets past this point?

If you ar using the PHILIPS P87c51rd+ then I hope you have not copied verbatim what is shown in "1758.htm" as this quite clearly relates to a diffent chip, so for you chip you should have :-
XDATASTART EQU 00000H
XDATALEN EQU 0300H
to clear the onchip EXTRAM which according to the data sheet is enabled by default. Also you should not include (if you have added it) this line :-
ANL 0B1h, #01h
show in the keil app note.
Alternativly if you want to disable the internal EXTRAM then you should include the following line:-
ORL 08Eh, #02h
which will set the EXTRAM bit within the AUXR register.

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.