Broken code


Closed Thread
Results 1 to 23 of 23

Thread: Broken code

Hybrid View

  1. #1
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Do you have any BRANCH instructions which may need to be changed to BRANCHL ?
    Keith

    www.diyha.co.uk
    www.kat5.tv

  2. #2
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default

    Nope. Only old useful Goto and GOSUB. By the way I can't see anything strange with the LST file.

    Mike

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Check to see if you have a GOSUB to any routine that doesn't issue a
    RETURN to get back.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default

    Thank you for all ideas but still no luck in fixing the problem. The program jumps to the sub but the sub makes some really strange things before it jumps back to where should. If I just remove the new variable or make it a Byte size things are working. I will see what happenes if I make 2 new byte size variables, that should be similar to making one word variable and using a word variable becomes crap.

    Later.....
    Mike

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


    Did you find this post helpful? Yes | No

    Default

    Since we have to play 20 questions here...

    Do you have any Assembly instructions in your code?

    Adding a variable might move something to a different bank than the program is expecting.
    <br>
    DT

  6. #6
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default Update

    Sorry for playing "20 questions". I could not post the code because the code should not be public knowledge. Anyway the problem is solved and here is an update.

    The problem is with RAM allocation, PBP has a problem when assigning RAM space to variables. In this case one byte of a WORD size variable was assigned to the last adress in BANKA and the other byte of the same Word variable to the first adress in BANK0. Variables can not span 2 banks and this is why strange things happend. Melabs helped me to find this and they are working on a fix for this. There is a workaround, assign any BYTE size variable to the last adress of each bank you are using. Check the .ASM file and you can see how many variables you are using. This problem can happen between all RAM banks not only BANKA and BANK0. For 18F4620 that I use I added

    n Var Byte $7F

    This prevents a WORD to be assigned to the last adress of BANKA and also solved the problem.

    If you have a program with many variables this is something you would like to check. This problem is ALSO in current versions of 2.47!

    Mike
    Last edited by sinoteq; - 17th February 2007 at 04:34.

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Melanies RTC code has broken
    By keithdoxey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th October 2006, 15:22

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