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.

Writing to EEPROM

Status
Not open for further replies.

rizzy

New Member
I'm working with a 16F84 and can't get it to store anything in the EEPROM memory. I've followed the instructions exactly (writing 0x55 and 0xAA to EECON2, setting EECON1,WR and so on). It will go through the sequence but nothing will actually be written. While searching the web, I noticed that some people had a "DE" statement at the beginning of their ASM code that declared addresses in EEPROM to be used. Do you have to "activate" the EEPROM mem somehow with a directive or equate?

I'm also a bit curious about the EEPROM addresses; I just assumed that the EEPROM is separate from the RAM banks and has addresses 0x00 to 0x3F that can be sent to EEADR as such. Is this correct, or do they have higher numbered addresses or are in another bank and are mapped?
 

Nigel Goodwin

Super Moderator
Most Helpful Member
rizzy said:
I'm working with a 16F84 and can't get it to store anything in the EEPROM memory. I've followed the instructions exactly (writing 0x55 and 0xAA to EECON2, setting EECON1,WR and so on). It will go through the sequence but nothing will actually be written. While searching the web, I noticed that some people had a "DE" statement at the beginning of their ASM code that declared addresses in EEPROM to be used. Do you have to "activate" the EEPROM mem somehow with a directive or equate?

The DE statement simply stores a list of data, it's nothing to do with writing to the EEPROM. There's nothing you have to do, apart from follow the sequence given exactly.

I'm also a bit curious about the EEPROM addresses; I just assumed that the EEPROM is separate from the RAM banks and has addresses 0x00 to 0x3F that can be sent to EEADR as such. Is this correct, or do they have higher numbered addresses or are in another bank and are mapped?

Yes, they are numbered from 0x00, if you check my tutorials at http://www.winpicprog.co.uk one of the IR tutorials stores data in the EEPROM on a 16F628 - you could check your routine against that.
 

Exo

Active Member
Make sure you didn't forget the bank switch..

EEADR is in bank 0 while EECON1 & 2 are in bank 1.
 

rizzy

New Member
OK. I figured it out. I was just accidentally setting the wrong bit in the option register when switching banks. I didn't check my code over very well. Thanks for the advice.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Top