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

How to write data in Flash data memory?

Dear Sir,

I am using ADUC841 microcontroller from Analog devices,which consists of 8052 core.In this it is having 4Kbytes of Flash data memory.I wrote the routines as mentioned in application note for writing the data in Flash.But the data is not storing in Flash.So,please send me some guidelines for writing the data in Flash.

Thanking you,

Yours sincerely, Shivakumar Manda

Parents
  • Look at followed example. It works on ADuC847.

    // ****************************************************
    // save 4 bytes to addr 0x3FF
    // ****************************************************
    void SaveSetPointToFlash(unsigned char* puc)
    {
     EA = 0;          // Disable interrupts before saving
     EADRH = 0x03;    // High byte of page Address
     EADRL = 0xFF;     // Low byte of page Address
     EDATA1 = puc[0]; // Data to flash
     EDATA2 = puc[1]; // Data to flash
     EDATA3 = puc[2]; // Data to flash
     EDATA4 = puc[3]; // Data to flash
     ECON = 0x05;     // Erase Page
     ECON = 0x02;     // Write Page
     ECON = 0x04;     // Verify Page
     EA = 1;          // enable interrupts after saving
    }
    


    As notes Christoph you should provide erasing page and remove delays.

Reply
  • Look at followed example. It works on ADuC847.

    // ****************************************************
    // save 4 bytes to addr 0x3FF
    // ****************************************************
    void SaveSetPointToFlash(unsigned char* puc)
    {
     EA = 0;          // Disable interrupts before saving
     EADRH = 0x03;    // High byte of page Address
     EADRL = 0xFF;     // Low byte of page Address
     EDATA1 = puc[0]; // Data to flash
     EDATA2 = puc[1]; // Data to flash
     EDATA3 = puc[2]; // Data to flash
     EDATA4 = puc[3]; // Data to flash
     ECON = 0x05;     // Erase Page
     ECON = 0x02;     // Write Page
     ECON = 0x04;     // Verify Page
     EA = 1;          // enable interrupts after saving
    }
    


    As notes Christoph you should provide erasing page and remove delays.

Children
No data