This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

help WR_RD in the flash data memory code about the P89C51RD2

Now I want to read and write data in the flash data memory about the Philips 89C51RD2,as the eeprom function.
with its document,I write some test code:

void Flash_WR_RD()
{
AUXR1 = 0x01;//use the DPTR1

R0 = 25; //25MHz in board
R1 = 0x0c; //erase 4k blocks
DPH = 0x00; //block #0
DPL = 0x00;

R0 = 25;
R1 = 0x0d;//program data block
DPH = 0x08;
DPL = 0x00;
ACC = 0x10;

R0 = 25;
R1 = 0x0e;//read data block
DPH = 0x08;
DPL = 0x00;

AUXR1 = 0x00;//use DPTR0
}

But I haven't get any data what I want in memory. I don't know how can I get what I want--program store in some memory; and the data store in another area,which can read and write correct. To me some suggest,thanks.

Parents
  • oh,thanks a lot.
    maybe the R0 and R1 is the sram bank address from 00 to 38?,if so,how to define and access data?and I define:
    sfr R0 = 0xA0;
    sfr R1 = 0x80;

    And I use the parallel ways to debug,the microcontrol requires to download code using programmer such as lab-48.So I don't know how to call the IAP procedure,Could you give me some more suggestion?if can,send me some documents and example c-code about the flash data writing and reading.thanks again.
    my email:denglj@gzjpg.com

Reply
  • oh,thanks a lot.
    maybe the R0 and R1 is the sram bank address from 00 to 38?,if so,how to define and access data?and I define:
    sfr R0 = 0xA0;
    sfr R1 = 0x80;

    And I use the parallel ways to debug,the microcontrol requires to download code using programmer such as lab-48.So I don't know how to call the IAP procedure,Could you give me some more suggestion?if can,send me some documents and example c-code about the flash data writing and reading.thanks again.
    my email:denglj@gzjpg.com

Children
  • a couple of comments:
    You start off erasing block 0 - where is your code?

    download code using programmer such as lab-48

    Why not use the best FlashMagic especially since it is free?

    Erik

  • I just realized that the problem may be more fundamental
    Now I want to read and write data in the flash data memory about the Philips 89C51RD2,as the eeprom function.

    1)there is no flash data memory, there is only flash code memory.

    2) there is no EEPROM (the Atmel Rx2, I believe has a small one).

    Erik

  • Why not use the best FlashMagic especially since it is free?

    Because I have not use the serial port(the TXD and RXD pin hasn't used),so I can't use the flashmagic.

    Now I want to read and write data in the flash data memory about the Philips 89C51RD2,as the eeprom function.

    yes,I think so,as the document said,but maybe not really correct. I will use the Atmel 89 serial,but I would like to use the philips 89-cpu,as the eeprom function.
    of course,the document's description isn't clearness,so maybe difficult for implement the function.