Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 26th January 2004, 12:41 AM   (permalink)
Default Writing to EEPROM

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?
rizzy is offline  
Reply With Quote
Old 26th January 2004, 05:47 AM   (permalink)
Default Re: Writing to EEPROM

Quote:
Originally Posted by rizzy
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.

Quote:
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.
Nigel Goodwin is offline  
Reply With Quote
Old 26th January 2004, 12:30 PM   (permalink)
Default

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

EEADR is in bank 0 while EECON1 & 2 are in bank 1.
Exo is offline  
Reply With Quote
Old 27th January 2004, 04:00 AM   (permalink)
Default

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.
rizzy is offline  
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 10:15 PM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.