@goto not working please help


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2011
    Posts
    21

    Default @goto not working please help

    hello,
    the below code first erase memory location and then write some code from external eeprom and then uses goto statement to jump to execute new code. everything is working properly except the goto statement. it return back without executing the code. target pic is pic18f4550. i am using DT_INTS-18 and DT_HID260 for usb. i would really appreciate any help.
    Code:
                for aa = $69A0 to $6B9F step 64
                    erasecode aa 
                next aa
                for aa = $69A0 to $6B9F
                    i2cread sda, SCL, $A1, cc, [w2]
                    writecode aa, w2
                    cc = cc + 1
                next aa 
                @goto 0x69A0
    my idea is to store firmware in external eeprom and then programming 18f4550 from it, similar to bootloader but using external eeprom
    thank you

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


    Did you find this post helpful? Yes | No

    Default Re: @goto not working please help

    The Flash blocks of 64 bytes are at physical boudaries.
    $69A0 is in the middle of the block that begins at $6980.

    The next block starts at $69C0.
    You have to write exactly 64 bytes per block, and the write to flash doesn't actually happen until the last of the 64 bytes is sent.

    Also, there needs to be a space between the @ sign and goto.
    DT

  3. #3
    Join Date
    Jul 2011
    Posts
    21


    Did you find this post helpful? Yes | No

    Default Re: @goto not working please help

    Quote Originally Posted by Darrel Taylor View Post
    The Flash blocks of 64 bytes are at physical boudaries.
    $69A0 is in the middle of the block that begins at $6980.

    The next block starts at $69C0.
    You have to write exactly 64 bytes per block, and the write to flash doesn't actually happen until the last of the 64 bytes is sent.

    Also, there needs to be a space between the @ sign and goto.
    thank you Darrel for you response
    18f4550 datasheet states that write to program memory is executed on blocks of 32 bytes at a time and program memory is erased in blocks of 64 bytes at a time. i have also checked 18f4550 program memory using programmer, code does get written to flash.
    i tired putting space between @ sign and goto it didn't helped much

    if i don't use DT_INTS-18 and DT_HID260 then @ goto statement works, i think because there are no interrupts to disturb the @ goto.
    but i want to use them because i want USB functionality and easy way of interrupts. so how do i use three of them together DT_INTS-18, DT_HID260 and @ goto

    thank you

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


    Did you find this post helpful? Yes | No

    Default Re: @goto not working please help

    Right you are. 32 bytes.
    Sorry, I was looking at the erase size.

    I don't see why it shouldn't work with the interrupts. It's just like jumping to any other part of the program.

    How do you get the code that is being loaded from EEPROM?
    Is it compiled separately?
    Was it compiled at the correct address?
    DT

  5. #5
    Join Date
    Jul 2011
    Posts
    21


    Did you find this post helpful? Yes | No

    Default Re: @goto not working please help

    Quote Originally Posted by Darrel Taylor View Post
    Was it compiled at the correct address?
    many thanks Darrel, it now worked.
    i never gave it a thought. you made my day.

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