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

Write/Read Flash into W77e58

I'm trying to write and read internal RAM with w77e58 but without success.

I'm using the following code.

#include<string.h>
#include<W77E58.h>


unsigned char xdata xdata_buffer [1];


void main(void){
TA = 0xAA; /*W77e58 Time Accessed Functions*/
TA = 0x55;
memcpy (xdata_buffer, "2", sizeof (xdata_buffer));
}

It does not work.

Any suggestion?

Thanks in advance.

Parents
  • Sorry, I'm not explain my problem well because I just started to use microC few months ago.

    I'm creating an application that need some configuration parameters that I would like to store in a non volatile memory area in order to read it or save it as default configuration.

    I made some test using AT89S8252 from Atmel with this code a I have no problem,

    /*
    * Return EEPROM Byte at address 'adr'
    */
    unsigned char ReadEEPROM (unsigned int adr) {
    unsigned char v;

    WMCON |= EEMEN_; // enable EEPROM
    v = XBYTE[adr]; // read value
    WMCON &= ~EEMEN_; // disable EEPROM
    return (v);
    }


    /*
    * Write EEPROM Byte 'val' at address 'adr'
    */
    void WriteEEPROM (unsigned int adr, unsigned char val) {
    WMCON |= (EEMEN_ | EEMWE_); // enable EEPROM and set write bit
    XBYTE[adr] = val; // write value
    while ((WMCON & EERDY_) == 0); // wait until value programmed
    WMCON &= ~(EEMWE_ | EEMEN_); // disable EEPROM and write strobe
    }

    What I want to use is the Winbond W77E58 non volatile memory to store the configuration values.

Reply
  • Sorry, I'm not explain my problem well because I just started to use microC few months ago.

    I'm creating an application that need some configuration parameters that I would like to store in a non volatile memory area in order to read it or save it as default configuration.

    I made some test using AT89S8252 from Atmel with this code a I have no problem,

    /*
    * Return EEPROM Byte at address 'adr'
    */
    unsigned char ReadEEPROM (unsigned int adr) {
    unsigned char v;

    WMCON |= EEMEN_; // enable EEPROM
    v = XBYTE[adr]; // read value
    WMCON &= ~EEMEN_; // disable EEPROM
    return (v);
    }


    /*
    * Write EEPROM Byte 'val' at address 'adr'
    */
    void WriteEEPROM (unsigned int adr, unsigned char val) {
    WMCON |= (EEMEN_ | EEMWE_); // enable EEPROM and set write bit
    XBYTE[adr] = val; // write value
    while ((WMCON & EERDY_) == 0); // wait until value programmed
    WMCON &= ~(EEMWE_ | EEMEN_); // disable EEPROM and write strobe
    }

    What I want to use is the Winbond W77E58 non volatile memory to store the configuration values.

Children