The information regarding the EEPROM is minimal in the manual and you will need to go into the datasheets to get a bigger picture (as is the case for pretty much everything). This post is just to add to the stuff the manual is missing, so that you do not have to go searching through the datasheet.

 

First off, the datasheet itself uses VALUE and ADDR as registers to contain the data it would like to store. If you implement the code as is, it will not work. You will need to recognize that VALUE and ADDR will probably be stored in bank0 (if you used EQU 0x20 for example). So you can either place VALUE and ADDR in bank2 (because you will be working in bank2 every time you need to use these two variables) or you will need to make sure to select bank0 when using commands like movf VALUE,w and then switch back to bank2 when using commands like movwf EEDATA.

 

Second, the manual has missed the following:

movlw 0x55
movwf EECON2
movlw 0xAA
movwf EECON2
bsf EECON1,WR  ;this line is missing in the manual

where this last line actually performs the write instruction.

After this last instruction, you can clear the WREN and reenable interrupts.

Views: 59

Comment

You need to be a member of Personal Mechatronics Lab to add comments!

Join Personal Mechatronics Lab

© 2024   Created by PML.   Powered by

Badges  |  Report an Issue  |  Terms of Service