Writing to Program code space using Writecode command.A


Results 1 to 4 of 4

Threaded View

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


    Did you find this post helpful? Yes | No

    Default Re: Writing to Program code space using Writecode command.A

    So You have a few problems in your code but you need to read the datasheet carfully and understand what options you have.

    You must erase before you can write a new value to the chip.

    PBP supports block erase and block write but not the ONE WORD write support this device has.


    If you do block block write you must write the variables you want to change + dummy writes to complete an entire block and THEN the flash is written.

    Read all of chapter 7 in the datasheet especially the Notes in the right side of page 109.

    It is not that hard as it seems but it is way more complicated than an EE-prom and remember you can only get 10 000 writes to the flash.. compared to 1 million if you use a standard external Microchip EEprom



    Chapter 7.0 in the datasheet

    The program memory space is 16 bits wide, while the
    data RAM space is 8 bits wide


    A read from program memory is executed on 1 byte ata time. A write to program memory is executed onblocks of 64 bytes at a time or 2 bytes at a time.Program memory is erased in blocks of 1024 bytes at
    a time.

    7.4 Erasing Flash Program Memory
    The minimum erase block is 512 words or 1024 bytes.
    Only through the use of an external programmer, or
    through ICSP control, can larger blocks of program
    memory be bulk erased. Word erase in the Flash array
    is not supported.


    7.5.2 FLASH PROGRAM MEMORY WRITE
    SEQUENCE (WORD PRORAMMING).
    The PIC18F46J11 family of devices has a feature that
    allows programming a single word (two bytes). This
    feature is enabled when the WPROG bit is set.

    Last edited by Jumper; - 26th January 2012 at 11:23.

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