• AVR Freaks

Programming EEPROM with MPLAB IPE?

Author
Jungle Jim
Starting Member
  • Total Posts : 40
  • Reward points : 0
  • Joined: 2009/11/20 10:03:16
  • Location: Salisbury, U.K.
  • Status: offline
2018/10/14 04:54:33 (permalink)
0

Programming EEPROM with MPLAB IPE?

Using PIC16F884, programming in assembly, using MPLAB X IDE v4.05 and IPE V4.05, with ICD 3.
 
Can anyone explain in simple (for those of us who are hard of thinking!) how I can program the EEPROM on a PIC16F884? I've spent 2 hours going through the forums, I've even read the IPE help files (which in my case, weren't any help).
 
I understand I have to do something extra to make the IPE program the Eeprom. I have read that I may have to generate (modify?) a hex file or use SQTP. The help on SQTP does not really explain what it does, or how to use it. I can't find out what I need to do to modify the hex file.
 
I have a simple need. I wish to program some default parameters into the Eeprom during programming. These parameters are editable by the user once they install our machine but I wish to give them sensible starting values. All EEprom locations defaulting to FFh means all settings are at maximum and every possible option is enabled. As there are 180 settings somebody has to do a lot of button pressing to set them up initially. These default values are the same for all machines so i might as well program them at the same time as programming the code into the chip.
 
I am aware that the alternative is to write extra code that allows the code itself to generate and write all these at start-up but that is not the way I want to do it. I see it is extra code, extra overhead and unnecessary.
 
Any help or pointers would be much appreciated.
#1

8 Replies Related Threads

    mbrowning
    USNA79
    • Total Posts : 1565
    • Reward points : 0
    • Joined: 2005/03/16 14:32:56
    • Location: Melbourne, FL
    • Status: offline
    Re: Programming EEPROM with MPLAB IPE? 2018/10/14 05:41:23 (permalink)
    0
    Have you read the XC8 manual? It documents how to initialize eeprom or create eeprom variables

    Go Navy! Beat Army!
    #2
    1and0
    Access is Denied
    • Total Posts : 10005
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Programming EEPROM with MPLAB IPE? 2018/10/14 05:54:57 (permalink)
    0
    Jungle Jim
    Using PIC16F884, programming in assembly, 

    https://www.microchip.com/forums/m1069618.aspx#1069641
     
    Look at Posts #2 and #7.
    #3
    mbrowning
    USNA79
    • Total Posts : 1565
    • Reward points : 0
    • Joined: 2005/03/16 14:32:56
    • Location: Melbourne, FL
    • Status: offline
    Re: Programming EEPROM with MPLAB IPE? 2018/10/14 10:27:15 (permalink)
    0
    C is sorta assembly :)

    Go Navy! Beat Army!
    #4
    mbrowning
    USNA79
    • Total Posts : 1565
    • Reward points : 0
    • Joined: 2005/03/16 14:32:56
    • Location: Melbourne, FL
    • Status: offline
    Re: Programming EEPROM with MPLAB IPE? 2018/10/14 10:27:16 (permalink)
    0
    Duplicate

    Go Navy! Beat Army!
    #5
    vkalyan
    New Member
    • Total Posts : 27
    • Reward points : 0
    • Joined: 2016/02/15 22:26:47
    • Location: 0
    • Status: offline
    Re: Programming EEPROM with MPLAB IPE? 2018/10/14 22:44:20 (permalink)
    0
    Jungle Jim
     
    I wish to program some default parameters into the Eeprom during programming.

     
    For this your hex file should already contain all those parameters in the EEP region such that it gets programmed when you load the hex in IPE.
     
    As an alternative to this I can suggest you to edit the memory locations by opening the EEP memory view in IPE. Before this step I assume that you would anyway be generating your application hex. Later insert your settings parameters at the desired address locations in the EEP memory. Now program the device and verify if everything is as expected.
    post edited by vkalyan - 2018/10/14 22:51:40
    #6
    Jungle Jim
    Starting Member
    • Total Posts : 40
    • Reward points : 0
    • Joined: 2009/11/20 10:03:16
    • Location: Salisbury, U.K.
    • Status: offline
    Re: Programming EEPROM with MPLAB IPE? 2018/10/16 01:57:09 (permalink)
    0
    Thanks vkalyan, that pointed me in the right direction.
     
    I programmed a device, setup all the parameters by operating the machine, then read back the code and EEprom from the device using IPE. I saved that as a hex file, and now when I use that hex file it pre-programs the EEprom with my default values :-)
     
    Edit:
    And thank you 1and0.
    I assumed that your post was also to do with C so didn't look at the link until I had tried vkalyan's method. I went back afterwards to check and I find that with a bit of experimentation I can define the EEprom bytes in the source code. Bizarrely, they do not seem to appear in the hex file for IPE to use, but if I use MPLAB to program the device for Production, it programs the EEprom just fine.
    post edited by Jungle Jim - 2018/10/16 02:41:25
    #7
    1and0
    Access is Denied
    • Total Posts : 10005
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Programming EEPROM with MPLAB IPE? 2018/10/16 02:10:45 (permalink)
    0
    Jungle Jim
    As there are 180 settings somebody has to do a lot of button pressing to set them up initially. 
    ...
    I programmed a device, setup all the parameters by operating the machine, then read back the code and EEprom from the device using IPE. I saved that as a hex file, and now when I use that hex file it pre-programs the EEprom with my default values :-)

    Wow, must be a lot a button pressing. grin: grin
     
    #8
    1and0
    Access is Denied
    • Total Posts : 10005
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Programming EEPROM with MPLAB IPE? 2018/10/16 07:31:48 (permalink)
    4 (1)
    Jungle Jim
    I assumed that your post was also to do with C so didn't look at the link until I had tried vkalyan's method. I went back afterwards to check and I find that with a bit of experimentation I can define the EEprom bytes in the source code. 

    So that one click on that link could had saved you how much time? 
     
    #9
    Jump to:
    © 2019 APG vNext Commercial Version 4.5