Apparent code size problem


Results 1 to 11 of 11

Threaded View

  1. #4
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default I think I have seen this before

    What you say looks like something I had some time ago. Check the forum for broken code. http://www.picbasic.co.uk/forum/showthread.php?t=5674

    The problem is when you add a new variable PBP makes a word variable span 2 banks and that is not allowed. If this happens you get "The Harry Potter Syndrome" black magic and nothing is logical anymore. I fixed this for my 18F4620 pic by adding a dummy variable at the last address in each bank. For example:

    bogus_0 VAR BYTE $7F ' force a byte at location 07F
    bogus_1 VAR BYTE $0FF ' force a byte at location 0FF
    bogus_2 VAR BYTE $1FF ' force a byte at location 1FF
    bogus_3 VAR BYTE $2FF ' force a byte at location 2FF
    bogus_4 VAR BYTE $3FF ' force a byte at location 3FF
    bogus_5 VAR BYTE $4FF ' force a byte at location 4FF
    bogus_6 VAR BYTE $5FF ' force a byte at location 5FF
    bogus_7 VAR BYTE $6FF ' force a byte at location 6FF
    bogus_8 VAR BYTE $7FF ' force a byte at location 7FF

    Make sure you get the location right, depending on MCU you should go for different values. Look in the .ASM file for your compiled program and early you will find:

    BANK0_START EQU 00080h
    BANK0_END EQU 000FFh
    BANK1_START EQU 00100h
    BANK1_END EQU 001FFh
    BANK2_START EQU 00200h
    BANK2_END EQU 002FFh
    BANK3_START EQU 00300h
    BANK3_END EQU 003FFh

    Use the END value for you bogus variable and PBP can not make this misstake. Make sure you include BANKA also in the fix.

    Hope this will help to remove Harry Potter from your code. And YES MELABS knows about this because they helped me to find it.

    Mike
    Last edited by sinoteq; - 26th July 2007 at 14:25.

Similar Threads

  1. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  2. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  3. problem with my code
    By civicgundam in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 3rd February 2008, 01:52
  4. Setting code size boundaries
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th March 2007, 20:11
  5. Servo Code problem
    By ALFRED in forum General
    Replies: 1
    Last Post: - 2nd March 2006, 03:30

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