WRITECODE or not????


Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Mar 2006
    Location
    China
    Posts
    266

    Default WRITECODE or not????

    Hi,

    This might seem as a strange thing to do but I want to write to the program memory i.e as a Bootloader would do. I have located my code so it will not be overwritten but I get some weird results. So i decided to try this simple code that is put away far from my target write adresses. All variables are defined as Words.

    for i =0 to 31 step 2
    flash=i
    temp=$ABCD
    WRITECODE flash,temp
    next i
    HSEROUT ["DONE",10,13]
    pause 2000
    stop

    Every time I run it I get a small printout "DONE" . Then I readback the code into MPLAB using Programmer->READ and look in the Program Memory window. The thing is that I can write to ANY address and get the correct value stored EXCEPT if I write to adr $0000, $0002 and $0004. These adresses only accepts $0000 as value if they will store it right. If I use $ABCD as value it looks like this in the Program memory readback:

    0000: 2A04
    0002: AB40
    0004: A044
    0006: ABCD
    and the rest are ABCD as expected.

    Other values give similar results and sometimes adr $0004 reads back OK but never 0000 and 0002 if I don't write 0000 to them.

    Anyone? Any guess?
    The PIC is a 18F4620 and no code protection and Tablewrite fuses are OFF. Neither manual (PBP or 18F4620) mentions anything about this from what I can see.

    This is killing my project for the moment, I would be very happy if someone could come up with any ideas and answers.

    I also printed the values stright from the PIC using READCODE and they show the same as MPLAB, so it is not a MPLAB problem!

    best regards

    /me
    Last edited by Jumper; - 17th August 2006 at 10:38.

Similar Threads

  1. Bootloader For 18F4520
    By isaac in forum mel PIC BASIC Pro
    Replies: 36
    Last Post: - 24th March 2010, 17:56
  2. WRITECODE, ERASECODE, and interrupts
    By RussMartin in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 6th March 2010, 02:46
  3. WRITECODE stores wrong 14-bit word values in FlashMEM
    By BobPigford in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 26th June 2009, 04:35
  4. Can anyone help me to use Writecode for pic18f458 ?
    By dip1 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 28th June 2006, 22:29

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts