• AVR Freaks

Hot!Flash Program Memory on PIC16F1768 causing crashes?

Author
didierleplae
Super Member
  • Total Posts : 194
  • Reward points : 0
  • Joined: 2019/03/31 16:57:50
  • Location: 0
  • Status: offline
2020/09/30 15:35:40 (permalink)
0

Flash Program Memory on PIC16F1768 causing crashes?

I've am trying to use the FPM on a PIC16F1768. I am currently experiencing a problem where after I have data to the FPM and power off the PIC and power it back on, the PIC seems to be crashed and doesn't do anything until I reprogram it.
 
Has anyone experienced this or have an idea of what is going on here?
#1

8 Replies Related Threads

    ric
    Super Member
    • Total Posts : 28660
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Flash Program Memory on PIC16F1768 causing crashes? 2020/09/30 16:36:34 (permalink)
    0
    It sounds like you are over writing some of your code.
    What address are you writing to?
    Have you done anything to make sure there is no code there?
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    didierleplae
    Super Member
    • Total Posts : 194
    • Reward points : 0
    • Joined: 2019/03/31 16:57:50
    • Location: 0
    • Status: offline
    Re: Flash Program Memory on PIC16F1768 causing crashes? 2020/09/30 18:48:51 (permalink)
    -1 (1)
    No, I was not even aware that was possible. That makes sense! Oh thank you!
    #3
    didierleplae
    Super Member
    • Total Posts : 194
    • Reward points : 0
    • Joined: 2019/03/31 16:57:50
    • Location: 0
    • Status: offline
    Re: Flash Program Memory on PIC16F1768 causing crashes? 2020/10/01 12:59:13 (permalink)
    0
    Through some trial and error I found an area that seems to work. But how can I check which addresses are being used? Does the program memory start at 0x000 and go up from there? 
    I tried writing to the upper most rows and seemed to have a problem.
    My program currently uses 0xAFD. 
    I am writing to 0xAD0 thru 0xB40 without problems.
     
    #4
    ric
    Super Member
    • Total Posts : 28660
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Flash Program Memory on PIC16F1768 causing crashes? 2020/10/01 13:18:32 (permalink)
    0 (2)
    XC8 uses both the top and the bottom of code memory.
    You can look in the <projectname>.map file it outputs to see where everything is.
    You can edit the compiler settings in the project properties to reduce the highest address it will use, so as to save that for yourself.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #5
    Mysil
    Super Member
    • Total Posts : 3796
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: Flash Program Memory on PIC16F1768 causing crashes? 2020/10/01 13:42:14 (permalink)
    +2 (2)
    Hi,
    The report file from the linker have all that information.
    it have a name something like 'projectname'.map
    It is in one of the subdirectories created by MPLAB.
     
    One way is to declare a const array with the size and address of the area to be reserved,
    using  __at(address)
    There is a section about this in C Compiler User's Guide:
    4.5.4.2 ABSOLUTE OBJECTS IN PROGRAM MEMORY
     
    When such an area is declared, the linker will know, and avoid overwriting.
    There may be a side-effect that Linker may want to initialize or clear such an area.
    You may try with something like:
    extern const int  Dummy[0x70]   __at(0xAD0)
     
        Mysil
    #6
    didierleplae
    Super Member
    • Total Posts : 194
    • Reward points : 0
    • Joined: 2019/03/31 16:57:50
    • Location: 0
    • Status: offline
    Re: Flash Program Memory on PIC16F1768 causing crashes? 2020/10/01 16:39:55 (permalink)
    0
    ric
    You can edit the compiler settings in the project properties to reduce the highest address it will use, so as to save that for yourself.

    I'm not finding this in the project properties. Under "XC8 Compiler"?
    #7
    ric
    Super Member
    • Total Posts : 28660
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Flash Program Memory on PIC16F1768 causing crashes? 2020/10/01 16:55:21 (permalink)
    +3 (3)
    Sorry, I was grouping the compiler and linker together.
    It's actually under
    "XC8 Global Options", "XC8 Linker", "Memory model", "ROM ranges".
     
    Click on "ROM ranges", then read the "Option Description" box below to learn how to use it.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #8
    didierleplae
    Super Member
    • Total Posts : 194
    • Reward points : 0
    • Joined: 2019/03/31 16:57:50
    • Location: 0
    • Status: offline
    Re: Flash Program Memory on PIC16F1768 causing crashes? 2020/10/05 16:48:10 (permalink)
    0
    Thanks!
     
    #9
    Jump to:
    © 2020 APG vNext Commercial Version 4.5