Hi guys, I'm hoping someone has been here before and can help me out with this. I've got a big pile of code that runs nicely on the AT89C51ED2 chip. But I'm running low on variable space, so thought "hey, I'll use some of that XRAM on the chip".
Er, no you won't Mike. It doesn't want to play.
Just to complicate matters I've got a bit of genuine IO hooked up to the bus (which all works fine), as follows:
xdata volatile ubyte gpcRCBaseAddress[8] _at_ 0x8000;
and I use the eeprom by pretending it's variable memory:
xdata volatile ubyte eepromaddress[2048] _at_ 0x2000;
So, how do I get to use the genuine on-chip XDATA. Just declaring xdata variables doesn't work - the compiler seem to think it's off chip xdata.
If I try to turn XDATA on the hard way: AUXR = 0x11 Then the entire processor appears to slow down to a crawl. It might be that I've disabled the I/O which made everything else slow down, although the chip hanging off the I/O still functions perfectly, just verrrry slowly.
I had a quick play with startup.a51 (not used that before), defining: XRAMEN EQU 1 XDATASTART EQU 0H ; the absolute start-address of XDATA memory XDATALEN EQU 7FFH ; the length of XDATA memory in bytes. Which had no effect whatsoever
And I tried ticking the box in project options for 'Use on-chip XRAM', which just gave me a link error about XDATA: *** ERROR L107: ADDRESS SPACE OVERFLOW SPACE: XDATA SEGMENT: ?XD?READERMAIN
So I'm all out of ideas. Anyone able to help ?
... to enable the (internal) external RAM in (a renamed, modified) STARTUP.a51 or it will not be initialized. what you do does not eneble the XRAM (see the datasheet for what is required)
Erik
Thanks for the response Erik, but which datasheet are you talking about. I've searched Keil's site from top to bottom and can find nothing relating to STARTUP and XRAM on the ED2 chip.
"I've searched Keil's site from top to bottom and can find nothing relating to STARTUP"
What about this, then:
http://www.keil.com/support/man/docs/c51/c51_ap_startup.htm
"XRAM on the ED2 chip."
That would be in the manufacturer's datasheet for the specific chip that you're using.
Thanks Andy. But I said "I've searched Keil's site from top to bottom and can find nothing relating to STARTUP and XRAM on the ED2 chip." The page you found doesn't mention the ED2 chip, so I stand by that comment.
Perhaps I'm being very stupid here, but given that there are specific A51 files for enabling XRAM on other chips, I was thinking that there might be one for the ED2 chip. Or that maybe somebody else would have cobbled one together by now. It's not like it's an unusual or unpopular device - surely somebody must have used XRAM on an ED2 chip before now.
And I've got the manufacturer's data sheet, I know how to turn on XRAM on the chip (as I said in my original post). So I'm no better off for being told to look at it. It clearly won't help with A51 file which appears to be at the root of the problem.
Tempting; very tempting...
"given that there are specific A51 files for enabling XRAM on other chips, I was thinking that there might be one for the ED2 chip"
Apparently not - or not from the Keil website, at least. Have you checked the files installed on your PC? You could try the chip manufacturer to see if they have one...
"I know how to turn on XRAM on the chip"
So you just need to modify you startup.a51 file so that it does that!
That should be "your startup.a51 file...", of course!
eg, see:
http://www.keil.com/support/docs/610.htm
and other links