Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC18f45k22 eeprom data storage

Status
Not open for further replies.

AlexMountain

Newbie level 3
Newbie level 3
Joined
Jun 5, 2014
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
24
Hey guys, i have question regarding PIC18f45k22 eeprom.

First off, I can read and write data to eeprom successfully.
I need to keep some config data in the eeprom which will be there even if i reprogram the chip.

When i put new code into my PIC, it also erases the eeprom. Is there a way around this?
I have tried to write protect eeprom using #pragma config WRTD = ON
but once flashed, eeprom is empty
Thanks.
 

Thanks, it is in the Project Properties.
How i did it: right click on the project in the left window, Properties, go to PicKit3, first select Manually select memory and ranges, enable EEPROM programming and select Preserve EEPROM. Then select back to Allow Pickit3 to select memories. I don't think the Preserve EEPROM selection is enough.
 

Hi,

Why don't you program your key EEProm data from within your program code ?

Not sure on the exact instructions for C but this assembler example should give you an idea.
I use it all the time to hold default values.
Code:
;------------------------------------------------------------------------------

DATAEE    ORG  0xF00000 ; Starting address for EEPROM for 18F46K22

    DE    "MCHP"        ; Place 'M' 'C' 'H' 'P' at address 0,1,2,3

;------------------------------------------------------------------------------
 

Thanks for the info.
I'll probably end up having 2 versions of code, one with a subroutine to load all my config. values into EEPROM and the actual program code.
I needed to do this so i can update the firmware on my units in the field without losing the config. values which are unique to each device.
Thanks again!
 

I don't think the Preserve EEPROM selection is enough.
I think it is. I should take preference over EEPROM initialized in your hex file. I can't say particularly for PICkit 3, but I'm using the setting with ICD and RealICE. In so far you won't need different flash images. For simplicity I prefer to have a single flash image that can be used for initial factory programming as well as field updates.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top