Can anyone help me to use Writecode for pic18f458 ?


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Dip,

    With the 16F877, you can easily write one word at a time to Flash. When the 16F877A came along, you had to write 4 words at a time. And now with the 18F's, you have to write 8 bytes (still 4 words). And some of the newer ones require 16 bytes.

    Also with the 877, the chip automatically erases the location being written to. The 18F's have to be erased first, or be writing to locations that were previously erased, or left blank after programming. When erasing 18F's, it erases a block of 64 bytes at a time.

    So, if you want to write to Flash at $200, you have to write from $200 to $207.

    If instead you wanted to write to $19C, you'd have to write from $198 to $19F.

    It actually places the data in "Holding Registers" untill the last byte is recieved. Then it does the write to flash. So unless it gets a byte for the eighth location, it never actually does the write.
    <br>
    DT

  2. #2
    Join Date
    Feb 2006
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    Hello, Darrel
    I try to program pic18f458 with code

    I var byte ' Loop count
    D var word ' Data
    A var word ' Address

    A=$04F0 '
    d=$1234

    For I = 0 To 7 '
    Writecode A,D '
    Next I

    stop
    end

    as You recommended to write , but this code not worked.
    Can I program pic18f458 by commands writecode address,data
    from picbasicpro2.46 ?
    Because writecode must write only 16 bit data, not 8 bit as You recommended
    Please write Me a sample of code in pbp2.46 mnemonics.

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Try this...
    Code:
    I var byte ' Loop count
    D var word ' Data
    A var word ' Address
    
    A=$04F0
    d=$1234
    
    For I = 0 TO 6 STEP 2
        Writecode A + I, D
    Next I
    
    stop
    end
    DT

  4. #4
    Join Date
    Feb 2006
    Posts
    9


    Did you find this post helpful? Yes | No

    Smile

    Hi,Darrel

    Thanks, Your code is OK!!!!!!!!!!!

    Best regards from

    Kiev, Ukraine

    ps.sorry for bad English

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. I need help with writecode
    By Marten in forum General
    Replies: 2
    Last Post: - 2nd March 2005, 22:15

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