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




Bookmarks