Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

EEPROM emulation using Flash?

Status
Not open for further replies.

prabs1976

New Member
I'm looking for a design document on implementing Emulated EEPROM , any links ,tutorials or sample code would be of great help.
 
prabs1976 said:
I'm looking for a design document on implementing Emulated EEPROM , any links ,tutorials or sample code would be of great help.

download PICC trial and there is EX_SLAVE.C that simulates 24LC01 eeprom.

but generally what you need to do is enable i2c and for i2c interrupt setup something like this

Code:
// put some config for your pic
//...

// set this procedure as i2c interrupt
void i2c_interupt ()

{

  BYTE inc, state;


  state = i2c_isr_state();


  if(state < 0x80){ // master sending data


    inc = i2c_read();

    if(state == 1) address = inc;

    if(state == 2) buffer[address] = inc;

  }

  if(state == 0x80){ //master requesting data


    i2c_write(buffer[address]);

  }

}


void main(){
  //enable i2c interrupt
 while(1) {}
}
 
prabs1976 said:
I'm looking for a design document on implementing Emulated EEPROM , any links ,tutorials or sample code would be of great help.

We need the manufacturer and device first. Yes, Microchip does provide Flash to EEPROM implementation. And it all depends on the device. If using flashed based PIC that does not have EEPROM, there are 2 types. Type 1 lets you write to flash at run-time and lets you write to individual random access bytes. Type 2 lets you write to flash at run-time but you must first erase a huge chunk of flash first, and then write to flash. Since a huge chunk is erases this of course raises the flag of "must I first save the chunk". That would be a yes if you want to keep that data and you must be all powerfull enough to know what chunks to access else you will suicide your own code at run-time.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top